Skip to content
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

Try to point out when edition 2024 lifetime capture rules cause borrowck issues #131186

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Oct 3, 2024

Lifetime capture rules in 2024 are modified to capture more lifetimes, which sometimes lead to some non-local borrowck errors. This PR attempts to link these back together with a useful note pointing out the capture rule changes.

This is not a blocking concern, but I'd appreciate feedback (though, again, I'd like to stress that I don't want to block this PR on this): I'm worried about this note drowning in the sea of other diagnostics that borrowck emits. I was tempted to change the level of the note to .span_warn just so it would show up in a different color. Thoughts?

Fixes #130545

Opening as a draft first since it's stacked on #131183.
r? @ghost

@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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 3, 2024
Applicability::MaybeIncorrect,
);
} else {
diag.span_help(
Copy link
Contributor

@estebank estebank Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this a structured suggestion? Edit: because it's checking if it's not the current crate, got it.

@compiler-errors
Copy link
Member Author

r? @estebank, would you be willing to help out with the wording/etc. here? Otherwise, please feel free to reassign. I know the lifetime logic is kinda sketchy, but after all it's a diagnostic so 🤷

@compiler-errors compiler-errors marked this pull request as ready for review October 4, 2024 03:34
@rustbot
Copy link
Collaborator

rustbot commented Oct 4, 2024

HIR ty lowering was modified

cc @fmease

@compiler-errors
Copy link
Member Author

Let's see the cost of the cross-crate encoding of opaque origin.

@bors try @rust-timer

@bors
Copy link
Contributor

bors commented Oct 4, 2024

⌛ Trying commit 3b98411 with merge 17a60f6...

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 4, 2024
…rrowck, r=<try>

Try to point out when edition 2024 lifetime capture rules cause borrowck issues

Lifetime capture rules in 2024 are modified to capture more lifetimes, which sometimes lead to some non-local borrowck errors. This PR attempts to link these back together with a useful note pointing out the capture rule changes.

This is not a blocking concern, but I'd appreciate feedback (though, again, I'd like to stress that I don't want to block this PR on this): I'm worried about this note drowning in the sea of other diagnostics that borrowck emits. I was tempted to change the level of the note to `.span_warn` just so it would show up in a different color. Thoughts?

Fixes rust-lang#130545

Opening as a draft first since it's stacked on rust-lang#131183.
r? `@ghost`
@bors
Copy link
Contributor

bors commented Oct 4, 2024

☀️ Try build successful - checks-actions
Build commit: 17a60f6 (17a60f6d33bf58ecd032c2545d56965569adb3e8)

@compiler-errors
Copy link
Member Author

ugh lol

@rust-timer build 17a60f6

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (17a60f6): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary -2.4%)

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-3.0%, -2.1%] 4
All ❌✅ (primary) - - 0

Cycles

Results (secondary 3.9%)

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.9% [3.2%, 4.8%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.1%, secondary 0.2%)

This 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.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.3%] 32
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.0%, 0.3%] 32

Bootstrap: 774.169s -> 772.785s (-0.18%)
Artifact size: 342.02 MiB -> 342.06 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve borrow checking error in cases where + use<> could be used
5 participants