diff options
Diffstat (limited to 'tests/ui/resolve')
| -rw-r--r-- | tests/ui/resolve/module-import-resolution-7663.rs | 33 | ||||
| -rw-r--r-- | tests/ui/resolve/path-attr-in-const-block.rs | 2 | ||||
| -rw-r--r-- | tests/ui/resolve/path-attr-in-const-block.stderr | 12 |
3 files changed, 37 insertions, 10 deletions
diff --git a/tests/ui/resolve/module-import-resolution-7663.rs b/tests/ui/resolve/module-import-resolution-7663.rs new file mode 100644 index 00000000000..872806594fc --- /dev/null +++ b/tests/ui/resolve/module-import-resolution-7663.rs @@ -0,0 +1,33 @@ +// https://github.com/rust-lang/rust/issues/7663 +//@ run-pass + +#![allow(unused_imports, dead_code)] + +mod test1 { + + mod foo { pub fn p() -> isize { 1 } } + mod bar { pub fn p() -> isize { 2 } } + + pub mod baz { + use crate::test1::bar::p; + + pub fn my_main() { assert_eq!(p(), 2); } + } +} + +mod test2 { + + mod foo { pub fn p() -> isize { 1 } } + mod bar { pub fn p() -> isize { 2 } } + + pub mod baz { + use crate::test2::bar::p; + + pub fn my_main() { assert_eq!(p(), 2); } + } +} + +fn main() { + test1::baz::my_main(); + test2::baz::my_main(); +} diff --git a/tests/ui/resolve/path-attr-in-const-block.rs b/tests/ui/resolve/path-attr-in-const-block.rs index 69be65bda3f..0ca356b1ddf 100644 --- a/tests/ui/resolve/path-attr-in-const-block.rs +++ b/tests/ui/resolve/path-attr-in-const-block.rs @@ -5,6 +5,6 @@ fn main() { const { #![path = foo!()] //~^ ERROR: cannot find macro `foo` in this scope - //~| ERROR malformed `path` attribute input + //~| ERROR: attribute value must be a literal } } diff --git a/tests/ui/resolve/path-attr-in-const-block.stderr b/tests/ui/resolve/path-attr-in-const-block.stderr index 23f4e319c6d..19d2745577b 100644 --- a/tests/ui/resolve/path-attr-in-const-block.stderr +++ b/tests/ui/resolve/path-attr-in-const-block.stderr @@ -4,17 +4,11 @@ error: cannot find macro `foo` in this scope LL | #![path = foo!()] | ^^^ -error[E0539]: malformed `path` attribute input - --> $DIR/path-attr-in-const-block.rs:6:9 +error: attribute value must be a literal + --> $DIR/path-attr-in-const-block.rs:6:19 | LL | #![path = foo!()] - | ^^^^^^^^^^------^ - | | | - | | expected a string literal here - | help: must be of the form: `#![path = "file"]` - | - = note: for more information, visit <https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute> + | ^^^^^^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0539`. |
