diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-04-07 17:28:31 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-04-12 23:06:03 +0300 |
| commit | d3f8b8be6fd5986af33f26768394cea386b686b5 (patch) | |
| tree | ca598dd9f85ca094ea3ce4d4be8dc407aa90dcb9 | |
| parent | 4f69b7fb850cae83ea3d5adfeb8520418c976403 (diff) | |
| download | rust-d3f8b8be6fd5986af33f26768394cea386b686b5.tar.gz rust-d3f8b8be6fd5986af33f26768394cea386b686b5.zip | |
Move hygiene tests to UI
| -rw-r--r-- | src/test/ui/hygiene/assoc_item_ctxt.rs (renamed from src/test/compile-fail/hygiene/assoc_item_ctxt.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/assoc_item_ctxt.stderr | 25 | ||||
| -rw-r--r-- | src/test/ui/hygiene/assoc_ty_bindings.rs (renamed from src/test/compile-fail/hygiene/assoc_ty_bindings.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/assoc_ty_bindings.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/hygiene/auxiliary/intercrate.rs (renamed from src/test/compile-fail/hygiene/auxiliary/intercrate.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/fields.rs (renamed from src/test/compile-fail/hygiene/fields.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/fields.stderr | 38 | ||||
| -rw-r--r-- | src/test/ui/hygiene/for-loop.rs (renamed from src/test/compile-fail/for-loop-hygiene.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/for-loop.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/hygiene/globs.rs (renamed from src/test/compile-fail/hygiene/globs.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/globs.stderr | 49 | ||||
| -rw-r--r-- | src/test/ui/hygiene/impl_items.rs (renamed from src/test/compile-fail/hygiene/impl_items.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/impl_items.stderr | 11 | ||||
| -rw-r--r-- | src/test/ui/hygiene/intercrate.rs (renamed from src/test/compile-fail/hygiene/intercrate.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/intercrate.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/hygiene/nested_macro_privacy.rs (renamed from src/test/compile-fail/hygiene/nested_macro_privacy.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/nested_macro_privacy.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/hygiene/no_implicit_prelude.rs (renamed from src/test/compile-fail/hygiene/no_implicit_prelude.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/no_implicit_prelude.stderr | 30 | ||||
| -rw-r--r-- | src/test/ui/hygiene/pattern-macro.rs (renamed from src/test/compile-fail/pattern-macro-hygiene.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/pattern-macro.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/hygiene/privacy.rs (renamed from src/test/compile-fail/hygiene/privacy.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/privacy.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/hygiene/trait_items.rs (renamed from src/test/compile-fail/hygiene/trait_items.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/hygiene/trait_items.stderr | 16 |
25 files changed, 223 insertions, 0 deletions
diff --git a/src/test/compile-fail/hygiene/assoc_item_ctxt.rs b/src/test/ui/hygiene/assoc_item_ctxt.rs index e336b0df13f..e336b0df13f 100644 --- a/src/test/compile-fail/hygiene/assoc_item_ctxt.rs +++ b/src/test/ui/hygiene/assoc_item_ctxt.rs diff --git a/src/test/ui/hygiene/assoc_item_ctxt.stderr b/src/test/ui/hygiene/assoc_item_ctxt.stderr new file mode 100644 index 00000000000..8b410405ae5 --- /dev/null +++ b/src/test/ui/hygiene/assoc_item_ctxt.stderr @@ -0,0 +1,25 @@ +error[E0407]: method `method` is not a member of trait `Tr` + --> $DIR/assoc_item_ctxt.rs:45:13 + | +LL | fn method() {} //~ ERROR method `method` is not a member of trait `Tr` + | ^^^^^^^^^^^^^^ not a member of trait `Tr` +... +LL | mac_trait_impl!(); + | ------------------ in this macro invocation + +error[E0046]: not all trait items implemented, missing: `method` + --> $DIR/assoc_item_ctxt.rs:44:9 + | +LL | fn method(); + | ------------ `method` from trait +... +LL | impl Tr for u8 { //~ ERROR not all trait items implemented, missing: `method` + | ^^^^^^^^^^^^^^ missing `method` in implementation +... +LL | mac_trait_impl!(); + | ------------------ in this macro invocation + +error: aborting due to 2 previous errors + +Some errors occurred: E0046, E0407. +For more information about an error, try `rustc --explain E0046`. diff --git a/src/test/compile-fail/hygiene/assoc_ty_bindings.rs b/src/test/ui/hygiene/assoc_ty_bindings.rs index 46a138749ff..46a138749ff 100644 --- a/src/test/compile-fail/hygiene/assoc_ty_bindings.rs +++ b/src/test/ui/hygiene/assoc_ty_bindings.rs diff --git a/src/test/ui/hygiene/assoc_ty_bindings.stderr b/src/test/ui/hygiene/assoc_ty_bindings.stderr new file mode 100644 index 00000000000..0adf80994f7 --- /dev/null +++ b/src/test/ui/hygiene/assoc_ty_bindings.stderr @@ -0,0 +1,8 @@ +error: compilation successful + --> $DIR/assoc_ty_bindings.rs:49:1 + | +LL | fn main() {} //~ ERROR compilation successful + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/hygiene/auxiliary/intercrate.rs b/src/test/ui/hygiene/auxiliary/intercrate.rs index aa67e5c5f4d..aa67e5c5f4d 100644 --- a/src/test/compile-fail/hygiene/auxiliary/intercrate.rs +++ b/src/test/ui/hygiene/auxiliary/intercrate.rs diff --git a/src/test/compile-fail/hygiene/fields.rs b/src/test/ui/hygiene/fields.rs index 64217770b13..64217770b13 100644 --- a/src/test/compile-fail/hygiene/fields.rs +++ b/src/test/ui/hygiene/fields.rs diff --git a/src/test/ui/hygiene/fields.stderr b/src/test/ui/hygiene/fields.stderr new file mode 100644 index 00000000000..c4be1834c04 --- /dev/null +++ b/src/test/ui/hygiene/fields.stderr @@ -0,0 +1,38 @@ +error: type `foo::S` is private + --> $DIR/fields.rs:25:17 + | +LL | let s = S { x: 0 }; //~ ERROR type `foo::S` is private + | ^^^^^^^^^^ +... +LL | let s = foo::m!(S, x); + | ------------- in this macro invocation + +error: type `foo::S` is private + --> $DIR/fields.rs:26:17 + | +LL | let _ = s.x; //~ ERROR type `foo::S` is private + | ^ +... +LL | let s = foo::m!(S, x); + | ------------- in this macro invocation + +error: type `foo::T` is private + --> $DIR/fields.rs:28:17 + | +LL | let t = T(0); //~ ERROR type `foo::T` is private + | ^^^^ +... +LL | let s = foo::m!(S, x); + | ------------- in this macro invocation + +error: type `foo::T` is private + --> $DIR/fields.rs:29:17 + | +LL | let _ = t.0; //~ ERROR type `foo::T` is private + | ^ +... +LL | let s = foo::m!(S, x); + | ------------- in this macro invocation + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/for-loop-hygiene.rs b/src/test/ui/hygiene/for-loop.rs index d9386421970..d9386421970 100644 --- a/src/test/compile-fail/for-loop-hygiene.rs +++ b/src/test/ui/hygiene/for-loop.rs diff --git a/src/test/ui/hygiene/for-loop.stderr b/src/test/ui/hygiene/for-loop.stderr new file mode 100644 index 00000000000..7e606b2358c --- /dev/null +++ b/src/test/ui/hygiene/for-loop.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `iter` in this scope + --> $DIR/for-loop.rs:16:9 + | +LL | iter.next(); //~ ERROR cannot find value `iter` in this scope + | ^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/compile-fail/hygiene/globs.rs b/src/test/ui/hygiene/globs.rs index 7ba217061c6..7ba217061c6 100644 --- a/src/test/compile-fail/hygiene/globs.rs +++ b/src/test/ui/hygiene/globs.rs diff --git a/src/test/ui/hygiene/globs.stderr b/src/test/ui/hygiene/globs.stderr new file mode 100644 index 00000000000..d77242e135d --- /dev/null +++ b/src/test/ui/hygiene/globs.stderr @@ -0,0 +1,49 @@ +error[E0425]: cannot find function `f` in this scope + --> $DIR/globs.rs:32:9 + | +LL | f(); //~ ERROR cannot find function `f` in this scope + | ^ not found in this scope +help: possible candidates are found in other modules, you can import them into scope + | +LL | use foo::f; + | +LL | use foo::f; + | +LL | use foo::f; + | + +error[E0425]: cannot find function `g` in this scope + --> $DIR/globs.rs:25:5 + | +LL | g(); //~ ERROR cannot find function `g` in this scope + | ^ not found in this scope +... +LL | / m! { +LL | | use bar::*; +LL | | g(); +LL | | f(); //~ ERROR cannot find function `f` in this scope +LL | | } + | |_____- in this macro invocation +help: possible candidates are found in other modules, you can import them into scope + | +LL | use bar::g; + | +LL | use foo::test2::test::g; + | +LL | use foo::test::g; + | +LL | use foo::test::g; + | + +error[E0425]: cannot find function `f` in this scope + --> $DIR/globs.rs:64:17 + | +LL | n!(f); + | ------ in this macro invocation +... +LL | f //~ ERROR cannot find function `f` in this scope + | ^ not found in this scope + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/compile-fail/hygiene/impl_items.rs b/src/test/ui/hygiene/impl_items.rs index cdba559445d..cdba559445d 100644 --- a/src/test/compile-fail/hygiene/impl_items.rs +++ b/src/test/ui/hygiene/impl_items.rs diff --git a/src/test/ui/hygiene/impl_items.stderr b/src/test/ui/hygiene/impl_items.stderr new file mode 100644 index 00000000000..dbcf53554cf --- /dev/null +++ b/src/test/ui/hygiene/impl_items.stderr @@ -0,0 +1,11 @@ +error: type `for<'r> fn(&'r foo::S) {foo::S::f}` is private + --> $DIR/impl_items.rs:22:23 + | +LL | let _: () = S.f(); //~ ERROR type `for<'r> fn(&'r foo::S) {foo::S::f}` is private + | ^ +... +LL | foo::m!(); + | ---------- in this macro invocation + +error: aborting due to previous error + diff --git a/src/test/compile-fail/hygiene/intercrate.rs b/src/test/ui/hygiene/intercrate.rs index 50fc985ba34..50fc985ba34 100644 --- a/src/test/compile-fail/hygiene/intercrate.rs +++ b/src/test/ui/hygiene/intercrate.rs diff --git a/src/test/ui/hygiene/intercrate.stderr b/src/test/ui/hygiene/intercrate.stderr new file mode 100644 index 00000000000..ecbc6e7b147 --- /dev/null +++ b/src/test/ui/hygiene/intercrate.stderr @@ -0,0 +1,10 @@ +error: type `fn() -> u32 {intercrate::foo::bar::f}` is private + --> $DIR/intercrate.rs:22:16 + | +LL | assert_eq!(intercrate::foo::m!(), 1); + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/compile-fail/hygiene/nested_macro_privacy.rs b/src/test/ui/hygiene/nested_macro_privacy.rs index 6612359649c..6612359649c 100644 --- a/src/test/compile-fail/hygiene/nested_macro_privacy.rs +++ b/src/test/ui/hygiene/nested_macro_privacy.rs diff --git a/src/test/ui/hygiene/nested_macro_privacy.stderr b/src/test/ui/hygiene/nested_macro_privacy.stderr new file mode 100644 index 00000000000..1179065b94c --- /dev/null +++ b/src/test/ui/hygiene/nested_macro_privacy.stderr @@ -0,0 +1,9 @@ +error[E0616]: field `i` of struct `foo::S` is private + --> $DIR/nested_macro_privacy.rs:25:5 + | +LL | S::default().i; //~ ERROR field `i` of struct `foo::S` is private + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0616`. diff --git a/src/test/compile-fail/hygiene/no_implicit_prelude.rs b/src/test/ui/hygiene/no_implicit_prelude.rs index c90c7b3093c..c90c7b3093c 100644 --- a/src/test/compile-fail/hygiene/no_implicit_prelude.rs +++ b/src/test/ui/hygiene/no_implicit_prelude.rs diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr new file mode 100644 index 00000000000..5753d1a32f7 --- /dev/null +++ b/src/test/ui/hygiene/no_implicit_prelude.stderr @@ -0,0 +1,30 @@ +error[E0433]: failed to resolve. Use of undeclared type or module `Vec` + --> $DIR/no_implicit_prelude.rs:21:9 + | +LL | fn f() { ::bar::m!(); } + | ------------ in this macro invocation +... +LL | Vec::new(); //~ ERROR failed to resolve + | ^^^ Use of undeclared type or module `Vec` + +error[E0601]: `main` function not found in crate `no_implicit_prelude` + | + = note: consider adding a `main` function to `$DIR/no_implicit_prelude.rs` + +error[E0599]: no method named `clone` found for type `()` in the current scope + --> $DIR/no_implicit_prelude.rs:22:12 + | +LL | fn f() { ::bar::m!(); } + | ------------ in this macro invocation +... +LL | ().clone() //~ ERROR no method named `clone` found + | ^^^^^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + candidate #1: `use std::clone::Clone;` + +error: aborting due to 3 previous errors + +Some errors occurred: E0433, E0599, E0601. +For more information about an error, try `rustc --explain E0433`. diff --git a/src/test/compile-fail/pattern-macro-hygiene.rs b/src/test/ui/hygiene/pattern-macro.rs index 26d411c9154..26d411c9154 100644 --- a/src/test/compile-fail/pattern-macro-hygiene.rs +++ b/src/test/ui/hygiene/pattern-macro.rs diff --git a/src/test/ui/hygiene/pattern-macro.stderr b/src/test/ui/hygiene/pattern-macro.stderr new file mode 100644 index 00000000000..b26084db02e --- /dev/null +++ b/src/test/ui/hygiene/pattern-macro.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `x` in this scope + --> $DIR/pattern-macro.rs:15:5 + | +LL | x + 1; //~ ERROR cannot find value `x` in this scope + | ^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/compile-fail/hygiene/privacy.rs b/src/test/ui/hygiene/privacy.rs index 987cad187d4..987cad187d4 100644 --- a/src/test/compile-fail/hygiene/privacy.rs +++ b/src/test/ui/hygiene/privacy.rs diff --git a/src/test/ui/hygiene/privacy.stderr b/src/test/ui/hygiene/privacy.stderr new file mode 100644 index 00000000000..808d244e9cd --- /dev/null +++ b/src/test/ui/hygiene/privacy.stderr @@ -0,0 +1,9 @@ +error[E0603]: function `f` is private + --> $DIR/privacy.rs:26:9 + | +LL | foo::f() //~ ERROR `f` is private + | ^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0603`. diff --git a/src/test/compile-fail/hygiene/trait_items.rs b/src/test/ui/hygiene/trait_items.rs index 3bd19cbc0ac..3bd19cbc0ac 100644 --- a/src/test/compile-fail/hygiene/trait_items.rs +++ b/src/test/ui/hygiene/trait_items.rs diff --git a/src/test/ui/hygiene/trait_items.stderr b/src/test/ui/hygiene/trait_items.stderr new file mode 100644 index 00000000000..56d9c585d6f --- /dev/null +++ b/src/test/ui/hygiene/trait_items.stderr @@ -0,0 +1,16 @@ +error[E0599]: no method named `f` found for type `()` in the current scope + --> $DIR/trait_items.rs:27:24 + | +LL | fn f() { ::baz::m!(); } + | ------------ in this macro invocation +... +LL | pub macro m() { ().f() } //~ ERROR no method named `f` found for type `()` in the current scope + | ^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + candidate #1: `use foo::T;` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. |
