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

Broken MIR: scope[1] index exists, but source_scope_local_data.len() == 1 #51314

Closed
oli-obk opened this issue Jun 2, 2018 · 5 comments · Fixed by #66789
Closed

Broken MIR: scope[1] index exists, but source_scope_local_data.len() == 1 #51314

oli-obk opened this issue Jun 2, 2018 · 5 comments · Fixed by #66789
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Jun 2, 2018

One test that produces such broken MIR is https://github.com/rust-lang/rust/blob/master/src/test/run-pass/mir-inlining/ice-issue-45885.rs

the MIR is

log.txt

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 2, 2018

cc @eddyb I think promotion fails to adjust the scope indices

@eddyb
Copy link
Member

eddyb commented Jun 3, 2018

I thought the scope data is just cloned from the fn - maybe the "local" part is lost?

@estebank estebank added the A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html label Jan 8, 2019
@JohnTitor JohnTitor added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 10, 2019
@bjorn3
Copy link
Member

bjorn3 commented Nov 23, 2019

The mentioned link gives a 404.

@jonas-schievink
Copy link
Contributor

@Aaron1011
Copy link
Member

See #66203

RalfJung added a commit to RalfJung/rust that referenced this issue Nov 29, 2019
…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.
Centril added a commit to Centril/rust that referenced this issue Dec 1, 2019
…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.
@bors bors closed this as completed in fd09fad Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants