Uh oh!
There was an error while loading. Please reload this page.
Compute proper module parent during resolution - #77984
Conversation
rust-highfive
commented
Oct 15, 2020
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
jyn514
commented
Oct 15, 2020
This same code is copied in rustdoc: rust/src/librustdoc/passes/collect_intra_doc_links.rs Lines 750 to 767 in b385598 Maybe it's worth making this a query or method on tcx? |
Aaron1011
commented
Oct 15, 2020
@jyn514: It's not quite the same code - we don't have a tcx available in the resolver, so we need to go through the |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
Oct 19, 2020
So, the sad part here is that the If const _:() = {#[macro_export]macro_rules! my_macro {() => {};}};was written in the current crate, then We don't track blocks for other crates, so we simply cannot produce a correct answer here. So, returning the closest |
0567261 to
c07f8f8Comparepetrochenkov
commented
Oct 24, 2020
r=me with the test changes #77984 (comment) |
Fixesrust-lang#75982 The direct parent of a module may not be a module (e.g. `const _: () = { #[path = "foo.rs"] mod foo; };`). To find the parent of a module for purposes of resolution, we need to walk up the tree until we hit a module or a crate root.
c07f8f8 to
283053aCompareAaron1011
commented
Oct 24, 2020
@petrochenkov: Your suggested test caught a bug in my implementation. We also need to perform the parent-walking in |
petrochenkov
commented
Oct 24, 2020
@bors r+ |
bors
commented
Oct 24, 2020
📌 Commit 283053a has been approved by |
Rollup of 8 pull requests Successful merges: - rust-lang#77984 (Compute proper module parent during resolution) - rust-lang#78085 (MIR validation should check `SwitchInt` values are valid for the type) - rust-lang#78208 (replace `#[allow_internal_unstable]` with `#[rustc_allow_const_fn_unstable]` for `const fn`s) - rust-lang#78209 (Update `compiler_builtins` to 0.1.36) - rust-lang#78276 (Bump backtrace-rs to enable Mach-O support on iOS.) - rust-lang#78320 (Link to cargo's `build-std` feature instead of `xargo` in custom target docs) - rust-lang#78322 (BTreeMap: stop mistaking node::MIN_LEN for a node level constraint) - rust-lang#78326 (Split out statement attributes changes from rust-lang#78306) Failed merges: r? `@ghost`
Fixes#75982
The direct parent of a module may not be a module
(e.g.
const _: () = { #[path = "foo.rs"] mod foo; };).To find the parent of a module for purposes of resolution, we need to
walk up the tree until we hit a module or a crate root.