Fix generating CTFE backtrace on optimized MIR#66203
Fix generating CTFE backtrace on optimized MIR#66203Aaron1011 wants to merge 1 commit intorust-lang:masterfrom
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
| /// 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 |
|
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