-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix generating CTFE backtrace on optimized MIR #66203
Conversation
r? @zackmdavis (rust_highfive has picked a reviewer for you, use r? to override) |
☔ The latest upstream changes (presumably #60026) made this pull request unmergeable. Please resolve the merge conflicts. |
During MIR optimization, we may inline function calls acrross crates. While we can inline the corresponding scopes into `Body.source_scopes`, we cannot inline the corresponding data from `source_scope_local_data`, since it references crate-local data. This commit makes us fall back to the root lint level when generating a CTFE backtrace, if it was not possible to find crate-local data for a scope in `source_scope_local_data`. Fixes rust-lang#66137
4a9908c
to
dadd817
Compare
@@ -105,6 +105,14 @@ pub struct Body<'tcx> { | |||
|
|||
/// Crate-local information for each source scope, that can't (and | |||
/// needn't) be tracked across crates. | |||
/// | |||
/// Before optimizations run, every scope in `source_scopes` is guarnateed |
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.
*guaranteed
I've proposed an alternative in #66137 (comment), FWIW. |
Ping from Triage: any update @bjorn3? @zackmdavis @Aaron1011 |
I'm implementing the change suggested by @eddyb |
@eddyb: Your proposed change results in a large amount of churn across several files. In particular, it complicates code that initially creates the I think it's simpler to just adjust the only code that needs to use |
I'm not sure it's possible to have correct You'd at the very least need to put an |
Ping from triage: @Aaron1011 can you address the comments from @eddyb ? Thanks |
One week later: #66789. @JohnCSimon This was actually waiting for me, sorry. |
…r=oli-obk rustc: move mir::SourceScopeLocalData to a field of SourceScopeData. By having one `ClearCrossCrate<SourceScopeLocalData>` for each scope, as opposed to a single `ClearCrossCrate` for all the `SourceScopeLocalData`s, we can represent the fact that some scopes have `SourceScopeLocalData` associated with them, and some don't. This is useful when doing MIR inlining across crates, because the `ClearCrossCrate` will be `Clear` for the cross-crate MIR scopes and `Set` for the local ones. Also see rust-lang#66203 (comment) for some context around this approach. Fixes rust-lang#51314.
…r=oli-obk rustc: move mir::SourceScopeLocalData to a field of SourceScopeData. By having one `ClearCrossCrate<SourceScopeLocalData>` for each scope, as opposed to a single `ClearCrossCrate` for all the `SourceScopeLocalData`s, we can represent the fact that some scopes have `SourceScopeLocalData` associated with them, and some don't. This is useful when doing MIR inlining across crates, because the `ClearCrossCrate` will be `Clear` for the cross-crate MIR scopes and `Set` for the local ones. Also see rust-lang#66203 (comment) for some context around this approach. Fixes rust-lang#51314.
…r=oli-obk rustc: move mir::SourceScopeLocalData to a field of SourceScopeData. By having one `ClearCrossCrate<SourceScopeLocalData>` for each scope, as opposed to a single `ClearCrossCrate` for all the `SourceScopeLocalData`s, we can represent the fact that some scopes have `SourceScopeLocalData` associated with them, and some don't. This is useful when doing MIR inlining across crates, because the `ClearCrossCrate` will be `Clear` for the cross-crate MIR scopes and `Set` for the local ones. Also see rust-lang#66203 (comment) for some context around this approach. Fixes rust-lang#51314.
☔ The latest upstream changes (presumably #66944) made this pull request unmergeable. Please resolve the merge conflicts. |
Superseded by #66789 |
During MIR optimization, we may inline function calls acrross crates.
While we can inline the corresponding scopes into
Body.source_scopes
,we cannot inline the corresponding data from
source_scope_local_data
,since it references crate-local data.
This commit makes us fall back to the root lint level when generating a
CTFE backtrace, if it was not possible to find crate-local data for a
scope in
source_scope_local_data
.Fixes #66137