diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2016-12-27 17:02:52 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2016-12-27 17:02:52 -0800 |
| commit | e766c465d2e4c4e3c106bfa8343cbe6f9192d445 (patch) | |
| tree | 821a7cf1e0b04ac9c0cddede6eb760bbf2d0ce62 /src/test/compile-fail | |
| parent | 96c52d4fd86aed6320732a511c04bcbfff7d117f (diff) | |
| parent | 314c28b729ae359b99586cc62c486c28e0d44424 (diff) | |
| download | rust-e766c465d2e4c4e3c106bfa8343cbe6f9192d445.tar.gz rust-e766c465d2e4c4e3c106bfa8343cbe6f9192d445.zip | |
Merge branch 'master' into escape-reason-docs
Diffstat (limited to 'src/test/compile-fail')
121 files changed, 368 insertions, 1255 deletions
diff --git a/src/test/compile-fail/E0033.rs b/src/test/compile-fail/E0033.rs index 44f73e10e25..03d47472093 100644 --- a/src/test/compile-fail/E0033.rs +++ b/src/test/compile-fail/E0033.rs @@ -14,8 +14,8 @@ trait SomeTrait { fn main() { let trait_obj: &SomeTrait = SomeTrait; - //~^ ERROR E0425 - //~| NOTE unresolved name + //~^ ERROR expected value, found trait `SomeTrait` + //~| NOTE not a value //~| ERROR E0038 //~| method `foo` has no receiver //~| NOTE the trait `SomeTrait` cannot be made into an object diff --git a/src/test/compile-fail/E0259.rs b/src/test/compile-fail/E0259.rs index 95be48b5ff1..b2129902ef9 100644 --- a/src/test/compile-fail/E0259.rs +++ b/src/test/compile-fail/E0259.rs @@ -15,6 +15,6 @@ extern crate collections; extern crate libc as collections; //~^ ERROR E0259 -//~| NOTE `collections` was already imported +//~| NOTE `collections` already imported fn main() {} diff --git a/src/test/compile-fail/E0277-2.rs b/src/test/compile-fail/E0277-2.rs new file mode 100644 index 00000000000..211c0e6f890 --- /dev/null +++ b/src/test/compile-fail/E0277-2.rs @@ -0,0 +1,34 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo { + bar: Bar +} + +struct Bar { + baz: Baz +} + +struct Baz { + x: *const u8 +} + +fn is_send<T: Send>() { } + +fn main() { + is_send::<Foo>(); + //~^ ERROR the trait bound `*const u8: std::marker::Send` is not satisfied in `Foo` + //~| NOTE within `Foo`, the trait `std::marker::Send` is not implemented for `*const u8` + //~| NOTE: `*const u8` cannot be sent between threads safely + //~| NOTE: required because it appears within the type `Baz` + //~| NOTE: required because it appears within the type `Bar` + //~| NOTE: required because it appears within the type `Foo` + //~| NOTE: required by `is_send` +} diff --git a/src/test/compile-fail/E0277.rs b/src/test/compile-fail/E0277.rs index e4cb50cd3f2..e31fea1e458 100644 --- a/src/test/compile-fail/E0277.rs +++ b/src/test/compile-fail/E0277.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::path::Path; + trait Foo { fn bar(&self); } @@ -16,6 +18,13 @@ fn some_func<T: Foo>(foo: T) { foo.bar(); } +fn f(p: Path) { } +//~^ ERROR the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path` +//~| NOTE within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]` +//~| NOTE `[u8]` does not have a constant size known at compile-time +//~| NOTE required because it appears within the type `std::path::Path` +//~| NOTE all local variables must have a statically known size + fn main() { some_func(5i32); //~^ ERROR the trait bound `i32: Foo` is not satisfied diff --git a/src/test/compile-fail/E0423.rs b/src/test/compile-fail/E0423.rs index 98b700984a7..f5fea77cf96 100644 --- a/src/test/compile-fail/E0423.rs +++ b/src/test/compile-fail/E0423.rs @@ -12,5 +12,4 @@ fn main () { struct Foo { a: bool }; let f = Foo(); //~ ERROR E0423 - //~^ struct called like a function } diff --git a/src/test/compile-fail/E0424.rs b/src/test/compile-fail/E0424.rs index 911007113d3..445d0c5f3ed 100644 --- a/src/test/compile-fail/E0424.rs +++ b/src/test/compile-fail/E0424.rs @@ -14,10 +14,7 @@ impl Foo { fn bar(self) {} fn foo() { - self.bar(); - //~^ ERROR `self` is not available in a static method [E0424] - //~| NOTE not available in static method - //~| NOTE maybe a `self` argument is missing? + self.bar(); //~ ERROR E0424 } } diff --git a/src/test/compile-fail/E0425.rs b/src/test/compile-fail/E0425.rs index 70f4b1107ad..3786282031f 100644 --- a/src/test/compile-fail/E0425.rs +++ b/src/test/compile-fail/E0425.rs @@ -10,7 +10,7 @@ trait Foo { fn bar() { - Self; //~ ERROR E0425 + elf; //~ ERROR E0425 } } diff --git a/src/test/compile-fail/associated-path-shl.rs b/src/test/compile-fail/associated-path-shl.rs index 6bc110239cd..0295d4248e5 100644 --- a/src/test/compile-fail/associated-path-shl.rs +++ b/src/test/compile-fail/associated-path-shl.rs @@ -11,10 +11,10 @@ // Check that associated paths starting with `<<` are successfully parsed. fn main() { - let _: <<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope - let _ = <<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope - let <<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope - let 0 ... <<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope + let _: <<A>::B>::C; //~ ERROR unresolved type `A` + let _ = <<A>::B>::C; //~ ERROR unresolved type `A` + let <<A>::B>::C; //~ ERROR unresolved type `A` + let 0 ... <<A>::B>::C; //~ ERROR unresolved type `A` //~^ ERROR only char and numeric types are allowed in range patterns - <<A>::B>::C; //~ ERROR type name `A` is undefined or not in scope + <<A>::B>::C; //~ ERROR unresolved type `A` } diff --git a/src/test/compile-fail/associated-types-eq-1.rs b/src/test/compile-fail/associated-types-eq-1.rs index 59d87146097..46d5633c8dd 100644 --- a/src/test/compile-fail/associated-types-eq-1.rs +++ b/src/test/compile-fail/associated-types-eq-1.rs @@ -17,7 +17,7 @@ pub trait Foo { } fn foo2<I: Foo>(x: I) { - let _: A = x.boo(); //~ERROR undefined or not in scope + let _: A = x.boo(); //~ ERROR unresolved type `A` } pub fn main() {} diff --git a/src/test/compile-fail/auxiliary/issue-21221-4.rs b/src/test/compile-fail/auxiliary/issue-21221-4.rs deleted file mode 100644 index fffe060ee24..00000000000 --- a/src/test/compile-fail/auxiliary/issue-21221-4.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// testing whether the lookup mechanism picks up types -// defined in the outside crate - -#![crate_type="lib"] - -mod foo { - // should not be suggested => foo is private - pub trait T {} -} - -// should be suggested -pub use foo::T; diff --git a/src/test/compile-fail/auxiliary/issue_3907.rs b/src/test/compile-fail/auxiliary/issue_3907.rs deleted file mode 100644 index 6472c08c222..00000000000 --- a/src/test/compile-fail/auxiliary/issue_3907.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait Foo { - fn bar(); -} diff --git a/src/test/compile-fail/auxiliary/lint_stability.rs b/src/test/compile-fail/auxiliary/lint_stability.rs index 1049bcd1564..5e3cb606ce0 100644 --- a/src/test/compile-fail/auxiliary/lint_stability.rs +++ b/src/test/compile-fail/auxiliary/lint_stability.rs @@ -132,6 +132,10 @@ pub struct UnstableStruct { pub struct StableStruct { #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize } +#[unstable(feature = "test_feature", issue = "0")] +pub enum UnstableEnum {} +#[stable(feature = "rust1", since = "1.0.0")] +pub enum StableEnum {} #[stable(feature = "test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] diff --git a/src/test/compile-fail/bad-expr-path.rs b/src/test/compile-fail/bad-expr-path.rs index c18a3183477..05400a0eb65 100644 --- a/src/test/compile-fail/bad-expr-path.rs +++ b/src/test/compile-fail/bad-expr-path.rs @@ -8,8 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: unresolved name `m1::arguments` - mod m1 {} -fn main(arguments: Vec<String>) { log(debug, m1::arguments); } +fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type + log(debug, m1::arguments); + //~^ ERROR unresolved function `log` + //~| ERROR unresolved value `debug` + //~| ERROR unresolved value `m1::arguments` +} diff --git a/src/test/compile-fail/bad-expr-path2.rs b/src/test/compile-fail/bad-expr-path2.rs index e1c1afb0049..867166134b2 100644 --- a/src/test/compile-fail/bad-expr-path2.rs +++ b/src/test/compile-fail/bad-expr-path2.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: unresolved name `m1::arguments` - mod m1 { pub mod arguments {} } -fn main(arguments: Vec<String>) { +fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type log(debug, m1::arguments); + //~^ ERROR unresolved function `log` + //~| ERROR unresolved value `debug` + //~| ERROR expected value, found module `m1::arguments` } diff --git a/src/test/compile-fail/blind-item-item-shadow.rs b/src/test/compile-fail/blind-item-item-shadow.rs index 853282ff014..e9df8868a1e 100644 --- a/src/test/compile-fail/blind-item-item-shadow.rs +++ b/src/test/compile-fail/blind-item-item-shadow.rs @@ -12,6 +12,6 @@ mod foo { pub mod foo { } } //~ NOTE previous definition of `foo` here use foo::foo; //~^ ERROR a module named `foo` has already been defined in this module -//~| was already imported +//~| `foo` already defined fn main() {} diff --git a/src/test/compile-fail/cast-rfc0401.rs b/src/test/compile-fail/cast-rfc0401.rs deleted file mode 100644 index b98f464c902..00000000000 --- a/src/test/compile-fail/cast-rfc0401.rs +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn illegal_cast<U:?Sized,V:?Sized>(u: *const U) -> *const V -{ - u as *const V - //~^ ERROR casting - //~^^ NOTE vtable kinds -} - -fn illegal_cast_2<U:?Sized>(u: *const U) -> *const str -{ - u as *const str - //~^ ERROR casting - //~^^ NOTE vtable kinds -} - -trait Foo { fn foo(&self) {} } -impl<T> Foo for T {} - -trait Bar { fn foo(&self) {} } -impl<T> Bar for T {} - -enum E { - A, B -} - -fn main() -{ - let f: f32 = 1.2; - let v = 0 as *const u8; - let fat_v : *const [u8] = unsafe { &*(0 as *const [u8; 1])}; - let fat_sv : *const [i8] = unsafe { &*(0 as *const [i8; 1])}; - let foo: &Foo = &f; - - let _ = v as &u8; //~ ERROR non-scalar - let _ = v as E; //~ ERROR non-scalar - let _ = v as fn(); //~ ERROR non-scalar - let _ = v as (u32,); //~ ERROR non-scalar - let _ = Some(&v) as *const u8; //~ ERROR non-scalar - - let _ = v as f32; - //~^ ERROR casting - let _ = main as f64; - //~^ ERROR casting - let _ = &v as usize; - //~^ ERROR casting - //~^^ HELP through a raw pointer first - let _ = f as *const u8; - //~^ ERROR casting - let _ = 3_i32 as bool; - //~^ ERROR cannot cast as `bool` [E0054] - //~| unsupported cast - //~| HELP compare with zero - let _ = E::A as bool; - //~^ ERROR cannot cast as `bool` [E0054] - //~| unsupported cast - //~| HELP compare with zero - let _ = 0x61u32 as char; //~ ERROR only `u8` can be cast - - let _ = false as f32; - //~^ ERROR casting - //~^^ HELP through an integer first - let _ = E::A as f32; - //~^ ERROR casting - //~^^ HELP through an integer first - let _ = 'a' as f32; - //~^ ERROR casting - //~^^ HELP through an integer first - - let _ = false as *const u8; - //~^ ERROR casting - let _ = E::A as *const u8; - //~^ ERROR casting - let _ = 'a' as *const u8; - //~^ ERROR casting - - let _ = 42usize as *const [u8]; //~ ERROR casting - let _ = v as *const [u8]; //~ ERROR cannot cast - let _ = fat_v as *const Foo; - //~^ ERROR the trait bound `[u8]: std::marker::Sized` is not satisfied - //~| NOTE the trait `std::marker::Sized` is not implemented for `[u8]` - //~| NOTE `[u8]` does not have a constant size known at compile-time - //~| NOTE required for the cast to the object type `Foo` - let _ = foo as *const str; //~ ERROR casting - let _ = foo as *mut str; //~ ERROR casting - let _ = main as *mut str; //~ ERROR casting - let _ = &f as *mut f32; //~ ERROR casting - let _ = &f as *const f64; //~ ERROR casting - let _ = fat_sv as usize; - //~^ ERROR casting - //~^^ HELP through a thin pointer first - - let a : *const str = "hello"; - let _ = a as *const Foo; - //~^ ERROR the trait bound `str: std::marker::Sized` is not satisfied - //~| NOTE the trait `std::marker::Sized` is not implemented for `str` - //~| NOTE `str` does not have a constant size known at compile-time - //~| NOTE required for the cast to the object type `Foo` - - // check no error cascade - let _ = main.f as *const u32; //~ no field `f` on type `fn() {main}` - - let cf: *const Foo = &0; - let _ = cf as *const [u16]; - //~^ ERROR casting - //~^^ NOTE vtable kinds - let _ = cf as *const Bar; - //~^ ERROR casting - //~^^ NOTE vtable kinds - - vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); - //~^ ERROR casting `&{float}` as `f32` is invalid - //~| NOTE cannot cast `&{float}` as `f32` - //~| NOTE did you mean `*s`? -} diff --git a/src/test/compile-fail/class-missing-self.rs b/src/test/compile-fail/class-missing-self.rs index ab76af1cbe6..cab46ec1fbf 100644 --- a/src/test/compile-fail/class-missing-self.rs +++ b/src/test/compile-fail/class-missing-self.rs @@ -16,8 +16,8 @@ impl cat { fn sleep(&self) { loop{} } fn meow(&self) { println!("Meow"); - meows += 1; //~ ERROR unresolved name - sleep(); //~ ERROR unresolved name + meows += 1; //~ ERROR unresolved value `meows` + sleep(); //~ ERROR unresolved function `sleep` } } diff --git a/src/test/compile-fail/coherence-error-suppression.rs b/src/test/compile-fail/coherence-error-suppression.rs index b33f27fbc8a..7c7782b9b44 100644 --- a/src/test/compile-fail/coherence-error-suppression.rs +++ b/src/test/compile-fail/coherence-error-suppression.rs @@ -16,7 +16,7 @@ impl Foo for i8 {} impl Foo for i16 {} impl Foo for i32 {} impl Foo for i64 {} -impl Foo for DoesNotExist {} //~ ERROR `DoesNotExist` is undefined +impl Foo for DoesNotExist {} //~ ERROR unresolved type `DoesNotExist` impl Foo for u8 {} impl Foo for u16 {} impl Foo for u32 {} diff --git a/src/test/compile-fail/derived-errors/issue-31997.rs b/src/test/compile-fail/derived-errors/issue-31997.rs index cf283f6d3e4..2a294a4e31f 100644 --- a/src/test/compile-fail/derived-errors/issue-31997.rs +++ b/src/test/compile-fail/derived-errors/issue-31997.rs @@ -20,7 +20,7 @@ fn closure<F, T>(x: F) -> Result<T, ()> } fn foo() -> Result<(), ()> { - try!(closure(|| bar(0 as *mut _))); //~ ERROR unresolved name `bar` + try!(closure(|| bar(0 as *mut _))); //~ ERROR unresolved function `bar` Ok(()) } diff --git a/src/test/compile-fail/does-nothing.rs b/src/test/compile-fail/does-nothing.rs index c0cd406f062..96e14d2fb22 100644 --- a/src/test/compile-fail/does-nothing.rs +++ b/src/test/compile-fail/does-nothing.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: unresolved name `this_does_nothing_what_the` fn main() { println!("doing"); this_does_nothing_what_the; println!("boing"); } +//~^ ERROR unresolved value `this_does_nothing_what_the` diff --git a/src/test/compile-fail/empty-struct-braces-expr.rs b/src/test/compile-fail/empty-struct-braces-expr.rs index 1c86af30c79..d4e85e9744d 100644 --- a/src/test/compile-fail/empty-struct-braces-expr.rs +++ b/src/test/compile-fail/empty-struct-braces-expr.rs @@ -22,13 +22,13 @@ enum E { } fn main() { - let e1 = Empty1; //~ ERROR `Empty1` is the name of a struct or struct variant - let e1 = Empty1(); //~ ERROR `Empty1` is the name of a struct or struct variant - let e3 = E::Empty3; //~ ERROR `E::Empty3` is the name of a struct or struct variant - let e3 = E::Empty3(); //~ ERROR `E::Empty3` is the name of a struct or struct variant + let e1 = Empty1; //~ ERROR expected value, found struct `Empty1` + let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1` + let e3 = E::Empty3; //~ ERROR expected value, found struct variant `E::Empty3` + let e3 = E::Empty3(); //~ ERROR expected function, found struct variant `E::Empty3` - let xe1 = XEmpty1; //~ ERROR `XEmpty1` is the name of a struct or struct variant - let xe1 = XEmpty1(); //~ ERROR `XEmpty1` is the name of a struct or struct variant + let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` + let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1` let xe3 = XE::Empty3; //~ ERROR no associated item named `Empty3` found for type let xe3 = XE::Empty3(); //~ ERROR no associated item named `Empty3` found for type } diff --git a/src/test/compile-fail/empty-struct-braces-pat-2.rs b/src/test/compile-fail/empty-struct-braces-pat-2.rs index 4349e72c5d7..d3b13457dc6 100644 --- a/src/test/compile-fail/empty-struct-braces-pat-2.rs +++ b/src/test/compile-fail/empty-struct-braces-pat-2.rs @@ -22,15 +22,15 @@ fn main() { let xe1 = XEmpty1 {}; match e1 { - Empty1() => () //~ ERROR unresolved tuple struct/variant `Empty1` + Empty1() => () //~ ERROR expected tuple struct/variant, found struct `Empty1` } match xe1 { - XEmpty1() => () //~ ERROR unresolved tuple struct/variant `XEmpty1` + XEmpty1() => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` } match e1 { - Empty1(..) => () //~ ERROR unresolved tuple struct/variant `Empty1` + Empty1(..) => () //~ ERROR expected tuple struct/variant, found struct `Empty1` } match xe1 { - XEmpty1(..) => () //~ ERROR unresolved tuple struct/variant `XEmpty1` + XEmpty1(..) => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` } } diff --git a/src/test/compile-fail/enum-variant-type-2.rs b/src/test/compile-fail/enum-variant-type-2.rs index eef4bea1df1..258bfd1e3ba 100644 --- a/src/test/compile-fail/enum-variant-type-2.rs +++ b/src/test/compile-fail/enum-variant-type-2.rs @@ -14,6 +14,6 @@ enum Foo { Bar } -fn foo(x: Foo::Bar) {} //~ERROR found value `Foo::Bar` used as a type +fn foo(x: Foo::Bar) {} //~ ERROR expected type, found variant `Foo::Bar` fn main() {} diff --git a/src/test/compile-fail/enums-are-namespaced-xc.rs b/src/test/compile-fail/enums-are-namespaced-xc.rs deleted file mode 100644 index 02939565f69..00000000000 --- a/src/test/compile-fail/enums-are-namespaced-xc.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:namespaced_enums.rs -extern crate namespaced_enums; - -fn main() { - let _ = namespaced_enums::A; //~ ERROR unresolved name - let _ = namespaced_enums::B(10); //~ ERROR unresolved name - let _ = namespaced_enums::C { a: 10 }; - //~^ ERROR unresolved struct, variant or union type `namespaced_enums::C` -} diff --git a/src/test/compile-fail/export-fully-qualified.rs b/src/test/compile-fail/export-fully-qualified.rs index 166ef7ab87f..19fa13f8377 100644 --- a/src/test/compile-fail/export-fully-qualified.rs +++ b/src/test/compile-fail/export-fully-qualified.rs @@ -8,14 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: failed to resolve. Use of undeclared type or module `foo` - // In this test baz isn't resolved when called as foo.baz even though // it's called from inside foo. This is somewhat surprising and may // want to change eventually. mod foo { - pub fn bar() { foo::baz(); } + pub fn bar() { foo::baz(); } //~ ERROR failed to resolve. Use of undeclared type or module `foo` fn baz() { } } diff --git a/src/test/compile-fail/export.rs b/src/test/compile-fail/export.rs index 3a391e7c609..a412cac699f 100644 --- a/src/test/compile-fail/export.rs +++ b/src/test/compile-fail/export.rs @@ -8,10 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: unresolved name mod foo { pub fn x(y: isize) { log(debug, y); } + //~^ ERROR unresolved function `log` + //~| ERROR unresolved value `debug` fn z(y: isize) { log(debug, y); } + //~^ ERROR unresolved function `log` + //~| ERROR unresolved value `debug` } -fn main() { foo::z(10); } +fn main() { foo::z(10); } //~ ERROR function `z` is private diff --git a/src/test/compile-fail/export2.rs b/src/test/compile-fail/export2.rs index f7b1400aa45..dc96ce7f504 100644 --- a/src/test/compile-fail/export2.rs +++ b/src/test/compile-fail/export2.rs @@ -8,10 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: failed to resolve. Use of undeclared type or module `bar` - mod foo { - pub fn x() { bar::x(); } + pub fn x() { bar::x(); } //~ ERROR failed to resolve. Use of undeclared type or module `bar` } mod bar { diff --git a/src/test/compile-fail/extern-with-type-bounds.rs b/src/test/compile-fail/extern-with-type-bounds.rs index d8bdd5974c7..0f8ad8d5388 100644 --- a/src/test/compile-fail/extern-with-type-bounds.rs +++ b/src/test/compile-fail/extern-with-type-bounds.rs @@ -24,7 +24,7 @@ extern "rust-intrinsic" { // Unresolved bounds should still error. fn align_of<T: NoSuchTrait>() -> usize; - //~^ ERROR trait `NoSuchTrait` is not in scope + //~^ ERROR unresolved trait `NoSuchTrait` } fn main() {} diff --git a/src/test/compile-fail/for-expn.rs b/src/test/compile-fail/for-expn.rs index 43776d75a47..a051789ec98 100644 --- a/src/test/compile-fail/for-expn.rs +++ b/src/test/compile-fail/for-expn.rs @@ -13,7 +13,7 @@ fn main() { // Odd formatting to make sure we get the right span. for t in & - foo //~ ERROR unresolved name `foo` + foo //~ ERROR unresolved value `foo` { } } diff --git a/src/test/compile-fail/for-loop-hygiene.rs b/src/test/compile-fail/for-loop-hygiene.rs index f06882875fd..2135ad6e73c 100644 --- a/src/test/compile-fail/for-loop-hygiene.rs +++ b/src/test/compile-fail/for-loop-hygiene.rs @@ -13,6 +13,6 @@ fn main() { for _ in 0..10 { - iter.next(); //~ error: unresolved name `iter` + iter.next(); //~ ERROR unresolved value `iter` } } diff --git a/src/test/compile-fail/glob-resolve1.rs b/src/test/compile-fail/glob-resolve1.rs index 1e5662aa172..58e67796586 100644 --- a/src/test/compile-fail/glob-resolve1.rs +++ b/src/test/compile-fail/glob-resolve1.rs @@ -29,13 +29,13 @@ mod bar { fn foo<T>() {} fn main() { - fpriv(); //~ ERROR: unresolved - epriv(); //~ ERROR: unresolved - B; //~ ERROR: unresolved - C; //~ ERROR: unresolved - import(); //~ ERROR: unresolved - - foo::<A>(); //~ ERROR: not in scope - foo::<C>(); //~ ERROR: not in scope - foo::<D>(); //~ ERROR: not in scope + fpriv(); //~ ERROR unresolved function `fpriv` + epriv(); //~ ERROR unresolved function `epriv` + B; //~ ERROR expected value, found enum `B` + C; //~ ERROR unresolved value `C` + import(); //~ ERROR: unresolved function `import` + + foo::<A>(); //~ ERROR: unresolved type `A` + foo::<C>(); //~ ERROR: unresolved type `C` + foo::<D>(); //~ ERROR: unresolved type `D` } diff --git a/src/test/compile-fail/import-glob-0.rs b/src/test/compile-fail/import-glob-0.rs index 21aa811ea71..12e45cfa2cb 100644 --- a/src/test/compile-fail/import-glob-0.rs +++ b/src/test/compile-fail/import-glob-0.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: unresolved name - use module_of_many_things::*; mod module_of_many_things { @@ -23,6 +21,6 @@ mod module_of_many_things { fn main() { f1(); f2(); - f999(); // 'export' currently doesn't work? + f999(); //~ ERROR unresolved function `f999` f4(); } diff --git a/src/test/compile-fail/auxiliary/issue-21221-3.rs b/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs index fae0fe16a26..bed10c87ae1 100644 --- a/src/test/compile-fail/auxiliary/issue-21221-3.rs +++ b/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs @@ -8,22 +8,23 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// testing whether the lookup mechanism picks up types -// defined in the outside crate +#![feature(rustc_attrs)] +#![allow(unused)] -#![crate_type="lib"] +pub struct Foo; -pub mod outer { - // should suggest this - pub trait OuterTrait {} +mod bar { + struct Foo; - // should not suggest this since the module is private - mod private_module { - pub trait OuterTrait {} - } - - // should not suggest since the trait is private - pub mod public_module { - trait OuterTrait {} + mod baz { + use *; //~ NOTE `Foo` could resolve to the name imported here + use bar::*; //~ NOTE `Foo` could also resolve to the name imported here + fn f(_: Foo) {} + //~^ WARN `Foo` is ambiguous + //~| WARN hard error in a future release + //~| NOTE see issue #38260 } } + +#[rustc_error] +fn main() {} //~ ERROR compilation successful diff --git a/src/test/compile-fail/issue-14254.rs b/src/test/compile-fail/issue-14254.rs deleted file mode 100644 index c7bd343bc9a..00000000000 --- a/src/test/compile-fail/issue-14254.rs +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait Foo { - fn bar(&self); - fn baz(&self) { } - fn bah(_: Option<&Self>) { } -} - -struct BarTy { - x : isize, - y : f64, -} - -impl BarTy { - fn a() {} - fn b(&self) {} -} - -impl Foo for *const BarTy { - fn bar(&self) { - baz(); - //~^ ERROR: unresolved name `baz` - //~| NOTE did you mean to call `self.baz`? - a; - //~^ ERROR: unresolved name `a` - //~| NOTE unresolved name - } -} - -impl<'a> Foo for &'a BarTy { - fn bar(&self) { - baz(); - //~^ ERROR: unresolved name `baz` - //~| NOTE did you mean to call `self.baz`? - x; - //~^ ERROR: unresolved name `x` - //~| NOTE did you mean `self.x`? - y; - //~^ ERROR: unresolved name `y` - //~| NOTE did you mean `self.y`? - a; - //~^ ERROR: unresolved name `a` - //~| NOTE unresolved name - bah; - //~^ ERROR: unresolved name `bah` - //~| NOTE did you mean to call `Foo::bah`? - b; - //~^ ERROR: unresolved name `b` - //~| NOTE unresolved name - } -} - -impl<'a> Foo for &'a mut BarTy { - fn bar(&self) { - baz(); - //~^ ERROR: unresolved name `baz` - //~| NOTE did you mean to call `self.baz`? - x; - //~^ ERROR: unresolved name `x` - //~| NOTE did you mean `self.x`? - y; - //~^ ERROR: unresolved name `y` - //~| NOTE did you mean `self.y`? - a; - //~^ ERROR: unresolved name `a` - //~| NOTE unresolved name - bah; - //~^ ERROR: unresolved name `bah` - //~| NOTE did you mean to call `Foo::bah`? - b; - //~^ ERROR: unresolved name `b` - //~| NOTE unresolved name - } -} - -impl Foo for Box<BarTy> { - fn bar(&self) { - baz(); - //~^ ERROR: unresolved name `baz` - //~| NOTE did you mean to call `self.baz`? - bah; - //~^ ERROR: unresolved name `bah` - //~| NOTE did you mean to call `Foo::bah`? - } -} - -impl Foo for *const isize { - fn bar(&self) { - baz(); - //~^ ERROR: unresolved name `baz` - //~| NOTE did you mean to call `self.baz`? - bah; - //~^ ERROR: unresolved name `bah` - //~| NOTE did you mean to call `Foo::bah`? - } -} - -impl<'a> Foo for &'a isize { - fn bar(&self) { - baz(); - //~^ ERROR: unresolved name `baz` - //~| NOTE did you mean to call `self.baz`? - bah; - //~^ ERROR: unresolved name `bah` - //~| NOTE did you mean to call `Foo::bah`? - } -} - -impl<'a> Foo for &'a mut isize { - fn bar(&self) { - baz(); - //~^ ERROR: unresolved name `baz` - //~| NOTE did you mean to call `self.baz`? - bah; - //~^ ERROR: unresolved name `bah` - //~| NOTE did you mean to call `Foo::bah`? - } -} - -impl Foo for Box<isize> { - fn bar(&self) { - baz(); - //~^ ERROR: unresolved name `baz` - //~| NOTE did you mean to call `self.baz`? - bah; - //~^ ERROR: unresolved name `bah` - //~| NOTE did you mean to call `Foo::bah`? - } -} diff --git a/src/test/compile-fail/issue-1476.rs b/src/test/compile-fail/issue-1476.rs index 73a0e0c0775..b7797cf5b36 100644 --- a/src/test/compile-fail/issue-1476.rs +++ b/src/test/compile-fail/issue-1476.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - println!("{}", x); //~ ERROR unresolved name `x` + println!("{}", x); //~ ERROR unresolved value `x` } diff --git a/src/test/compile-fail/issue-15167.rs b/src/test/compile-fail/issue-15167.rs index 2bd7da91d2c..4e77636b379 100644 --- a/src/test/compile-fail/issue-15167.rs +++ b/src/test/compile-fail/issue-15167.rs @@ -11,10 +11,10 @@ // macro f should not be able to inject a reference to 'n'. macro_rules! f { () => (n) } -//~^ ERROR unresolved name `n` -//~| ERROR unresolved name `n` -//~| ERROR unresolved name `n` -//~| ERROR unresolved name `n` +//~^ ERROR unresolved value `n` +//~| ERROR unresolved value `n` +//~| ERROR unresolved value `n` +//~| ERROR unresolved value `n` fn main() -> (){ for n in 0..1 { diff --git a/src/test/compile-fail/issue-16058.rs b/src/test/compile-fail/issue-16058.rs deleted file mode 100644 index 92c1e4b5f50..00000000000 --- a/src/test/compile-fail/issue-16058.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub struct GslResult { - pub val: f64, - pub err: f64 -} - -impl GslResult { - pub fn new() -> GslResult { - Result { //~ ERROR: expected struct, variant or union type, found enum `Result` - val: 0f64, - err: 0f64 - } - } -} - -fn main() {} diff --git a/src/test/compile-fail/issue-17518.rs b/src/test/compile-fail/issue-17518.rs deleted file mode 100644 index 2113e38c45c..00000000000 --- a/src/test/compile-fail/issue-17518.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum SomeEnum { - E -} - -fn main() { - E { name: "foobar" }; //~ ERROR unresolved struct, variant or union type `E` -} diff --git a/src/test/compile-fail/issue-17546.rs b/src/test/compile-fail/issue-17546.rs index e640ba3f00f..fe125b973d9 100644 --- a/src/test/compile-fail/issue-17546.rs +++ b/src/test/compile-fail/issue-17546.rs @@ -20,7 +20,7 @@ mod foo { } fn new() -> NoResult<MyEnum, String> { - //~^ ERROR: found value `foo::MyEnum::NoResult` used as a type + //~^ ERROR expected type, found variant `NoResult` unimplemented!() } } @@ -30,18 +30,18 @@ mod bar { use foo; fn new() -> Result<foo::MyEnum, String> { - //~^ ERROR: found value `foo::MyEnum::Result` used as a type + //~^ ERROR expected type, found variant `Result` unimplemented!() } } fn new() -> Result<foo::MyEnum, String> { - //~^ ERROR: found value `foo::MyEnum::Result` used as a type + //~^ ERROR expected type, found variant `Result` unimplemented!() } fn newer() -> NoResult<foo::MyEnum, String> { - //~^ ERROR: found value `foo::MyEnum::NoResult` used as a type + //~^ ERROR expected type, found variant `NoResult` unimplemented!() } diff --git a/src/test/compile-fail/issue-18058.rs b/src/test/compile-fail/issue-18058.rs index 0447cf781ff..1611cc418fb 100644 --- a/src/test/compile-fail/issue-18058.rs +++ b/src/test/compile-fail/issue-18058.rs @@ -9,6 +9,6 @@ // except according to those terms. impl Undefined {} -//~^ ERROR type name `Undefined` is undefined or not in scope +//~^ ERROR unresolved type `Undefined` fn main() {} diff --git a/src/test/compile-fail/issue-18119.rs b/src/test/compile-fail/issue-18119.rs index f06496463e4..412f7566f47 100644 --- a/src/test/compile-fail/issue-18119.rs +++ b/src/test/compile-fail/issue-18119.rs @@ -13,10 +13,10 @@ static Y: u8 = 1; fn foo() {} impl X {} -//~^ ERROR type name `X` is undefined or not in scope +//~^ ERROR expected type, found constant `X` impl Y {} -//~^ ERROR type name `Y` is undefined or not in scope +//~^ ERROR expected type, found static `Y` impl foo {} -//~^ ERROR type name `foo` is undefined or not in scope +//~^ ERROR expected type, found function `foo` fn main() {} diff --git a/src/test/compile-fail/issue-18252.rs b/src/test/compile-fail/issue-18252.rs deleted file mode 100644 index 8e3faca02b7..00000000000 --- a/src/test/compile-fail/issue-18252.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum Foo { - Variant { x: usize } -} - -fn main() { - let f = Foo::Variant(42); - //~^ ERROR uses it like a function - //~| struct called like a function -} diff --git a/src/test/compile-fail/issue-19452.rs b/src/test/compile-fail/issue-19452.rs deleted file mode 100644 index 34872b7c8c5..00000000000 --- a/src/test/compile-fail/issue-19452.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue_19452_aux.rs -extern crate issue_19452_aux; - -enum Homura { - Madoka { age: u32 } -} - -fn main() { - let homura = Homura::Madoka; - //~^ ERROR uses it like a function - //~| struct called like a function - - let homura = issue_19452_aux::Homura::Madoka; - //~^ ERROR uses it like a function - //~| struct called like a function -} diff --git a/src/test/compile-fail/issue-19498.rs b/src/test/compile-fail/issue-19498.rs index 2e2115b7110..88e804fb8aa 100644 --- a/src/test/compile-fail/issue-19498.rs +++ b/src/test/compile-fail/issue-19498.rs @@ -11,13 +11,13 @@ use self::A; //~ NOTE previous import of `A` here use self::B; //~ NOTE previous import of `B` here mod A {} //~ ERROR a module named `A` has already been imported in this module -//~| `A` was already imported +//~| `A` already imported pub mod B {} //~ ERROR a module named `B` has already been imported in this module -//~| `B` was already imported +//~| `B` already imported mod C { use C::D; //~ NOTE previous import of `D` here mod D {} //~ ERROR a module named `D` has already been imported in this module - //~| `D` was already imported + //~| `D` already imported } fn main() {} diff --git a/src/test/compile-fail/issue-19883.rs b/src/test/compile-fail/issue-19883.rs index 3a7a1692f38..6fc5fa03c58 100644 --- a/src/test/compile-fail/issue-19883.rs +++ b/src/test/compile-fail/issue-19883.rs @@ -17,7 +17,7 @@ trait From<Src> { trait To: Sized { fn to<Dst: From<Self>>(self) -> <Dst as From<Self>>::Dst - //~^ ERROR associated type `From::Dst` is undefined or not in scope + //~^ ERROR unresolved associated type `From::Dst` { From::from(self) } diff --git a/src/test/compile-fail/issue-21221-1.rs b/src/test/compile-fail/issue-21221-1.rs deleted file mode 100644 index 2bc9ec3289a..00000000000 --- a/src/test/compile-fail/issue-21221-1.rs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -mod mul1 { - pub trait Mul {} -} - -mod mul2 { - pub trait Mul {} -} - -mod mul3 { - enum Mul { - Yes, - No - } -} - -mod mul4 { - type Mul = String; -} - -mod mul5 { - struct Mul{ - left_term: u32, - right_term: u32 - } -} - -#[derive(Debug)] -struct Foo; - -// When we comment the next line: -//use mul1::Mul; - -// BEFORE, we got the following error for the `impl` below: -// error: use of undeclared trait name `Mul` [E0405] -// AFTER, we get this message: -// error: trait `Mul` is not in scope. -// help: ... -// help: you can import several candidates into scope (`use ...;`): -// help: `mul1::Mul` -// help: `mul2::Mul` -// help: `std::ops::Mul` - -impl Mul for Foo { -//~^ ERROR trait `Mul` is not in scope -//~| HELP `mul1::Mul` -//~| HELP `mul2::Mul` -//~| HELP `std::ops::Mul` -//~| HELP you can import several candidates into scope (`use ...;`): -} - -// BEFORE, we got: -// error: use of undeclared type name `Mul` [E0412] -// AFTER, we get: -// error: type name `Mul` is not in scope. Maybe you meant: -// help: ... -// help: you can import several candidates into scope (`use ...;`): -// help: `mul1::Mul` -// help: `mul2::Mul` -// help: `mul3::Mul` -// help: `mul4::Mul` -// help: and 2 other candidates -fn getMul() -> Mul { -//~^ ERROR type name `Mul` is undefined or not in scope -//~| HELP `mul1::Mul` -//~| HELP `mul2::Mul` -//~| HELP `mul3::Mul` -//~| HELP `mul4::Mul` -//~| HELP and 2 other candidates -//~| HELP you can import several candidates into scope (`use ...;`): -} - -// Let's also test what happens if the trait doesn't exist: -impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo { -//~^ ERROR trait `ThisTraitReallyDoesntExistInAnyModuleReally` is not in scope -//~| HELP no candidates by the name of `ThisTraitReallyDoesntExistInAnyModuleReally` found -} - -// Let's also test what happens if there's just one alternative: -impl Div for Foo { -//~^ ERROR trait `Div` is not in scope -//~| HELP `use std::ops::Div;` -} - -fn main() { - let foo = Foo(); - println!("Hello, {:?}!", foo); -} diff --git a/src/test/compile-fail/issue-21221-2.rs b/src/test/compile-fail/issue-21221-2.rs deleted file mode 100644 index 861acf62d0b..00000000000 --- a/src/test/compile-fail/issue-21221-2.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod foo { - pub mod bar { - // note: trait T is not public, but being in the current - // crate, it's fine to show it, since the programmer can - // decide to make it public based on the suggestion ... - pub trait T {} - } - // imports should be ignored: - use self::bar::T; -} - -pub mod baz { - pub use foo; - pub use std::ops::{Mul as T}; -} - -struct Foo; -impl T for Foo { } -//~^ ERROR trait `T` is not in scope -//~| HELP you can import it into scope: `use foo::bar::T;`. diff --git a/src/test/compile-fail/issue-21221-3.rs b/src/test/compile-fail/issue-21221-3.rs deleted file mode 100644 index 05786e69cef..00000000000 --- a/src/test/compile-fail/issue-21221-3.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// testing whether the lookup mechanism picks up types -// defined in the outside crate - -// aux-build:issue-21221-3.rs - -extern crate issue_21221_3; - -struct Foo; - -// NOTE: This shows only traits accessible from the current -// crate, thus the two private entities: -// `issue_21221_3::outer::private_module::OuterTrait` and -// `issue_21221_3::outer::public_module::OuterTrait` -// are hidden from the view. -impl OuterTrait for Foo {} -//~^ ERROR trait `OuterTrait` is not in scope -//~| HELP you can import it into scope: `use issue_21221_3::outer::OuterTrait;`. -fn main() { - println!("Hello, world!"); -} diff --git a/src/test/compile-fail/issue-22037.rs b/src/test/compile-fail/issue-22037.rs index 74f1be95420..2a81b55dc7b 100644 --- a/src/test/compile-fail/issue-22037.rs +++ b/src/test/compile-fail/issue-22037.rs @@ -11,7 +11,7 @@ trait A { type Output; fn a(&self) -> <Self as A>::X; -//~^ ERROR: associated type `A::X` is undefined or not in scope + //~^ ERROR unresolved associated type `A::X` } impl A for u32 { diff --git a/src/test/compile-fail/issue-22384.rs b/src/test/compile-fail/issue-22384.rs index 46a43bdfcb8..ad42a7e4a97 100644 --- a/src/test/compile-fail/issue-22384.rs +++ b/src/test/compile-fail/issue-22384.rs @@ -14,5 +14,5 @@ trait Trait { fn main() { <<i32 as Copy>::foobar as Trait>::foo(); - //~^ ERROR associated type `Copy::foobar` is undefined or not in scope + //~^ ERROR unresolved associated type `Copy::foobar` } diff --git a/src/test/compile-fail/issue-2281-part1.rs b/src/test/compile-fail/issue-2281-part1.rs index f59252dd315..8d21650ed6f 100644 --- a/src/test/compile-fail/issue-2281-part1.rs +++ b/src/test/compile-fail/issue-2281-part1.rs @@ -8,6 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: unresolved name `foobar` - -fn main() { println!("{}", foobar); } +fn main() { println!("{}", foobar); } //~ ERROR unresolved value `foobar` diff --git a/src/test/compile-fail/issue-2330.rs b/src/test/compile-fail/issue-2330.rs index 63f146a21d9..f1a282695ac 100644 --- a/src/test/compile-fail/issue-2330.rs +++ b/src/test/compile-fail/issue-2330.rs @@ -15,7 +15,7 @@ trait channel<T> { } // `chan` is not a trait, it's an enum -impl chan for isize { //~ ERROR `chan` is not a trait +impl chan for isize { //~ ERROR expected trait, found enum `chan` fn send(&self, v: isize) { panic!() } } diff --git a/src/test/compile-fail/issue-23305.rs b/src/test/compile-fail/issue-23305.rs deleted file mode 100644 index 4acb1f70d34..00000000000 --- a/src/test/compile-fail/issue-23305.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait ToNbt<T> { - fn new(val: T) -> Self; -} - -impl ToNbt<Self> {} //~ ERROR use of `Self` outside of an impl or trait -//~^ ERROR the trait `ToNbt` cannot be made into an object - -fn main() {} diff --git a/src/test/compile-fail/issue-2356.rs b/src/test/compile-fail/issue-2356.rs deleted file mode 100644 index d7635d7bc94..00000000000 --- a/src/test/compile-fail/issue-2356.rs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait Groom { - fn shave(other: usize); -} - -pub struct cat { - whiskers: isize, -} - -pub enum MaybeDog { - Dog, - NoDog -} - -impl MaybeDog { - fn bark() { - // If this provides a suggestion, it's a bug as MaybeDog doesn't impl Groom - shave(); - //~^ ERROR: unresolved name `shave` - //~| NOTE unresolved name - } -} - -impl Groom for cat { - fn shave(other: usize) { - whiskers -= other; - //~^ ERROR: unresolved name `whiskers` - //~| NOTE unresolved name - //~| HELP this is an associated function - shave(4); - //~^ ERROR: unresolved name `shave` - //~| NOTE did you mean to call `Groom::shave`? - purr(); - //~^ ERROR: unresolved name `purr` - //~| NOTE unresolved name - } -} - -impl cat { - fn static_method() {} - - fn purr_louder() { - static_method(); - //~^ ERROR: unresolved name `static_method` - //~| NOTE unresolved name - purr(); - //~^ ERROR: unresolved name `purr` - //~| NOTE unresolved name - purr(); - //~^ ERROR: unresolved name `purr` - //~| NOTE unresolved name - purr(); - //~^ ERROR: unresolved name `purr` - //~| NOTE unresolved name - } -} - -impl cat { - fn meow() { - if self.whiskers > 3 { - //~^ ERROR `self` is not available in a static method [E0424] - //~| NOTE not available in static method - //~| NOTE maybe a `self` argument is missing? - println!("MEOW"); - } - } - - fn purr(&self) { - grow_older(); - //~^ ERROR: unresolved name `grow_older` - //~| NOTE unresolved name - shave(); - //~^ ERROR: unresolved name `shave` - //~| NOTE unresolved name - } - - fn burn_whiskers(&mut self) { - whiskers = 0; - //~^ ERROR: unresolved name `whiskers` - //~| NOTE did you mean `self.whiskers`? - } - - pub fn grow_older(other:usize) { - whiskers = 4; - //~^ ERROR: unresolved name `whiskers` - //~| NOTE unresolved name - //~| HELP this is an associated function - purr_louder(); - //~^ ERROR: unresolved name `purr_louder` - //~| NOTE unresolved name - } -} - -fn main() { - self += 1; - //~^ ERROR: unresolved name `self` - //~| NOTE unresolved name - //~| HELP: module `self` - // it's a bug if this suggests a missing `self` as we're not in a method -} diff --git a/src/test/compile-fail/issue-24081.rs b/src/test/compile-fail/issue-24081.rs index 188716c5e93..26bb72b862f 100644 --- a/src/test/compile-fail/issue-24081.rs +++ b/src/test/compile-fail/issue-24081.rs @@ -15,14 +15,14 @@ use std::ops::Div; //~ NOTE previous import use std::ops::Rem; //~ NOTE previous import type Add = bool; //~ ERROR a trait named `Add` has already been imported in this module -//~| was already imported +//~| `Add` already imported struct Sub { x: f32 } //~ ERROR a trait named `Sub` has already been imported in this module -//~| was already imported +//~| `Sub` already imported enum Mul { A, B } //~ ERROR a trait named `Mul` has already been imported in this module -//~| was already imported +//~| `Mul` already imported mod Div { } //~ ERROR a trait named `Div` has already been imported in this module -//~| was already imported +//~| `Div` already imported trait Rem { } //~ ERROR a trait named `Rem` has already been imported in this module -//~| was already imported +//~| `Rem` already imported fn main() {} diff --git a/src/test/compile-fail/issue-24968.rs b/src/test/compile-fail/issue-24968.rs deleted file mode 100644 index f51b77b0ee5..00000000000 --- a/src/test/compile-fail/issue-24968.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn foo(_: Self) { - //~^ ERROR use of `Self` outside of an impl or trait -} - -fn main() {} diff --git a/src/test/compile-fail/issue-28388-1.rs b/src/test/compile-fail/issue-28388-1.rs index ed7851ec0f1..334fdee00a0 100644 --- a/src/test/compile-fail/issue-28388-1.rs +++ b/src/test/compile-fail/issue-28388-1.rs @@ -10,8 +10,6 @@ // Prefix in imports with empty braces should be resolved and checked privacy, stability, etc. -use foo::{}; -//~^ ERROR failed to resolve. Maybe a missing `extern crate foo;`? -//~| NOTE foo +use foo::{}; //~ ERROR unresolved module or enum `foo` fn main() {} diff --git a/src/test/compile-fail/issue-28388-3.rs b/src/test/compile-fail/issue-28388-3.rs index 4baaa16e772..12357779b51 100644 --- a/src/test/compile-fail/issue-28388-3.rs +++ b/src/test/compile-fail/issue-28388-3.rs @@ -14,8 +14,7 @@ extern crate lint_stability; -use lint_stability::UnstableStruct::{}; -//~^ ERROR use of unstable library feature 'test_feature' -use lint_stability::StableStruct::{}; // OK +use lint_stability::UnstableEnum::{}; //~ ERROR use of unstable library feature 'test_feature' +use lint_stability::StableEnum::{}; // OK fn main() {} diff --git a/src/test/compile-fail/issue-30535.rs b/src/test/compile-fail/issue-30535.rs index 93f3086d057..90f5220a623 100644 --- a/src/test/compile-fail/issue-30535.rs +++ b/src/test/compile-fail/issue-30535.rs @@ -13,7 +13,7 @@ extern crate issue_30535 as foo; fn bar( - _: foo::Foo::FooV //~ ERROR value `foo::Foo::FooV` used as a type + _: foo::Foo::FooV //~ ERROR expected type, found variant `foo::Foo::FooV` ) {} fn main() {} diff --git a/src/test/compile-fail/issue-30589.rs b/src/test/compile-fail/issue-30589.rs index 32765d5acb4..dd5fac9bed1 100644 --- a/src/test/compile-fail/issue-30589.rs +++ b/src/test/compile-fail/issue-30589.rs @@ -10,7 +10,7 @@ use std::fmt; -impl fmt::Display for DecoderError { //~ ERROR E0412 +impl fmt::Display for DecoderError { //~ ERROR unresolved type `DecoderError` fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Missing data: {}", self.0) } diff --git a/src/test/compile-fail/issue-31845.rs b/src/test/compile-fail/issue-31845.rs index 344a1117254..32e004af1f3 100644 --- a/src/test/compile-fail/issue-31845.rs +++ b/src/test/compile-fail/issue-31845.rs @@ -14,7 +14,7 @@ fn f() { fn g() {} mod foo { fn h() { - g(); //~ ERROR unresolved name + g(); //~ ERROR unresolved function `g` } } } diff --git a/src/test/compile-fail/issue-32119.rs b/src/test/compile-fail/issue-32119.rs index 4743b779ef6..e630a01a593 100644 --- a/src/test/compile-fail/issue-32119.rs +++ b/src/test/compile-fail/issue-32119.rs @@ -9,6 +9,7 @@ // except according to those terms. #![feature(rustc_attrs)] +#![allow(dead_code)] pub type T = (); mod foo { pub use super::T; } diff --git a/src/test/compile-fail/issue-33876.rs b/src/test/compile-fail/issue-33876.rs deleted file mode 100644 index 87747d2851f..00000000000 --- a/src/test/compile-fail/issue-33876.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::any::Any; - -struct Foo; - -trait Bar {} - -impl Bar for Foo {} - -fn main() { - let any: &Any = &Bar; //~ ERROR E0425 - //~| HELP trait `Bar` - if any.is::<u32>() { println!("u32"); } -} diff --git a/src/test/compile-fail/issue-34334.rs b/src/test/compile-fail/issue-34334.rs index ffcd052369d..fa672557c5e 100644 --- a/src/test/compile-fail/issue-34334.rs +++ b/src/test/compile-fail/issue-34334.rs @@ -11,5 +11,5 @@ fn main () { let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `+`, `,`, or `>`, found `=` let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); - //~^ ERROR unresolved name `sr` + //~^ ERROR unresolved value `sr` } diff --git a/src/test/compile-fail/issue-35075.rs b/src/test/compile-fail/issue-35075.rs index a70452dcbd0..39d06312aa7 100644 --- a/src/test/compile-fail/issue-35075.rs +++ b/src/test/compile-fail/issue-35075.rs @@ -9,11 +9,11 @@ // except according to those terms. struct Bar<T> { - inner: Foo<T> //~ ERROR type name `Foo` is undefined or not in scope + inner: Foo<T> //~ ERROR unresolved type `Foo` } enum Baz<T> { - Foo(Foo<T>) //~ ERROR type name `Foo` is undefined or not in scope + Foo(Foo<T>) //~ ERROR unresolved type `Foo` } fn main() {} diff --git a/src/test/compile-fail/issue-37534.rs b/src/test/compile-fail/issue-37534.rs index eb676601e89..1a6d92166d7 100644 --- a/src/test/compile-fail/issue-37534.rs +++ b/src/test/compile-fail/issue-37534.rs @@ -9,8 +9,8 @@ // except according to those terms. struct Foo<T: ?Hash> { } -//~^ ERROR trait `Hash` is not in scope [E0405] -//~^^ ERROR parameter `T` is never used [E0392] +//~^ ERROR unresolved trait `Hash` +//~^^ ERROR parameter `T` is never used //~^^^ WARN default bound relaxed for a type parameter, but this does nothing fn main() { } diff --git a/src/test/compile-fail/auxiliary/issue_19452_aux.rs b/src/test/compile-fail/issue-38458.rs index 205566e4b1f..56eb5f874cd 100644 --- a/src/test/compile-fail/auxiliary/issue_19452_aux.rs +++ b/src/test/compile-fail/issue-38458.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub enum Homura { - Madoka { age: u32 } -} +const x: () = { + return; //~ ERROR return statement outside of function body +}; + +fn main() {} diff --git a/src/test/compile-fail/issue-3907-2.rs b/src/test/compile-fail/issue-3907-2.rs deleted file mode 100644 index 130647966f2..00000000000 --- a/src/test/compile-fail/issue-3907-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue_3907.rs -extern crate issue_3907; - -type Foo = issue_3907::Foo+'static; - -struct S { - name: isize -} - -fn bar(_x: Foo) {} -//~^ ERROR E0038 - -fn main() {} diff --git a/src/test/compile-fail/issue-3907.rs b/src/test/compile-fail/issue-3907.rs deleted file mode 100644 index 86906ed9af2..00000000000 --- a/src/test/compile-fail/issue-3907.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue_3907.rs -extern crate issue_3907; - -type Foo = issue_3907::Foo; - -struct S { - name: isize -} - -impl Foo for S { //~ ERROR: `Foo` is not a trait - //~| NOTE: expected trait, found type alias - //~| NOTE: type aliases cannot be used for traits - fn bar() { } -} - -fn main() { - let s = S { - name: 0 - }; - s.bar(); -} diff --git a/src/test/compile-fail/issue-4366-2.rs b/src/test/compile-fail/issue-4366-2.rs index a6fe719509c..687720a130c 100644 --- a/src/test/compile-fail/issue-4366-2.rs +++ b/src/test/compile-fail/issue-4366-2.rs @@ -23,7 +23,7 @@ mod a { pub mod sub { use a::b::*; fn sub() -> bar { 1 } - //~^ ERROR: type name `bar` is undefined or not in scope + //~^ ERROR unresolved type `bar` } } @@ -32,5 +32,5 @@ mod m1 { } fn main() { - foo(); //~ ERROR: unresolved name + foo(); //~ ERROR expected function, found module `foo` } diff --git a/src/test/compile-fail/issue-4366.rs b/src/test/compile-fail/issue-4366.rs index 5625ac00c85..18e55ee3c2a 100644 --- a/src/test/compile-fail/issue-4366.rs +++ b/src/test/compile-fail/issue-4366.rs @@ -25,7 +25,7 @@ mod a { } pub mod sub { use a::b::*; - fn sub() -> isize { foo(); 1 } //~ ERROR: unresolved name `foo` + fn sub() -> isize { foo(); 1 } //~ ERROR unresolved function `foo` } } diff --git a/src/test/compile-fail/issue-5035-2.rs b/src/test/compile-fail/issue-5035-2.rs deleted file mode 100644 index 83ff95cc2ea..00000000000 --- a/src/test/compile-fail/issue-5035-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait I {} -type K = I+'static; - -fn foo(_x: K) {} //~ ERROR: `I + 'static: std::marker::Sized` is not satisfied - -fn main() {} diff --git a/src/test/compile-fail/issue-5035.rs b/src/test/compile-fail/issue-5035.rs deleted file mode 100644 index 8ebcba47134..00000000000 --- a/src/test/compile-fail/issue-5035.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait I {} -type K = I; -impl K for isize {} //~ ERROR: `K` is not a trait - //~| NOTE: expected trait, found type alias - //~| NOTE: aliases cannot be used for traits - -use ImportError; //~ ERROR unresolved import `ImportError` [E0432] - //~^ no `ImportError` in the root -impl ImportError for () {} // check that this is not an additional error (c.f. #35142) - -fn main() {} diff --git a/src/test/compile-fail/issue-5099.rs b/src/test/compile-fail/issue-5099.rs index c2e1fc615cc..e78b54bd411 100644 --- a/src/test/compile-fail/issue-5099.rs +++ b/src/test/compile-fail/issue-5099.rs @@ -9,6 +9,6 @@ // except according to those terms. -trait B < A > { fn a() -> A { this.a } } //~ ERROR unresolved name +trait B < A > { fn a() -> A { this.a } } //~ ERROR unresolved value `this` fn main() {} diff --git a/src/test/compile-fail/issue-5927.rs b/src/test/compile-fail/issue-5927.rs index 7668a2117a2..c421dbd1eb3 100644 --- a/src/test/compile-fail/issue-5927.rs +++ b/src/test/compile-fail/issue-5927.rs @@ -12,7 +12,7 @@ fn main() { let z = match 3 { x(1) => x(1) //~ ERROR unresolved tuple struct/variant `x` - //~^ ERROR unresolved name `x` + //~^ ERROR unresolved function `x` }; assert!(z == 3); } diff --git a/src/test/compile-fail/issue-6702.rs b/src/test/compile-fail/issue-6702.rs deleted file mode 100644 index 66ed817ffa8..00000000000 --- a/src/test/compile-fail/issue-6702.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct Monster { - damage: isize -} - - -fn main() { - let _m = Monster(); //~ ERROR `Monster` is the name of a struct or - //~^ HELP did you mean to write: `Monster { /* fields */ }`? -} diff --git a/src/test/compile-fail/issue-7607-1.rs b/src/test/compile-fail/issue-7607-1.rs index 96ac2de1762..e7b7decbdb0 100644 --- a/src/test/compile-fail/issue-7607-1.rs +++ b/src/test/compile-fail/issue-7607-1.rs @@ -12,7 +12,7 @@ struct Foo { x: isize } -impl Fo { //~ ERROR type name `Fo` is undefined or not in scope +impl Fo { //~ ERROR unresolved type `Fo` fn foo() {} } diff --git a/src/test/compile-fail/issue-8767.rs b/src/test/compile-fail/issue-8767.rs index 1c97c0c886d..318eab92252 100644 --- a/src/test/compile-fail/issue-8767.rs +++ b/src/test/compile-fail/issue-8767.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -impl B { //~ ERROR type name `B` is undefined or not in scope +impl B { //~ ERROR unresolved type `B` } fn main() { diff --git a/src/test/compile-fail/keyword-super-as-identifier.rs b/src/test/compile-fail/keyword-super-as-identifier.rs index 531705563e2..62649ba8a0f 100644 --- a/src/test/compile-fail/keyword-super-as-identifier.rs +++ b/src/test/compile-fail/keyword-super-as-identifier.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let super = "foo"; //~ ERROR unresolved unit struct/variant or constant `super` + let super = "foo"; //~ ERROR failed to resolve. There are too many initial `super`s } diff --git a/src/test/compile-fail/keyword-super.rs b/src/test/compile-fail/keyword-super.rs index 9ac9e800c84..02047bd639f 100644 --- a/src/test/compile-fail/keyword-super.rs +++ b/src/test/compile-fail/keyword-super.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let super: isize; //~ ERROR unresolved unit struct/variant or constant `super` + let super: isize; //~ ERROR failed to resolve. There are too many initial `super`s } diff --git a/src/test/compile-fail/E0248.rs b/src/test/compile-fail/lint-dead-code-type-alias.rs index 25568a323e1..aaa01aa6bbe 100644 --- a/src/test/compile-fail/E0248.rs +++ b/src/test/compile-fail/lint-dead-code-type-alias.rs @@ -8,11 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum Foo { - Bar(u32), -} +#![deny(dead_code)] + +type Used = u8; +type Unused = u8; //~ ERROR type alias is never used + +fn id(x: Used) -> Used { x } -fn do_something(x: Foo::Bar) { } //~ ERROR E0248 - //~| NOTE value used as a type fn main() { + id(0); } diff --git a/src/test/compile-fail/macro-outer-attributes.rs b/src/test/compile-fail/macro-outer-attributes.rs index 0469a9d1cc8..70a50d83904 100644 --- a/src/test/compile-fail/macro-outer-attributes.rs +++ b/src/test/compile-fail/macro-outer-attributes.rs @@ -25,6 +25,6 @@ test!(b, // test1!(#[bar]) #[qux] fn main() { - a::bar(); //~ ERROR unresolved name `a::bar` + a::bar(); //~ ERROR unresolved function `a::bar` b::bar(); } diff --git a/src/test/compile-fail/macro-parameter-span.rs b/src/test/compile-fail/macro-parameter-span.rs index 2ef69759128..dc5a2deab42 100644 --- a/src/test/compile-fail/macro-parameter-span.rs +++ b/src/test/compile-fail/macro-parameter-span.rs @@ -18,6 +18,6 @@ macro_rules! foo { // not to the macro variable '$id' fn main() { foo!( - x //~ ERROR unresolved name `x` + x //~ ERROR unresolved value `x` ); } diff --git a/src/test/compile-fail/macro-tt-matchers.rs b/src/test/compile-fail/macro-tt-matchers.rs index 945490cefb9..969f1500717 100644 --- a/src/test/compile-fail/macro-tt-matchers.rs +++ b/src/test/compile-fail/macro-tt-matchers.rs @@ -9,6 +9,7 @@ // except according to those terms. #![feature(rustc_attrs)] +#![allow(dead_code)] macro_rules! foo { ($x:tt) => (type Alias = $x<i32>;) diff --git a/src/test/compile-fail/match-join.rs b/src/test/compile-fail/match-join.rs index 4ec426fd3aa..3f6304db957 100644 --- a/src/test/compile-fail/match-join.rs +++ b/src/test/compile-fail/match-join.rs @@ -16,6 +16,6 @@ fn my_panic() -> ! { panic!(); } fn main() { match true { false => { my_panic(); } true => { } } - println!("{}", x); //~ ERROR unresolved name `x` + println!("{}", x); //~ ERROR unresolved value `x` let x: isize; } diff --git a/src/test/compile-fail/match-vec-mismatch.rs b/src/test/compile-fail/match-vec-mismatch.rs index 596cec167c2..4cf8eea78cf 100644 --- a/src/test/compile-fail/match-vec-mismatch.rs +++ b/src/test/compile-fail/match-vec-mismatch.rs @@ -34,7 +34,7 @@ fn main() { [0, 1, 2, 3, x..] => {} //~ ERROR pattern requires }; - match does_not_exist { //~ ERROR unresolved name + match does_not_exist { //~ ERROR unresolved value `does_not_exist` [] => {} }; } diff --git a/src/test/compile-fail/mod_file_correct_spans.rs b/src/test/compile-fail/mod_file_correct_spans.rs index f8ea5dda183..c64b22a7f41 100644 --- a/src/test/compile-fail/mod_file_correct_spans.rs +++ b/src/test/compile-fail/mod_file_correct_spans.rs @@ -13,5 +13,5 @@ mod mod_file_aux; fn main() { - assert!(mod_file_aux::bar() == 10); //~ ERROR unresolved name + assert!(mod_file_aux::bar() == 10); //~ ERROR unresolved function `mod_file_aux::bar` } diff --git a/src/test/compile-fail/name-clash-nullary.rs b/src/test/compile-fail/name-clash-nullary.rs index 4c76c4b8b02..359417aee52 100644 --- a/src/test/compile-fail/name-clash-nullary.rs +++ b/src/test/compile-fail/name-clash-nullary.rs @@ -13,6 +13,6 @@ use std::option::*; fn main() { let None: isize = 42; //~ ERROR let bindings cannot shadow unit variants log(debug, None); - //~^ ERROR unresolved name `debug` - //~| ERROR unresolved name `log` + //~^ ERROR unresolved function `log` + //~| ERROR unresolved value `debug` } diff --git a/src/test/compile-fail/namespace-mix.rs b/src/test/compile-fail/namespace-mix.rs index cb7894b726f..c1c724fc431 100644 --- a/src/test/compile-fail/namespace-mix.rs +++ b/src/test/compile-fail/namespace-mix.rs @@ -41,13 +41,13 @@ mod m2 { fn f12() { check(m1::S{}); //~ ERROR c::Item - check(m1::S); //~ ERROR unresolved name + check(m1::S); //~ ERROR expected value, found type alias `m1::S` check(m2::S{}); //~ ERROR c::S check(m2::S); //~ ERROR c::Item } fn xf12() { check(xm1::S{}); //~ ERROR c::Item - check(xm1::S); //~ ERROR unresolved name + check(xm1::S); //~ ERROR expected value, found type alias `xm1::S` check(xm2::S{}); //~ ERROR c::S check(xm2::S); //~ ERROR c::Item } @@ -107,13 +107,13 @@ mod m8 { fn f78() { check(m7::V{}); //~ ERROR c::Item - check(m7::V); //~ ERROR name of a struct or struct variant + check(m7::V); //~ ERROR expected value, found struct variant `m7::V` check(m8::V{}); //~ ERROR c::E check(m8::V); //~ ERROR c::Item } fn xf78() { check(xm7::V{}); //~ ERROR c::Item - check(xm7::V); //~ ERROR name of a struct or struct variant + check(xm7::V); //~ ERROR expected value, found struct variant `xm7::V` check(xm8::V{}); //~ ERROR c::E check(xm8::V); //~ ERROR c::Item } diff --git a/src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs b/src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs index 4fcb31d3686..d92323e290b 100644 --- a/src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs +++ b/src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs @@ -18,8 +18,8 @@ mod m { pub fn main() { use namespaced_enums::Foo::*; - foo(); //~ ERROR unresolved name `foo` - m::foo(); //~ ERROR unresolved name `m::foo` - bar(); //~ ERROR unresolved name `bar` - m::bar(); //~ ERROR unresolved name `m::bar` + foo(); //~ ERROR unresolved function `foo` + m::foo(); //~ ERROR unresolved function `m::foo` + bar(); //~ ERROR unresolved function `bar` + m::bar(); //~ ERROR unresolved function `m::bar` } diff --git a/src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs b/src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs index 4437482fb67..b7c7397ee98 100644 --- a/src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs +++ b/src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs @@ -28,8 +28,8 @@ mod m { pub fn main() { use m2::Foo::*; - foo(); //~ ERROR unresolved name `foo` - m::foo(); //~ ERROR unresolved name `m::foo` - bar(); //~ ERROR unresolved name `bar` - m::bar(); //~ ERROR unresolved name `m::bar` + foo(); //~ ERROR unresolved function `foo` + m::foo(); //~ ERROR unresolved function `m::foo` + bar(); //~ ERROR unresolved function `bar` + m::bar(); //~ ERROR unresolved function `m::bar` } diff --git a/src/test/compile-fail/nested-cfg-attrs.rs b/src/test/compile-fail/nested-cfg-attrs.rs index 6010b1e695e..f3e20f4f614 100644 --- a/src/test/compile-fail/nested-cfg-attrs.rs +++ b/src/test/compile-fail/nested-cfg-attrs.rs @@ -11,4 +11,4 @@ #[cfg_attr(all(), cfg_attr(all(), cfg(foo)))] fn f() {} -fn main() { f() } //~ ERROR unresolved name `f` +fn main() { f() } //~ ERROR unresolved function `f` diff --git a/src/test/compile-fail/no-implicit-prelude-nested.rs b/src/test/compile-fail/no-implicit-prelude-nested.rs index af1046bcd5d..49e2e9f34fa 100644 --- a/src/test/compile-fail/no-implicit-prelude-nested.rs +++ b/src/test/compile-fail/no-implicit-prelude-nested.rs @@ -18,26 +18,26 @@ mod foo { mod baz { struct Test; - impl Add for Test {} //~ ERROR: not in scope - impl Clone for Test {} //~ ERROR: not in scope - impl Iterator for Test {} //~ ERROR: not in scope - impl ToString for Test {} //~ ERROR: not in scope - impl Writer for Test {} //~ ERROR: not in scope + impl Add for Test {} //~ ERROR unresolved trait `Add` + impl Clone for Test {} //~ ERROR unresolved trait `Clone` + impl Iterator for Test {} //~ ERROR unresolved trait `Iterator` + impl ToString for Test {} //~ ERROR unresolved trait `ToString` + impl Writer for Test {} //~ ERROR unresolved trait `Writer` fn foo() { - drop(2) //~ ERROR: unresolved name + drop(2) //~ ERROR unresolved function `drop` } } struct Test; - impl Add for Test {} //~ ERROR: not in scope - impl Clone for Test {} //~ ERROR: not in scope - impl Iterator for Test {} //~ ERROR: not in scope - impl ToString for Test {} //~ ERROR: not in scope - impl Writer for Test {} //~ ERROR: not in scope + impl Add for Test {} //~ ERROR unresolved trait `Add` + impl Clone for Test {} //~ ERROR unresolved trait `Clone` + impl Iterator for Test {} //~ ERROR unresolved trait `Iterator` + impl ToString for Test {} //~ ERROR unresolved trait `ToString` + impl Writer for Test {} //~ ERROR unresolved trait `Writer` fn foo() { - drop(2) //~ ERROR: unresolved name + drop(2) //~ ERROR unresolved function `drop` } } @@ -45,14 +45,14 @@ fn qux() { #[no_implicit_prelude] mod qux_inner { struct Test; - impl Add for Test {} //~ ERROR: not in scope - impl Clone for Test {} //~ ERROR: not in scope - impl Iterator for Test {} //~ ERROR: not in scope - impl ToString for Test {} //~ ERROR: not in scope - impl Writer for Test {} //~ ERROR: not in scope + impl Add for Test {} //~ ERROR unresolved trait `Add` + impl Clone for Test {} //~ ERROR unresolved trait `Clone` + impl Iterator for Test {} //~ ERROR unresolved trait `Iterator` + impl ToString for Test {} //~ ERROR unresolved trait `ToString` + impl Writer for Test {} //~ ERROR unresolved trait `Writer` fn foo() { - drop(2) //~ ERROR: unresolved name + drop(2) //~ ERROR unresolved function `drop` } } } diff --git a/src/test/compile-fail/no-implicit-prelude.rs b/src/test/compile-fail/no-implicit-prelude.rs index 4693fd14e7d..b830a64fa81 100644 --- a/src/test/compile-fail/no-implicit-prelude.rs +++ b/src/test/compile-fail/no-implicit-prelude.rs @@ -17,12 +17,12 @@ // fail with the same error message). struct Test; -impl Add for Test {} //~ ERROR: not in scope -impl Clone for Test {} //~ ERROR: not in scope -impl Iterator for Test {} //~ ERROR: not in scope -impl ToString for Test {} //~ ERROR: not in scope -impl Writer for Test {} //~ ERROR: not in scope +impl Add for Test {} //~ ERROR unresolved trait `Add` +impl Clone for Test {} //~ ERROR unresolved trait `Clone` +impl Iterator for Test {} //~ ERROR unresolved trait `Iterator` +impl ToString for Test {} //~ ERROR unresolved trait `ToString` +impl Writer for Test {} //~ ERROR unresolved trait `Writer` fn main() { - drop(2) //~ ERROR: unresolved name + drop(2) //~ ERROR unresolved function `drop` } diff --git a/src/test/compile-fail/no-link.rs b/src/test/compile-fail/no-link.rs index c4737a37399..7e4e55543cd 100644 --- a/src/test/compile-fail/no-link.rs +++ b/src/test/compile-fail/no-link.rs @@ -15,5 +15,5 @@ extern crate empty_struct; //~^ WARN custom derive crates and `#[no_link]` crates have no effect without `#[macro_use]` fn main() { - empty_struct::XEmpty1; //~ ERROR unresolved name + empty_struct::XEmpty1; //~ ERROR unresolved value `empty_struct::XEmpty1` } diff --git a/src/test/compile-fail/parser-recovery-1.rs b/src/test/compile-fail/parser-recovery-1.rs index 85b62461238..373b33c3e49 100644 --- a/src/test/compile-fail/parser-recovery-1.rs +++ b/src/test/compile-fail/parser-recovery-1.rs @@ -14,11 +14,11 @@ trait Foo { fn bar() { - let x = foo(); //~ ERROR unresolved name `foo` + let x = foo(); //~ ERROR unresolved function `foo` } fn main() { let x = y.; //~ ERROR unexpected token - //~^ ERROR unresolved name `y` + //~^ ERROR unresolved value `y` } //~ ERROR this file contains an un-closed delimiter diff --git a/src/test/compile-fail/parser-recovery-2.rs b/src/test/compile-fail/parser-recovery-2.rs index 109da6251e3..c2bbbda4011 100644 --- a/src/test/compile-fail/parser-recovery-2.rs +++ b/src/test/compile-fail/parser-recovery-2.rs @@ -14,11 +14,11 @@ trait Foo { fn bar() { - let x = foo(); //~ ERROR unresolved name `foo` + let x = foo(); //~ ERROR unresolved function `foo` ) //~ ERROR incorrect close delimiter: `)` } fn main() { let x = y.; //~ ERROR unexpected token - //~^ ERROR unresolved name `y` + //~^ ERROR unresolved value `y` } diff --git a/src/test/compile-fail/pattern-macro-hygiene.rs b/src/test/compile-fail/pattern-macro-hygiene.rs index 1c79c9a2293..24f29666172 100644 --- a/src/test/compile-fail/pattern-macro-hygiene.rs +++ b/src/test/compile-fail/pattern-macro-hygiene.rs @@ -12,5 +12,5 @@ macro_rules! foo { () => ( x ) } fn main() { let foo!() = 2; - x + 1; //~ ERROR unresolved name `x` + x + 1; //~ ERROR unresolved value `x` } diff --git a/src/test/compile-fail/privacy-ns1.rs b/src/test/compile-fail/privacy-ns1.rs index dcab3a46b0a..9c1e8250dbc 100644 --- a/src/test/compile-fail/privacy-ns1.rs +++ b/src/test/compile-fail/privacy-ns1.rs @@ -27,7 +27,7 @@ pub mod foo1 { fn test_glob1() { use foo1::*; - Bar(); //~ ERROR unresolved name `Bar` + Bar(); //~ ERROR expected function, found trait `Bar` } // private type, public value @@ -42,7 +42,7 @@ pub mod foo2 { fn test_glob2() { use foo2::*; - let _x: Box<Bar>; //~ ERROR type name `Bar` is undefined or not in scope + let _x: Box<Bar>; //~ ERROR expected type, found function `Bar` } // neither public @@ -57,8 +57,8 @@ pub mod foo3 { fn test_glob3() { use foo3::*; - Bar(); //~ ERROR unresolved name `Bar` - let _x: Box<Bar>; //~ ERROR type name `Bar` is undefined or not in scope + Bar(); //~ ERROR unresolved function `Bar` + let _x: Box<Bar>; //~ ERROR unresolved type `Bar` } fn main() { diff --git a/src/test/compile-fail/privacy-ns2.rs b/src/test/compile-fail/privacy-ns2.rs index 7accf0ca820..ec9396b5e7b 100644 --- a/src/test/compile-fail/privacy-ns2.rs +++ b/src/test/compile-fail/privacy-ns2.rs @@ -27,13 +27,13 @@ pub mod foo1 { fn test_single1() { use foo1::Bar; - Bar(); //~ ERROR unresolved name `Bar` + Bar(); //~ ERROR expected function, found trait `Bar` } fn test_list1() { use foo1::{Bar,Baz}; - Bar(); //~ ERROR unresolved name `Bar` + Bar(); //~ ERROR expected function, found trait `Bar` } // private type, public value @@ -48,13 +48,13 @@ pub mod foo2 { fn test_single2() { use foo2::Bar; - let _x : Box<Bar>; //~ ERROR type name `Bar` is undefined + let _x : Box<Bar>; //~ ERROR expected type, found function `Bar` } fn test_list2() { use foo2::{Bar,Baz}; - let _x: Box<Bar>; //~ ERROR type name `Bar` is undefined + let _x: Box<Bar>; //~ ERROR expected type, found function `Bar` } // neither public diff --git a/src/test/compile-fail/privacy/restricted/test.rs b/src/test/compile-fail/privacy/restricted/test.rs index 3e1bb766622..01e2c6cd7e8 100644 --- a/src/test/compile-fail/privacy/restricted/test.rs +++ b/src/test/compile-fail/privacy/restricted/test.rs @@ -57,6 +57,6 @@ fn main() { } mod pathological { - pub(bad::path) mod m1 {} //~ ERROR failed to resolve module path + pub(bad::path) mod m1 {} //~ ERROR failed to resolve. Maybe a missing `extern crate bad;`? pub(foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules } diff --git a/src/test/compile-fail/privacy/restricted/ty-params.rs b/src/test/compile-fail/privacy/restricted/ty-params.rs index ae60c4366ee..593713a6e05 100644 --- a/src/test/compile-fail/privacy/restricted/ty-params.rs +++ b/src/test/compile-fail/privacy/restricted/ty-params.rs @@ -16,11 +16,11 @@ macro_rules! m { struct S<T>(T); m!{ S<u8> } //~ ERROR type or lifetime parameters in visibility path -//~^ ERROR failed to resolve module path. Not a module `S` +//~^ ERROR expected module, found struct `S` mod foo { struct S(pub(foo<T>) ()); //~ ERROR type or lifetime parameters in visibility path - //~^ ERROR type name `T` is undefined or not in scope + //~^ ERROR unresolved type `T` } fn main() {} diff --git a/src/test/compile-fail/recursive-reexports.rs b/src/test/compile-fail/recursive-reexports.rs index 6fd52beeec6..48ec16a7610 100644 --- a/src/test/compile-fail/recursive-reexports.rs +++ b/src/test/compile-fail/recursive-reexports.rs @@ -10,6 +10,8 @@ // aux-build:recursive_reexports.rs -fn f() -> recursive_reexports::S {} //~ ERROR undeclared +extern crate recursive_reexports; + +fn f() -> recursive_reexports::S {} //~ ERROR unresolved type `recursive_reexports::S` fn main() {} diff --git a/src/test/compile-fail/unresolved_static_type_field.rs b/src/test/compile-fail/resolve-bad-import-prefix.rs index 80f6108f02d..6b4a5122ad0 100644 --- a/src/test/compile-fail/unresolved_static_type_field.rs +++ b/src/test/compile-fail/resolve-bad-import-prefix.rs @@ -8,17 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(_: bool) {} +mod m {} +enum E {} +struct S; +trait Tr {} -struct Foo { - cx: bool, -} +use {}; // OK +use ::{}; // OK +use m::{}; // OK +use E::{}; // OK +use S::{}; //~ ERROR expected module or enum, found struct `S` +use Tr::{}; //~ ERROR expected module or enum, found trait `Tr` +use Nonexistent::{}; //~ ERROR unresolved module or enum `Nonexistent` -impl Foo { - fn bar() { - f(cx); //~ ERROR E0425 - //~| HELP this is an associated function - } -} - -fn main() {} +fn main () {} diff --git a/src/test/compile-fail/resolve-bad-visibility.rs b/src/test/compile-fail/resolve-bad-visibility.rs new file mode 100644 index 00000000000..088a4e6cd76 --- /dev/null +++ b/src/test/compile-fail/resolve-bad-visibility.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(pub_restricted)] + +enum E {} +trait Tr {} + +pub(E) struct S; //~ ERROR expected module, found enum `E` +pub(Tr) struct Z; //~ ERROR expected module, found trait `Tr` +pub(std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules +pub(nonexistent) struct G; //~ ERROR unresolved module `nonexistent` +pub(too_soon) struct H; //~ ERROR unresolved module `too_soon` + +// Visibilities are resolved eagerly without waiting for modules becoming fully populated. +// Visibilities can only use ancestor modules legally which are always available in time, +// so the worst thing that can happen due to eager resolution is a suboptimal error message. +mod too_soon {} + +fn main () {} diff --git a/src/test/compile-fail/resolve-conflict-item-vs-import.rs b/src/test/compile-fail/resolve-conflict-item-vs-import.rs index 5a068ce4214..2083d98e09d 100644 --- a/src/test/compile-fail/resolve-conflict-item-vs-import.rs +++ b/src/test/compile-fail/resolve-conflict-item-vs-import.rs @@ -13,6 +13,6 @@ use std::mem::transmute; fn transmute() {} //~^ ERROR a value named `transmute` has already been imported in this module -//~| was already imported +//~| `transmute` already imported fn main() { } diff --git a/src/test/compile-fail/resolve-hint-macro.rs b/src/test/compile-fail/resolve-hint-macro.rs deleted file mode 100644 index edaab012757..00000000000 --- a/src/test/compile-fail/resolve-hint-macro.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - assert(true); - //~^ ERROR unresolved name `assert` - //~| NOTE did you mean the macro `assert!`? -} diff --git a/src/test/compile-fail/issue-21221-4.rs b/src/test/compile-fail/resolve-primitive-fallback.rs index bcbee16cdcf..de463cd9e6a 100644 --- a/src/test/compile-fail/issue-21221-4.rs +++ b/src/test/compile-fail/resolve-primitive-fallback.rs @@ -8,19 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// testing whether the lookup mechanism picks up types -// defined in the outside crate - -// aux-build:issue-21221-4.rs - -extern crate issue_21221_4; - -struct Foo; - -impl T for Foo {} -//~^ ERROR trait `T` is not in scope -//~| HELP you can import it into scope: `use issue_21221_4::T;`. - fn main() { - println!("Hello, world!"); + // Make sure primitive type fallback doesn't work in value namespace + std::mem::size_of(u16); + //~^ ERROR expected value, found builtin type `u16` + //~| ERROR this function takes 0 parameters but 1 parameter was supplied + + // Make sure primitive type fallback doesn't work with global paths + let _: ::u8; + //~^ ERROR unresolved type `u8` } diff --git a/src/test/compile-fail/resolve-unknown-trait.rs b/src/test/compile-fail/resolve-unknown-trait.rs index dae3a79832b..affafbfadcf 100644 --- a/src/test/compile-fail/resolve-unknown-trait.rs +++ b/src/test/compile-fail/resolve-unknown-trait.rs @@ -10,10 +10,10 @@ trait NewTrait : SomeNonExistentTrait {} -//~^ ERROR trait `SomeNonExistentTrait` is not in scope +//~^ ERROR unresolved trait `SomeNonExistentTrait` impl SomeNonExistentTrait for isize {} -//~^ ERROR trait `SomeNonExistentTrait` is not in scope +//~^ ERROR unresolved trait `SomeNonExistentTrait` fn f<T:SomeNonExistentTrait>() {} -//~^ ERROR trait `SomeNonExistentTrait` is not in scope +//~^ ERROR unresolved trait `SomeNonExistentTrait` diff --git a/src/test/compile-fail/rmeta.rs b/src/test/compile-fail/rmeta.rs index e81e0541096..455574bbb9d 100644 --- a/src/test/compile-fail/rmeta.rs +++ b/src/test/compile-fail/rmeta.rs @@ -15,5 +15,5 @@ #![crate_type="metadata"] fn main() { - let _ = Foo; //~ ERROR unresolved name `Foo` + let _ = Foo; //~ ERROR unresolved value `Foo` } diff --git a/src/test/compile-fail/struct-fields-shorthand-unresolved.rs b/src/test/compile-fail/struct-fields-shorthand-unresolved.rs index 50a43f4a276..d1555373015 100644 --- a/src/test/compile-fail/struct-fields-shorthand-unresolved.rs +++ b/src/test/compile-fail/struct-fields-shorthand-unresolved.rs @@ -19,6 +19,6 @@ fn main() { let x = 0; let foo = Foo { x, - y //~ ERROR unresolved name `y` + y //~ ERROR unresolved value `y` }; } diff --git a/src/test/compile-fail/suggest-path-instead-of-mod-dot-item.rs b/src/test/compile-fail/suggest-path-instead-of-mod-dot-item.rs deleted file mode 100644 index 4a816ea7572..00000000000 --- a/src/test/compile-fail/suggest-path-instead-of-mod-dot-item.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Beginners write `mod.item` when they should write `mod::item`. -// This tests that we suggest the latter when we encounter the former. - -pub mod a { - pub const I: i32 = 1; - - pub fn f() -> i32 { 2 } - - pub mod b { - pub const J: i32 = 3; - - pub fn g() -> i32 { 4 } - } -} - -fn h1() -> i32 { - a.I - //~^ ERROR E0425 - //~| HELP to reference an item from the `a` module, use `a::I` -} - -fn h2() -> i32 { - a.g() - //~^ ERROR E0425 - //~| HELP to call a function from the `a` module, use `a::g(..)` -} - -fn h3() -> i32 { - a.b.J - //~^ ERROR E0425 - //~| HELP to reference an item from the `a` module, use `a::b` -} - -fn h4() -> i32 { - a::b.J - //~^ ERROR E0425 - //~| HELP to reference an item from the `a::b` module, use `a::b::J` -} - -fn h5() { - a.b.f(); - //~^ ERROR E0425 - //~| HELP to reference an item from the `a` module, use `a::b` - let v = Vec::new(); - v.push(a::b); - //~^ ERROR E0425 - //~| HELP module `a::b` cannot be used as an expression -} - -fn h6() -> i32 { - a::b.f() - //~^ ERROR E0425 - //~| HELP to call a function from the `a::b` module, use `a::b::f(..)` -} - -fn h7() { - a::b - //~^ ERROR E0425 - //~| HELP module `a::b` cannot be used as an expression -} - -fn h8() -> i32 { - a::b() - //~^ ERROR E0425 - //~| HELP module `a::b` cannot be used as an expression -} diff --git a/src/test/compile-fail/syntax-extension-minor.rs b/src/test/compile-fail/syntax-extension-minor.rs index f06e3544e57..0beb4f084c8 100644 --- a/src/test/compile-fail/syntax-extension-minor.rs +++ b/src/test/compile-fail/syntax-extension-minor.rs @@ -18,7 +18,7 @@ pub fn main() { // this now fails (correctly, I claim) because hygiene prevents // the assembled identifier from being a reference to the binding. assert!(concat_idents!(asd, f_f, dsa) == "<.<".to_string()); - //~^ ERROR: unresolved name `asdf_fdsa` + //~^ ERROR unresolved value `asdf_fdsa` assert_eq!(stringify!(use_mention_distinction), "use_mention_distinction"); } diff --git a/src/test/compile-fail/test-cfg.rs b/src/test/compile-fail/test-cfg.rs index 0709d909512..28c69e8df22 100644 --- a/src/test/compile-fail/test-cfg.rs +++ b/src/test/compile-fail/test-cfg.rs @@ -14,5 +14,5 @@ fn foo() {} fn main() { - foo(); //~ ERROR unresolved name `foo` + foo(); //~ ERROR unresolved function `foo` } diff --git a/src/test/compile-fail/token-error-correct-2.rs b/src/test/compile-fail/token-error-correct-2.rs deleted file mode 100644 index 151c1d432ed..00000000000 --- a/src/test/compile-fail/token-error-correct-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that we do some basic error correcton in the tokeniser (and don't ICE). - -fn main() { - if foo { //~ NOTE: unclosed delimiter - //~^ ERROR: unresolved name `foo` - //~| NOTE unresolved name - ) //~ ERROR: incorrect close delimiter: `)` -} diff --git a/src/test/compile-fail/token-error-correct-3.rs b/src/test/compile-fail/token-error-correct-3.rs deleted file mode 100644 index 5f21bf18d7b..00000000000 --- a/src/test/compile-fail/token-error-correct-3.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that we do some basic error correcton in the tokeniser (and don't spew -// too many bogus errors). - -pub mod raw { - use std::{io, fs}; - use std::path::Path; - - pub fn ensure_dir_exists<P: AsRef<Path>, F: FnOnce(&Path)>(path: P, - callback: F) - -> io::Result<bool> { - if !is_directory(path.as_ref()) { //~ ERROR: unresolved name `is_directory` - //~| NOTE unresolved name - callback(path.as_ref(); //~ NOTE: unclosed delimiter - //~^ ERROR: expected one of - fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types - //~^ expected (), found enum `std::result::Result` - //~| expected type `()` - //~| found type `std::result::Result<bool, std::io::Error>` - } else { //~ ERROR: incorrect close delimiter: `}` - //~^ ERROR: expected one of - Ok(false); - } - - panic!(); - } -} - -fn main() {} diff --git a/src/test/compile-fail/token-error-correct.rs b/src/test/compile-fail/token-error-correct.rs deleted file mode 100644 index 3ba9edda07f..00000000000 --- a/src/test/compile-fail/token-error-correct.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that we do some basic error correcton in the tokeniser. - -fn main() { - foo(bar(; //~ NOTE: unclosed delimiter - //~^ NOTE: unclosed delimiter - //~^^ ERROR: expected expression, found `;` - //~^^^ ERROR: unresolved name `bar` - //~^^^^ ERROR: unresolved name `foo` - //~^^^^^ ERROR: expected one of `)`, `,`, `.`, `<`, `?` - //~| NOTE unresolved name - //~| NOTE unresolved name -} //~ ERROR: incorrect close delimiter: `}` -//~^ ERROR: incorrect close delimiter: `}` -//~^^ ERROR: expected expression, found `)` diff --git a/src/test/compile-fail/ufcs-partially-resolved.rs b/src/test/compile-fail/ufcs-partially-resolved.rs new file mode 100644 index 00000000000..5337272343b --- /dev/null +++ b/src/test/compile-fail/ufcs-partially-resolved.rs @@ -0,0 +1,66 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(associated_type_defaults)] + +trait Tr { + type Y = u16; + fn Y() {} +} +impl Tr for u8 {} + +trait Dr { + type X = u16; + fn Z() {} +} +impl Dr for u8 {} + +enum E { Y } +type A = u32; + +fn main() { + let _: <u8 as Tr>::N; //~ ERROR unresolved associated type `Tr::N` + let _: <u8 as E>::N; //~ ERROR unresolved associated type `E::N` + let _: <u8 as A>::N; //~ ERROR unresolved associated type `A::N` + <u8 as Tr>::N; //~ ERROR unresolved method or associated constant `Tr::N` + <u8 as E>::N; //~ ERROR unresolved method or associated constant `E::N` + <u8 as A>::N; //~ ERROR unresolved method or associated constant `A::N` + let _: <u8 as Tr>::Y; // OK + let _: <u8 as E>::Y; //~ ERROR expected associated type, found variant `E::Y` + <u8 as Tr>::Y; // OK + <u8 as E>::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y` + + let _: <u8 as Tr>::N::NN; //~ ERROR unresolved associated type `Tr::N` + let _: <u8 as E>::N::NN; //~ ERROR unresolved associated type `E::N` + let _: <u8 as A>::N::NN; //~ ERROR unresolved associated type `A::N` + <u8 as Tr>::N::NN; //~ ERROR unresolved associated type `Tr::N` + <u8 as E>::N::NN; //~ ERROR unresolved associated type `E::N` + <u8 as A>::N::NN; //~ ERROR unresolved associated type `A::N` + let _: <u8 as Tr>::Y::NN; //~ ERROR ambiguous associated type + let _: <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y` + <u8 as Tr>::Y::NN; //~ ERROR no associated item named `NN` found for type `<u8 as Tr>::Y` + <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y` + + let _: <u8 as Tr::N>::NN; //~ ERROR unresolved associated type `Tr::N::NN` + let _: <u8 as E::N>::NN; //~ ERROR unresolved associated type `E::N::NN` + let _: <u8 as A::N>::NN; //~ ERROR unresolved associated type `A::N::NN` + <u8 as Tr::N>::NN; //~ ERROR unresolved method or associated constant `Tr::N::NN` + <u8 as E::N>::NN; //~ ERROR unresolved method or associated constant `E::N::NN` + <u8 as A::N>::NN; //~ ERROR unresolved method or associated constant `A::N::NN` + let _: <u8 as Tr::Y>::NN; //~ ERROR unresolved associated type `Tr::Y::NN` + let _: <u8 as E::Y>::NN; //~ ERROR unresolved associated type `E::Y::NN` + <u8 as Tr::Y>::NN; //~ ERROR unresolved method or associated constant `Tr::Y::NN` + <u8 as E::Y>::NN; //~ ERROR unresolved method or associated constant `E::Y::NN` + + let _: <u8 as Dr>::Z; //~ ERROR expected associated type, found method `Dr::Z` + <u8 as Dr>::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` + let _: <u8 as Dr>::Z::N; //~ ERROR expected associated type, found method `Dr::Z` + <u8 as Dr>::X::N; //~ ERROR no associated item named `N` found for type `<u8 as Dr>::X` +} diff --git a/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs b/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs deleted file mode 100644 index 465bddd060d..00000000000 --- a/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn f<F:Nonexist(isize) -> isize>(x: F) {} //~ ERROR trait `Nonexist` is not in scope - -type Typedef = isize; - -fn g<F:Typedef(isize) -> isize>(x: F) {} //~ ERROR `Typedef` is not a trait - -fn main() {} diff --git a/src/test/compile-fail/variant-used-as-type.rs b/src/test/compile-fail/variant-used-as-type.rs index 73defa6eef9..c889b7d28f8 100644 --- a/src/test/compile-fail/variant-used-as-type.rs +++ b/src/test/compile-fail/variant-used-as-type.rs @@ -15,7 +15,7 @@ enum Ty { A, B(Ty::A), - //~^ ERROR: found value `Ty::A` used as a type + //~^ ERROR expected type, found variant `Ty::A` } @@ -25,6 +25,6 @@ enum E { } impl E::A {} -//~^ ERROR: found value `E::A` used as a type +//~^ ERROR expected type, found variant `E::A` fn main() {} diff --git a/src/test/compile-fail/xcrate-unit-struct.rs b/src/test/compile-fail/xcrate-unit-struct.rs index 214a2a371ba..04af7133000 100644 --- a/src/test/compile-fail/xcrate-unit-struct.rs +++ b/src/test/compile-fail/xcrate-unit-struct.rs @@ -17,6 +17,6 @@ extern crate xcrate_unit_struct; fn main() { let _ = xcrate_unit_struct::StructWithFields; - //~^ ERROR: `xcrate_unit_struct::StructWithFields` is the name of a struct or struct variant + //~^ ERROR expected value, found struct `xcrate_unit_struct::StructWithFields` let _ = xcrate_unit_struct::Struct; } |
