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

Span of local crate leaks into tcx.optimized_mir of other crate #58808

Closed
bjorn3 opened this issue Feb 28, 2019 · 4 comments · Fixed by #86153
Closed

Span of local crate leaks into tcx.optimized_mir of other crate #58808

bjorn3 opened this issue Feb 28, 2019 · 4 comments · Fixed by #86153
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

@bjorn3
Copy link
Member

bjorn3 commented Feb 28, 2019

$ MIRI_SYSROOT=/home/bjorn/.cache/miri/HOST cargo run -- core mir "DefId(1/0:20381 ~ core[eddd]::char[0]::convert[0]::{{impl}}[9]::fmt[0])"
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/rlib_view core mir 'DefId(1/0:20381 ~ core[eddd]::char[0]::convert[0]::{{impl}}[9]::fmt[0])'`
Reading rlib core
Rust args: ["core", "/some_nonexistent_dummy_path", "--sysroot", "/home/bjorn/.cache/miri/HOST", "-Cpanic=abort"]
error: `#[panic_handler]` function required, but not found

mir for <core::char::ParseCharError as core::fmt::Debug>::fmt:

[...]
        StorageLive(_4);                 // bb0[5]: scope 1 at /some_nonexistent_dummy_path:1:1: 1:1
[...]
        StorageDead(_7);                 // bb1[3]: scope 1 at /some_nonexistent_dummy_path:1:1: 1:1
[...]
@bjorn3
Copy link
Member Author

bjorn3 commented Feb 28, 2019

Sysroot has been compiled using cargo miri setup to get -Zalways-encode-mir set. Otherwise it is hard to guess a defid with encoded mir, now it is just taking the first exported symbol from:

$ MIRI_SYSROOT=/home/bjorn/.cache/miri/HOST cargo run -- core symbols |& head
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/rlib_view core symbols`
Reading rlib core
Rust args: ["core", "/some_nonexistent_dummy_path", "--sysroot", "/home/bjorn/.cache/miri/HOST", "-Cpanic=abort"]
error: `#[panic_handler]` function required, but not found


Exported symbols:
    Rust <core::char::ParseCharError as core::fmt::Debug>::fmt (DefId(1/0:20381 ~ core[eddd]::char[0]::convert[0]::{{impl}}[9]::fmt[0]))
    Rust core::fmt::Formatter::alternate (DefId(1/0:4257 ~ core[eddd]::fmt[0]::{{impl}}[6]::alternate[0]))
[1]    22404 illegal hardware instruction  MIRI_SYSROOT=/home/bjorn/.cache/miri/HOST cargo run -- core symbols 2>&1 | 
       22405 done                          head

@bjorn3
Copy link
Member Author

bjorn3 commented Feb 28, 2019

I used https://github.com/bjorn3/rust_read_rlib to read the mir.

@jonas-schievink jonas-schievink added A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Apr 21, 2019
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 27, 2020

I think these are DUMMY_SP and printed as /some_nonexistent_dummy_path:1:1: 1:1. If so it would be less confusing if the debug impl of DUMMY_SP would say DUMMY_SP or something like that instead.

@oli-obk oli-obk added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. and removed E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Jun 8, 2021
@oli-obk
Copy link
Contributor

oli-obk commented Jun 8, 2021

I'm unsure how to reproduce the environment to reproduce this bug. It's easy to adjust the debug printing for DUMMY_SP, but without a test for that I'm not sure how to test it

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 11, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jun 11, 2021
@bors bors closed this as completed in 79c0559 Jun 12, 2021
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.

3 participants