diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-12-12 10:09:24 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-12 10:09:24 +0900 |
| commit | 0f286e855f9b1035e76d5f2c8c8fc26cab351632 (patch) | |
| tree | b6cb854632548a4f988f095337420378c60baa65 /src/test | |
| parent | 3cf799640fd16d306dd72c97d9e6cf84932b34b7 (diff) | |
| parent | 914c9aa78d7d43d268690e2cf1ae634795cd29aa (diff) | |
| download | rust-0f286e855f9b1035e76d5f2c8c8fc26cab351632.tar.gz rust-0f286e855f9b1035e76d5f2c8c8fc26cab351632.zip | |
Rollup merge of #67236 - petrochenkov:docerr2, r=matthewjasper
resolve: Always resolve visibilities on impl items Fixes https://github.com/rust-lang/rust/issues/64705. Similarly to https://github.com/rust-lang/rust/pull/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
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/resolve/impl-items-vis-unresolved.rs | 25 | ||||
| -rw-r--r-- | src/test/ui/resolve/impl-items-vis-unresolved.stderr | 9 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/resolve/impl-items-vis-unresolved.rs b/src/test/ui/resolve/impl-items-vis-unresolved.rs new file mode 100644 index 00000000000..9b4fe498239 --- /dev/null +++ b/src/test/ui/resolve/impl-items-vis-unresolved.rs @@ -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() {} diff --git a/src/test/ui/resolve/impl-items-vis-unresolved.stderr b/src/test/ui/resolve/impl-items-vis-unresolved.stderr new file mode 100644 index 00000000000..8e285e53124 --- /dev/null +++ b/src/test/ui/resolve/impl-items-vis-unresolved.stderr @@ -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`. |
