-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Implement syntax for impl Trait to specify its captures explicitly (feature(precise_capturing))
#123468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
oli-obk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first round
| = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from | ||
| help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | ||
| | | ||
| LL | fn no_elided_lt() -> impl use<'static> Sized {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kinda funny that this suggests something that will also get rejected
tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt |
|
@bors r+ rollup=never |
|
☔ The latest upstream changes (presumably #120131) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Did someone synchronize the queue? It currently shows up in the queue. |
|
this is not merged yet lol |
|
It's almost there, I trust bors to push it through! |
|
ci hasn't started yet? 😅 |
|
It was already successful (#123468 (comment)), we just need bors to redo it again. (If something fails, I'll circle back to this :) I'm doing triage now, and this was already recorded in the perf database). |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test failed - checks-actions |
|
This CI failure is unrelated to this PR (https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Depending.20on.20beta.2Funreleased.20OS.2Fpackages.20in.20CI.20jobs). It should be fixed by #123963. |
|
@bors retry |
|
☀️ Test successful - checks-actions |
1 similar comment
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (4e1f5d9): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 678.547s -> 678.675s (0.02%) |
Implements
impl use<'a, 'b, T, U> Sizedsyntax that allows users to explicitly list the captured parameters for an opaque, rather than inferring it from the opaque's bounds (or capturing all lifetimes under 2024-edition capture rules). This allows us to exclude some implicit captures, so this syntax may be used as a migration strategy for changes due to #117587.We represent this list of captured params as
PreciseCapturingArgin AST and HIR, resolving them betweenrustc_resolveandresolve_bound_vars. Later on, we validate that the opaques only capture the parameters in this list.We artificially limit the feature to require mentioning all type and const parameters, since we don't currently have support for non-lifetime bivariant generics. This can be relaxed in the future.
We also may need to limit this to require naming all lifetime parameters for RPITIT, since GATs have no variance. I have to investigate this. This can also be relaxed in the future.
r? @oli-obk
Tracking issue:
precise_capturingsyntax #123432