forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#132453 - Urgau:non_local_defs-impl-mod-tran…
…sparent, r=jieyouxu Also treat `impl` definition parent as transparent regarding modules This PR changes the `non_local_definitions` lint logic to also consider `impl` definition parent as transparent regarding modules. See tests and explanation in the changes. ```@rustbot``` label +L-non_local_definitions Fixes *(after beta-backport)* rust-lang#132427 cc ```@leighmcculloch``` r? ```@jieyouxu```
- Loading branch information
Showing
2 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |