-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Distinguish crates with the same name in type errors #117609
Conversation
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
3ac20da
to
407099e
Compare
@rustbot label +A-metadata |
This comment has been minimized.
This comment has been minimized.
i ... don't understand how that error is possible? hashbrown.rs is only 1 line long lol |
407099e
to
c25af3d
Compare
oh i forgot to push a commit lol |
@bors r+ rollup |
Distinguish crates with the same name in type errors Previously, errors for crates with the same name would only distinguish them by the span of the source: ``` note: `HashMap<_, _, _, _>` is defined in crate `hashbrown` --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1 note: `HashMap<u32, u32>` is defined in crate `hashbrown` --> /Users/jyn/.local/lib/cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1 ``` When the same version of the crate is loaded twice, this isn't particularly helpful. Additionally show where the .rlib was loaded from (in this case one was loaded from the sysroot and the other from a cargo target dir). Fixes rust-lang#110055.
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#117578 (Derive `TyEncodable`/`TyDecodable` in `rustc_type_ir`) - rust-lang#117592 (Use the correct span when emitting the `env!` result) - rust-lang#117609 (Distinguish crates with the same name in type errors) - rust-lang#117613 (Remove from vacation and compiler review group) - rust-lang#117615 (Couple of small changes) r? `@ghost` `@rustbot` modify labels: rollup
lol just fyi literally every pr i make should not be marked as rollup=always |
i can't replicate this locally with |
oh it's because the source for the cargo registry is available lmao blocked on #113611 |
yes ok |
c25af3d
to
7f4072f
Compare
Previously, errors for crates with the same name would only distinguish them by the span of the source: ``` note: `HashMap<_, _, _, _>` is defined in crate `hashbrown` --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1 note: `HashMap<u32, u32>` is defined in crate `hashbrown` --> /Users/jyn/.local/lib/cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1 ``` When the same version of the crate is loaded twice, this isn't particularly helpful. Additionally show where the .rlib was loaded from (in this case one was loaded from the sysroot and the other from a cargo target dir). --- This also remaps cargo paths more eagerly; particularly, it unconditionally remaps cargo paths for libstd unconditionally, even if `remap-debuginfo = false`. This is the first time that cargo paths have shown up in UI tests; if the paths aren't remapped, they will differ depending on the value of `remap-debuginfo`, which means tests will fail either locally or in CI. This can't be worked around with adhoc normalization in the test makefile because it impacts the column width used for line numbers (when paths are remapped, we don't show the cargo sources). I could be convinced this is not the best solution. It's possible we could take some other approach, like how `CFG_VIRTUAL_RUST_SOURCE_BASE_DIR` opportunistically reverses the mapping for `compiler/`, which doesn't impact the error messages standard library developers see. That would be a bit more involved to get working, though.
7f4072f
to
c790313
Compare
@bors r+ |
you probably want to turn off rollup=always |
@bors rollup=never |
Distinguish crates with the same name in type errors Previously, errors for crates with the same name would only distinguish them by the span of the source: ``` note: `HashMap<_, _, _, _>` is defined in crate `hashbrown` --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1 note: `HashMap<u32, u32>` is defined in crate `hashbrown` --> /Users/jyn/.local/lib/cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/map.rs:188:1 ``` When the same version of the crate is loaded twice, this isn't particularly helpful. Additionally show where the .rlib was loaded from (in this case one was loaded from the sysroot and the other from a cargo target dir). --- This also remaps cargo paths more eagerly; particularly, it unconditionally remaps cargo paths for libstd unconditionally, even if `remap-debuginfo = false`. This is the first time that cargo paths have shown up in UI tests; if the paths aren't remapped, they will differ depending on the value of `remap-debuginfo`, which means tests will fail either locally or in CI. This can't be worked around with adhoc normalization in the test makefile because it impacts the column width used for line numbers (when paths are remapped, we don't show the cargo sources). I could be convinced this is not the best solution. It's possible we could take some other approach, like how `CFG_VIRTUAL_RUST_SOURCE_BASE_DIR` opportunistically reverses the mapping for `compiler/`, which doesn't impact the error messages standard library developers see. That would be a bit more involved to get working, though. --- Fixes rust-lang#110055.
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@rustbot author needs blessing i think? |
no, this is still #117609 (comment). i don't know why remapping the cargo registry didn't help. |
@bors r- Probably got back into the queue to a synchronize. |
don't want to spend time debugging this |
Previously, errors for crates with the same name would only distinguish them by the span of the source:
When the same version of the crate is loaded twice, this isn't particularly helpful. Additionally
show where the .rlib was loaded from (in this case one was loaded from the sysroot and the other
from a cargo target dir).
This also remaps cargo paths more eagerly; particularly, it unconditionally remaps cargo paths for
libstd unconditionally, even if
remap-debuginfo = false
. This is the first time that cargo pathshave shown up in UI tests; if the paths aren't remapped, they will differ depending on the value of
remap-debuginfo
, which means tests will fail either locally or in CI. This can't be worked aroundwith adhoc normalization in the test makefile because it impacts the column width used for line
numbers (when paths are remapped, we don't show the cargo sources).
I could be convinced this is not the best solution. It's possible we could take some other approach,
like how
CFG_VIRTUAL_RUST_SOURCE_BASE_DIR
opportunistically reverses the mapping forcompiler/
,which doesn't impact the error messages standard library developers see. That would be a bit more
involved to get working, though.
Fixes #110055.