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#67236 - petrochenkov:docerr2, r=matthewjasper
resolve: Always resolve visibilities on impl items Fixes rust-lang#64705. Similarly to rust-lang#67106 this was an issue with visitor discipline. Impl items were visited as a part of visiting `ast::ItemKind::Impl`, but they should be visit-able in isolation from their parents as well, because that's how they are visited when they are expanded from macros. I've checked that all the remaining `resolve_visibility` calls are used correctly. r? @matthewjasper
- Loading branch information
Showing
3 changed files
with
46 additions
and
12 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,25 @@ | ||
// Visibilities on impl items expanded from macros are resolved (issue #64705). | ||
|
||
macro_rules! perftools_inline { | ||
($($item:tt)*) => ( | ||
$($item)* | ||
); | ||
} | ||
|
||
mod state { | ||
pub struct RawFloatState; | ||
impl RawFloatState { | ||
perftools_inline! { | ||
pub(super) fn new() {} // OK | ||
} | ||
} | ||
} | ||
|
||
pub struct RawFloatState; | ||
impl RawFloatState { | ||
perftools_inline! { | ||
pub(super) fn new() {} //~ ERROR failed to resolve: there are too many initial `super`s | ||
} | ||
} | ||
|
||
fn main() {} |
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,9 @@ | ||
error[E0433]: failed to resolve: there are too many initial `super`s. | ||
--> $DIR/impl-items-vis-unresolved.rs:21:13 | ||
| | ||
LL | pub(super) fn new() {} | ||
| ^^^^^ there are too many initial `super`s. | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0433`. |