close
Skip to content

Minor unsoundness fix with FnDef lifetimes#156776

Open
addiesh wants to merge 3 commits into
rust-lang:mainfrom
addiesh:quickfix
Open

Minor unsoundness fix with FnDef lifetimes#156776
addiesh wants to merge 3 commits into
rust-lang:mainfrom
addiesh:quickfix

Conversation

@addiesh
Copy link
Copy Markdown

@addiesh addiesh commented May 20, 2026

This is a minor breaking(?) change that tries to fix some issues brought up in #70917 and #84366 . As far as I can tell, the behavior for closures is still unchanged, which I believe is another part of the unsoundness. I don't have enough experience working with the compiler yet to fix it though.

r? oli-obk

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 20, 2026
@workingjubilee
Copy link
Copy Markdown
Member

Is it breaking for code that is not unsound?

@addiesh
Copy link
Copy Markdown
Author

addiesh commented May 21, 2026

Is it breaking for code that is not unsound?

I'm not sure. Probably not? But worth doing a crater run to make sure.

@oli-obk
Copy link
Copy Markdown
Contributor

oli-obk commented May 22, 2026

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 22, 2026
Minor unsoundness fix with `FnDef` lifetimes
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 22, 2026

☀️ Try build successful (CI)
Build commit: e622d8d (e622d8d7bed4f2668d446e06c6c1436ecae15796, parent: b52edc25bfbaa955b4b83c10f998e5224c3478b2)

@oli-obk
Copy link
Copy Markdown
Contributor

oli-obk commented May 26, 2026

@craterbot check

@craterbot
Copy link
Copy Markdown
Collaborator

👌 Experiment pr-156776 created and queued.
🤖 Automatically detected try build e622d8d
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 26, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-gcc failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] gix_transport test:false 11.960
error[E0309]: the parameter type `V` may not live long enough
  --> src/tools/cargo/src/cargo/util/local_poll_adapter.rs:60:13
   |
18 |   impl<'a, S, K, V, E> LocalPollAdapter<'a, S, K, Result<V, E>>
   |        -- the parameter type `V` must be valid for the lifetime `'a` as defined here...
...
60 | /             async move {
61 | |                 let v = f(self_parameter.deref(), &key).await;
62 | |                 (key, v)
63 | |             }
64 | |             .boxed_local()
   | |__________________________^ ...so that the type `V` will meet its required lifetime bounds
   |
help: consider adding an explicit lifetime bound
   |
22 |     V: Clone + 'a,
   |              ++++

error[E0309]: the parameter type `E` may not live long enough
  --> src/tools/cargo/src/cargo/util/local_poll_adapter.rs:60:13
   |
18 |   impl<'a, S, K, V, E> LocalPollAdapter<'a, S, K, Result<V, E>>
   |        -- the parameter type `E` must be valid for the lifetime `'a` as defined here...
...
60 | /             async move {
61 | |                 let v = f(self_parameter.deref(), &key).await;
62 | |                 (key, v)
63 | |             }
64 | |             .boxed_local()
   | |__________________________^ ...so that the type `E` will meet its required lifetime bounds
   |
help: consider adding an explicit lifetime bound
   |
18 | impl<'a, S, K, V, E: 'a> LocalPollAdapter<'a, S, K, Result<V, E>>
   |                    ++++

For more information about this error, try `rustc --explain E0309`.
[RUSTC-TIMING] cargo test:false 28.564
error: could not compile `cargo` (lib) due to 2 previous errors

For more information how to resolve CI failures of this job, visit this link.

@workingjubilee
Copy link
Copy Markdown
Member

"Probably not" is
the chance that sound code breaks
Yet gcc fails 👀

@addiesh
Copy link
Copy Markdown
Author

addiesh commented May 27, 2026

"Probably not" is

the chance that sound code breaks

Yet gcc fails 👀

oop. I'm new to this stuff 😅. The first error was forgetting to run x test and updating a known-bug to a regression test, the second one is a bit confusing though. I'll have to keep working before any of these changes get merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-crater Status: Waiting on a crater run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants