Skip to content

Rollup of 11 pull requests #132497

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

Merged
merged 27 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ee4b044
rust_analyzer_helix.toml: add library/ manifest
tshepang Oct 29, 2024
df8c20d
Add intra-doc link in str::xxx_prefix
krtab Oct 30, 2024
df44526
Add intra-doc link in str::xxx_char_boundary
krtab Oct 30, 2024
57673dd
Remove needless #![feature(asm_experimental_arch)] from loongarch64 i…
taiki-e Nov 1, 2024
37db365
Also treat `impl` definition parent as transparent regarding modules
Urgau Nov 1, 2024
e123315
Move versioned LLVM target creation to rustc_codegen_ssa
madsmtm Nov 1, 2024
e75a7dd
Move Mach-O platform information to rustc_codegen_ssa::back::apple
madsmtm Nov 1, 2024
1ef1af1
Emit diagnostics for incorrect deployment targets
madsmtm Sep 29, 2024
45d4465
Account for late-bound depth when capturing all opaque lifetimes.
cjgillot Nov 1, 2024
e169483
refactor(config): remove FIXME statement in comment of `omit-git-hash`
ismailarilik Nov 1, 2024
a7f6095
Skip late-bound lifetimes when crossing an AnonConst.
cjgillot Nov 1, 2024
e2a50de
Use more minimized test.
cjgillot Nov 1, 2024
e4305f1
Add a bunch of mailmap entries
Noratrieb Nov 1, 2024
d39270f
CI: switch dist-x86_64-musl to free runner
marcoieni Nov 1, 2024
9e5e47f
Remove or fix some FIXME(async_closure)
compiler-errors Nov 2, 2024
d2aa910
Add a Few Codegen Tests
veera-sivarajan Oct 26, 2024
bb544f8
Rollup merge of #131037 - madsmtm:move-llvm-target-versioning, r=petr…
matthiaskrgr Nov 2, 2024
a513e0e
Rollup merge of #132170 - veera-sivarajan:codegen-tests, r=jieyouxu
matthiaskrgr Nov 2, 2024
4b7bfaa
Rollup merge of #132333 - tshepang:patch-4, r=workingjubilee
matthiaskrgr Nov 2, 2024
ec1cebf
Rollup merge of #132398 - krtab:add_doc_link, r=Noratrieb
matthiaskrgr Nov 2, 2024
e5269bb
Rollup merge of #132411 - MarcoIeni:ci-switch-to-free-runners, r=Kobzol
matthiaskrgr Nov 2, 2024
fa69b67
Rollup merge of #132453 - Urgau:non_local_defs-impl-mod-transparent, …
matthiaskrgr Nov 2, 2024
b1d059f
Rollup merge of #132457 - taiki-e:needless-feature, r=workingjubilee
matthiaskrgr Nov 2, 2024
737cc83
Rollup merge of #132465 - ismailarilik:refactor/config/remove-fixme-c…
matthiaskrgr Nov 2, 2024
020b63a
Rollup merge of #132466 - cjgillot:opaque-late, r=compiler-errors
matthiaskrgr Nov 2, 2024
b9798d3
Rollup merge of #132471 - Noratrieb:lots-of-mailmapping, r=Mark-Simul…
matthiaskrgr Nov 2, 2024
30497b0
Rollup merge of #132488 - compiler-errors:more-fixmes-bye, r=jieyouxu
matthiaskrgr Nov 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Also treat impl definition parent as transparent regarding modules
  • Loading branch information
Urgau committed Nov 1, 2024
commit 37db36594838d85f72e2282e73707071e80e31c0
10 changes: 8 additions & 2 deletions compiler/rustc_lint/src/non_local_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,15 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
// };
// };
// ```
//
// It isn't possible to mix a impl in a module with const-anon, but an item can
// be put inside a module and referenced by a impl so we also have to treat the
// item parent as transparent to module and for consistency we have to do the same
// for impl, otherwise the item-def and impl-def won't have the same parent.
let outermost_impl_parent = peel_parent_while(cx.tcx, parent, |tcx, did| {
tcx.def_kind(did) == DefKind::Const
&& tcx.opt_item_name(did) == Some(kw::Underscore)
tcx.def_kind(did) == DefKind::Mod
|| (tcx.def_kind(did) == DefKind::Const
&& tcx.opt_item_name(did) == Some(kw::Underscore))
});

// 2. We check if any of the paths reference a the `impl`-parent.
Expand Down
64 changes: 64 additions & 0 deletions tests/ui/lint/non-local-defs/convoluted-locals-132427.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Regression tests for https://github.com/rust-lang/rust/issues/132427

//@ check-pass

// original
mod auth {
const _: () = {
pub enum ArbitraryContext {}

const _: () = {
impl ArbitraryContext {}
};
};
}

mod z {
pub enum ArbitraryContext {}

const _: () = {
const _: () = {
impl ArbitraryContext {}
};
};
}

const _: () = {
mod auth {
const _: () = {
pub enum ArbitraryContext {}

const _: () = {
impl ArbitraryContext {}
};
};
}
};

mod a {
mod b {
const _: () = {
pub enum ArbitraryContext {}

const _: () = {
impl ArbitraryContext {}
};
};
}
}

mod foo {
const _: () = {
mod auth {
const _: () = {
pub enum ArbitraryContext {}

const _: () = {
impl ArbitraryContext {}
};
};
}
};
}

fn main() {}
Loading