Avoid recording unnameable extern crate aliases in diagnostic metadata - #158997
Conversation
|
r? @TaKO8Ki rustbot has assigned @TaKO8Ki. Use Why was this reviewer chosen?The reviewer was selected based on:
|
264014a to
6940778
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b236ee3 to
5d31258
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5d31258 to
f9f0a04
Compare
crate::_::_... paths for trait importsextern crate aliases in diagnostic metadata
…Source::Path` Use the `DefPath` to determine whether an `extern crate` item is globally nameable. `extern crate` items nested inside value namespaces cannot be referred to by a stable path outside their enclosing scope. Record them as `ExternCrateSource::Path` instead of `ExternCrateSource::Extern` so later path resolution does not reconstruct unnameable paths.
f9f0a04 to
2e4b8e5
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot reroll |
|
@cjgillot's availability recently dropped. I'm not a good reviewer for this, I think the best alternative is probably: |
…henkov Avoid recording unnameable `extern crate` aliases in diagnostic metadata the root cause was that block scoped `extern crate` aliases were still being recorded as `ExternCrateSource::Extern(def_id)`. later, diagnostics reused that metadata and attempted to print paths through those aliases, producing unnameable paths such as `crate::_::_my_crate`. this change detects `extern crate` items whose `DefPath` passes through a value namespace (for example inside functions or `const` blocks) and records them as `ExternCrateSource::Path` instead. diagnostics then fall back to the crate name rather than an unnameable alias. Closes rust-lang#153459
…henkov Avoid recording unnameable `extern crate` aliases in diagnostic metadata the root cause was that block scoped `extern crate` aliases were still being recorded as `ExternCrateSource::Extern(def_id)`. later, diagnostics reused that metadata and attempted to print paths through those aliases, producing unnameable paths such as `crate::_::_my_crate`. this change detects `extern crate` items whose `DefPath` passes through a value namespace (for example inside functions or `const` blocks) and records them as `ExternCrateSource::Path` instead. diagnostics then fall back to the crate name rather than an unnameable alias. Closes rust-lang#153459
…uwer Rollup of 15 pull requests Successful merges: - #158936 (Add `std::fs::{Home|Media}Dirs`) - #129036 (Additional NonZero conversions) - #158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - #161015 (Stabilize `funnel_shifts` (including `const`)) - #161712 (Stabilize `Result::into_{ok,err}`) - #162493 (Add support for -Zsanitizer-cfi-minimal-runtime) - #162655 (next solver: prefer to select impl candidates over global where-clause candidates) - #162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - #163200 (make `RustaceansAreAwesome` satisfy trait bounds) - #163331 (Move `Arc` and `Rc` into `rcs` mod) - #163427 (implement #![feature(gca_adts)]) - #163428 (do not complain about unstable target features on nightly) - #163444 (Add `stable_rustc` helper in `run-make-support`) - #163447 (Allow using different index types when reading and writing to tables) - #163450 (Force the correct type variable to never for method resolution on an adjusted never type)
This comment has been minimized.
This comment has been minimized.
Avoid recording unnameable `extern crate` aliases in diagnostic metadata the root cause was that block scoped `extern crate` aliases were still being recorded as `ExternCrateSource::Extern(def_id)`. later, diagnostics reused that metadata and attempted to print paths through those aliases, producing unnameable paths such as `crate::_::_my_crate`. this change detects `extern crate` items whose `DefPath` passes through a value namespace (for example inside functions or `const` blocks) and records them as `ExternCrateSource::Path` instead. diagnostics then fall back to the crate name rather than an unnameable alias. Closes #153459
|
💔 Test for 74f4062 failed: CI. Failed job:
|
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
|
@bors retry |
|
⌛ Testing commit 2e4b8e5 with merge 2063b57... Workflow: https://github.com/rust-lang/rust/actions/runs/36538712471 |
Avoid recording unnameable `extern crate` aliases in diagnostic metadata the root cause was that block scoped `extern crate` aliases were still being recorded as `ExternCrateSource::Extern(def_id)`. later, diagnostics reused that metadata and attempted to print paths through those aliases, producing unnameable paths such as `crate::_::_my_crate`. this change detects `extern crate` items whose `DefPath` passes through a value namespace (for example inside functions or `const` blocks) and records them as `ExternCrateSource::Path` instead. diagnostics then fall back to the crate name rather than an unnameable alias. Closes #153459
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #163472. |
…uwer Rollup of 9 pull requests Successful merges: - #158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - #162655 (next solver: prefer to select impl candidates over global where-clause candidates) - #162832 (add `Div` and `Mul` for `Complex<{float}>`) - #162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - #163200 (make `RustaceansAreAwesome` satisfy trait bounds) - #163210 (std: split stack overflow module) - #163331 (Move `Arc` and `Rc` into `rcs` mod) - #163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - #163450 (Force the correct type variable to never for method resolution on an adjusted never type)
Rollup merge of #158997 - raushan728:issues/153459, r=petrochenkov Avoid recording unnameable `extern crate` aliases in diagnostic metadata the root cause was that block scoped `extern crate` aliases were still being recorded as `ExternCrateSource::Extern(def_id)`. later, diagnostics reused that metadata and attempted to print paths through those aliases, producing unnameable paths such as `crate::_::_my_crate`. this change detects `extern crate` items whose `DefPath` passes through a value namespace (for example inside functions or `const` blocks) and records them as `ExternCrateSource::Path` instead. diagnostics then fall back to the crate name rather than an unnameable alias. Closes #153459
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - rust-lang/rust#162655 (next solver: prefer to select impl candidates over global where-clause candidates) - rust-lang/rust#162832 (add `Div` and `Mul` for `Complex<{float}>`) - rust-lang/rust#162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - rust-lang/rust#163200 (make `RustaceansAreAwesome` satisfy trait bounds) - rust-lang/rust#163210 (std: split stack overflow module) - rust-lang/rust#163331 (Move `Arc` and `Rc` into `rcs` mod) - rust-lang/rust#163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - rust-lang/rust#163450 (Force the correct type variable to never for method resolution on an adjusted never type)
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#158997 (Avoid recording unnameable `extern crate` aliases in diagnostic metadata) - rust-lang/rust#162655 (next solver: prefer to select impl candidates over global where-clause candidates) - rust-lang/rust#162832 (add `Div` and `Mul` for `Complex<{float}>`) - rust-lang/rust#162862 (Fix intra doc link resolution when a doc comment is composed of both inner and outer doc comment) - rust-lang/rust#163200 (make `RustaceansAreAwesome` satisfy trait bounds) - rust-lang/rust#163210 (std: split stack overflow module) - rust-lang/rust#163331 (Move `Arc` and `Rc` into `rcs` mod) - rust-lang/rust#163183 (Add .seek_read_buf_exact() to std::os::windows::fs::FileExt) - rust-lang/rust#163450 (Force the correct type variable to never for method resolution on an adjusted never type)
View all comments
the root cause was that block scoped
extern cratealiases were still being recorded asExternCrateSource::Extern(def_id). later, diagnostics reused that metadata and attempted to print paths through those aliases, producing unnameable paths such ascrate::_::_my_crate.this change detects
extern crateitems whoseDefPathpasses through a value namespace (for example inside functions orconstblocks) and records them asExternCrateSource::Pathinstead. diagnostics then fall back to the crate name rather than an unnameable alias.Closes #153459