summaryrefslogtreecommitdiffstats
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0040.stderr10
-rw-r--r--tests/ui/error-codes/E0054.stderr9
-rw-r--r--tests/ui/error-codes/E0094.rs2
-rw-r--r--tests/ui/error-codes/E0132.stderr4
-rw-r--r--tests/ui/error-codes/E0220.stderr2
-rw-r--r--tests/ui/error-codes/E0277.stderr5
-rw-r--r--tests/ui/error-codes/E0308.stderr8
-rw-r--r--tests/ui/error-codes/E0374.stderr4
-rw-r--r--tests/ui/error-codes/E0377.stderr4
-rw-r--r--tests/ui/error-codes/E0401.stderr22
-rw-r--r--tests/ui/error-codes/E0445.rs23
-rw-r--r--tests/ui/error-codes/E0445.stderr71
-rw-r--r--tests/ui/error-codes/E0446.rs15
-rw-r--r--tests/ui/error-codes/E0446.stderr23
-rw-r--r--tests/ui/error-codes/E0602.rs2
-rw-r--r--tests/ui/error-codes/E0602.stderr11
-rw-r--r--tests/ui/error-codes/E0609-private-method.rs16
-rw-r--r--tests/ui/error-codes/E0609-private-method.stderr9
-rw-r--r--tests/ui/error-codes/E0647.stderr4
-rw-r--r--tests/ui/error-codes/E0767.stderr2
20 files changed, 107 insertions, 139 deletions
diff --git a/tests/ui/error-codes/E0040.stderr b/tests/ui/error-codes/E0040.stderr
index 9fcda1a93..839be79d2 100644
--- a/tests/ui/error-codes/E0040.stderr
+++ b/tests/ui/error-codes/E0040.stderr
@@ -2,10 +2,12 @@ error[E0040]: explicit use of destructor method
--> $DIR/E0040.rs:16:7
|
LL | x.drop();
- | --^^^^--
- | | |
- | | explicit destructor calls not allowed
- | help: consider using `drop` function: `drop(x)`
+ | ^^^^ explicit destructor calls not allowed
+ |
+help: consider using `drop` function
+ |
+LL | drop(x);
+ | +++++ ~
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0054.stderr b/tests/ui/error-codes/E0054.stderr
index 6b1092760..0a4adabba 100644
--- a/tests/ui/error-codes/E0054.stderr
+++ b/tests/ui/error-codes/E0054.stderr
@@ -1,8 +1,13 @@
-error[E0054]: cannot cast as `bool`
+error[E0054]: cannot cast `i32` as `bool`
--> $DIR/E0054.rs:3:24
|
LL | let x_is_nonzero = x as bool;
- | ^^^^^^^^^ help: compare with zero instead: `x != 0`
+ | ^^^^^^^^^
+ |
+help: compare with zero instead
+ |
+LL | let x_is_nonzero = x != 0;
+ | ~~~~
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0094.rs b/tests/ui/error-codes/E0094.rs
index a2ec932c1..97ebcff99 100644
--- a/tests/ui/error-codes/E0094.rs
+++ b/tests/ui/error-codes/E0094.rs
@@ -1,4 +1,4 @@
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
extern "rust-intrinsic" {
#[rustc_safe_intrinsic]
diff --git a/tests/ui/error-codes/E0132.stderr b/tests/ui/error-codes/E0132.stderr
index c21363756..d4ddc07b5 100644
--- a/tests/ui/error-codes/E0132.stderr
+++ b/tests/ui/error-codes/E0132.stderr
@@ -1,8 +1,8 @@
-error[E0132]: start function is not allowed to have type parameters
+error[E0132]: `#[start]` function is not allowed to have type parameters
--> $DIR/E0132.rs:4:5
|
LL | fn f< T >() {}
- | ^^^^^ start function cannot have type parameters
+ | ^^^^^ `#[start]` function cannot have type parameters
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0220.stderr b/tests/ui/error-codes/E0220.stderr
index 11763ce78..e03eadaca 100644
--- a/tests/ui/error-codes/E0220.stderr
+++ b/tests/ui/error-codes/E0220.stderr
@@ -2,7 +2,7 @@ error[E0220]: associated type `F` not found for `Trait`
--> $DIR/E0220.rs:5:22
|
LL | type Foo = dyn Trait<F=i32>;
- | ^ associated type `F` not found
+ | ^ help: `Trait` has the following associated type: `Bar`
error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must be specified
--> $DIR/E0220.rs:5:16
diff --git a/tests/ui/error-codes/E0277.stderr b/tests/ui/error-codes/E0277.stderr
index 440e43dff..0b0d2b097 100644
--- a/tests/ui/error-codes/E0277.stderr
+++ b/tests/ui/error-codes/E0277.stderr
@@ -21,6 +21,11 @@ LL | some_func(5i32);
| |
| required by a bound introduced by this call
|
+help: this trait has no implementations, consider adding one
+ --> $DIR/E0277.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
note: required by a bound in `some_func`
--> $DIR/E0277.rs:7:17
|
diff --git a/tests/ui/error-codes/E0308.stderr b/tests/ui/error-codes/E0308.stderr
index 187b775f9..141abed60 100644
--- a/tests/ui/error-codes/E0308.stderr
+++ b/tests/ui/error-codes/E0308.stderr
@@ -1,11 +1,11 @@
error[E0308]: intrinsic has wrong type
- --> $DIR/E0308.rs:6:5
+ --> $DIR/E0308.rs:6:20
|
LL | fn size_of<T>();
- | ^^^^^^^^^^^^^^^^ expected `()`, found `usize`
+ | ^ expected `usize`, found `()`
|
- = note: expected fn pointer `extern "rust-intrinsic" fn()`
- found fn pointer `extern "rust-intrinsic" fn() -> usize`
+ = note: expected signature `extern "rust-intrinsic" fn() -> usize`
+ found signature `extern "rust-intrinsic" fn()`
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0374.stderr b/tests/ui/error-codes/E0374.stderr
index 68e15e6f8..a77920430 100644
--- a/tests/ui/error-codes/E0374.stderr
+++ b/tests/ui/error-codes/E0374.stderr
@@ -1,8 +1,10 @@
-error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced, none found
+error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures
--> $DIR/E0374.rs:8:1
|
LL | impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: expected a single field to be coerced, none found
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0377.stderr b/tests/ui/error-codes/E0377.stderr
index bf7d8c8d3..664e499ec 100644
--- a/tests/ui/error-codes/E0377.stderr
+++ b/tests/ui/error-codes/E0377.stderr
@@ -1,8 +1,10 @@
-error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with the same definition; expected `Foo`, found `Bar`
+error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion between structures
--> $DIR/E0377.rs:12:1
|
LL | impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: expected coercion between the same definition; expected `Foo`, found `Bar`
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0401.stderr b/tests/ui/error-codes/E0401.stderr
index fa4b91cac..928c8d11d 100644
--- a/tests/ui/error-codes/E0401.stderr
+++ b/tests/ui/error-codes/E0401.stderr
@@ -1,26 +1,26 @@
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:4:39
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
LL | fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) {
- | - ^ use of generic parameter from outer function
+ | - ^ use of generic parameter from outer item
| |
- | help: try using a local generic parameter instead: `T,`
+ | help: try introducing a local generic parameter here: `T,`
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:9:16
|
LL | fn foo<T>(x: T) {
- | - type parameter from outer function
+ | - type parameter from outer item
...
LL | fn baz<U,
- | - help: try using a local generic parameter instead: `T,`
+ | - help: try introducing a local generic parameter here: `T,`
...
LL | (y: T) {
- | ^ use of generic parameter from outer function
+ | ^ use of generic parameter from outer item
-error[E0401]: can't use generic parameters from outer function
+error[E0401]: can't use generic parameters from outer item
--> $DIR/E0401.rs:24:25
|
LL | impl<T> Iterator for A<T> {
@@ -29,8 +29,8 @@ LL | impl<T> Iterator for A<T> {
LL | fn helper(sel: &Self) -> u8 {
| ^^^^
| |
- | use of generic parameter from outer function
- | use a type here instead
+ | use of generic parameter from outer item
+ | refer to the type directly here instead
error[E0282]: type annotations needed
--> $DIR/E0401.rs:11:5
diff --git a/tests/ui/error-codes/E0445.rs b/tests/ui/error-codes/E0445.rs
deleted file mode 100644
index 9f29c8167..000000000
--- a/tests/ui/error-codes/E0445.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-#![feature(type_privacy_lints)]
-#[warn(private_bounds)]
-#[warn(private_interfaces)]
-
-// In this test both old and new private-in-public diagnostic were emitted.
-// Old diagnostic will be deleted soon.
-// See https://rust-lang.github.io/rfcs/2145-type-privacy.html.
-
-trait Foo {
- fn dummy(&self) { }
-}
-
-pub trait Bar : Foo {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `Bar`
-pub struct Bar2<T: Foo>(pub T);
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `Bar2`
-pub fn foo<T: Foo> (t: T) {}
-//~^ ERROR private trait `Foo` in public interface [E0445]
-//~| WARNING trait `Foo` is more private than the item `foo`
-
-fn main() {}
diff --git a/tests/ui/error-codes/E0445.stderr b/tests/ui/error-codes/E0445.stderr
deleted file mode 100644
index 4f940868f..000000000
--- a/tests/ui/error-codes/E0445.stderr
+++ /dev/null
@@ -1,71 +0,0 @@
-error[E0445]: private trait `Foo` in public interface
- --> $DIR/E0445.rs:13:1
- |
-LL | trait Foo {
- | --------- `Foo` declared as private
-...
-LL | pub trait Bar : Foo {}
- | ^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `Bar`
- --> $DIR/E0445.rs:13:1
- |
-LL | pub trait Bar : Foo {}
- | ^^^^^^^^^^^^^^^^^^^ trait `Bar` is reachable at visibility `pub`
- |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
- --> $DIR/E0445.rs:9:1
- |
-LL | trait Foo {
- | ^^^^^^^^^
-note: the lint level is defined here
- --> $DIR/E0445.rs:2:8
- |
-LL | #[warn(private_bounds)]
- | ^^^^^^^^^^^^^^
-
-error[E0445]: private trait `Foo` in public interface
- --> $DIR/E0445.rs:16:1
- |
-LL | trait Foo {
- | --------- `Foo` declared as private
-...
-LL | pub struct Bar2<T: Foo>(pub T);
- | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `Bar2`
- --> $DIR/E0445.rs:16:1
- |
-LL | pub struct Bar2<T: Foo>(pub T);
- | ^^^^^^^^^^^^^^^^^^^^^^^ struct `Bar2` is reachable at visibility `pub`
- |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
- --> $DIR/E0445.rs:9:1
- |
-LL | trait Foo {
- | ^^^^^^^^^
-
-error[E0445]: private trait `Foo` in public interface
- --> $DIR/E0445.rs:19:1
- |
-LL | trait Foo {
- | --------- `Foo` declared as private
-...
-LL | pub fn foo<T: Foo> (t: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
-
-warning: trait `Foo` is more private than the item `foo`
- --> $DIR/E0445.rs:19:1
- |
-LL | pub fn foo<T: Foo> (t: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub`
- |
-note: but trait `Foo` is only usable at visibility `pub(crate)`
- --> $DIR/E0445.rs:9:1
- |
-LL | trait Foo {
- | ^^^^^^^^^
-
-error: aborting due to 3 previous errors; 3 warnings emitted
-
-For more information about this error, try `rustc --explain E0445`.
diff --git a/tests/ui/error-codes/E0446.rs b/tests/ui/error-codes/E0446.rs
index f61c7e546..6d6c4f97c 100644
--- a/tests/ui/error-codes/E0446.rs
+++ b/tests/ui/error-codes/E0446.rs
@@ -1,9 +1,14 @@
-mod foo {
- struct Bar(u32);
+struct Bar;
+trait PrivTr {}
- pub fn bar() -> Bar { //~ ERROR E0446
- Bar(0)
- }
+pub trait PubTr {
+ type Alias1;
+ type Alias2;
+}
+
+impl PubTr for u8 {
+ type Alias1 = Bar; //~ ERROR E0446
+ type Alias2 = Box<dyn PrivTr>; //~ ERROR E0446
}
fn main() {}
diff --git a/tests/ui/error-codes/E0446.stderr b/tests/ui/error-codes/E0446.stderr
index b6a195c40..2951e69d1 100644
--- a/tests/ui/error-codes/E0446.stderr
+++ b/tests/ui/error-codes/E0446.stderr
@@ -1,12 +1,21 @@
error[E0446]: private type `Bar` in public interface
- --> $DIR/E0446.rs:4:5
+ --> $DIR/E0446.rs:10:5
|
-LL | struct Bar(u32);
- | ---------- `Bar` declared as private
-LL |
-LL | pub fn bar() -> Bar {
- | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+LL | struct Bar;
+ | ---------- `Bar` declared as private
+...
+LL | type Alias1 = Bar;
+ | ^^^^^^^^^^^ can't leak private type
-error: aborting due to previous error
+error[E0446]: private trait `PrivTr` in public interface
+ --> $DIR/E0446.rs:11:5
+ |
+LL | trait PrivTr {}
+ | ------------ `PrivTr` declared as private
+...
+LL | type Alias2 = Box<dyn PrivTr>;
+ | ^^^^^^^^^^^ can't leak private trait
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0446`.
diff --git a/tests/ui/error-codes/E0602.rs b/tests/ui/error-codes/E0602.rs
index 8fadce526..77d28838a 100644
--- a/tests/ui/error-codes/E0602.rs
+++ b/tests/ui/error-codes/E0602.rs
@@ -1,6 +1,8 @@
// compile-flags:-D bogus
+// check-pass
// error-pattern:E0602
// error-pattern:requested on the command line with `-D bogus`
+// error-pattern:`#[warn(unknown_lints)]` on by default
fn main() {}
diff --git a/tests/ui/error-codes/E0602.stderr b/tests/ui/error-codes/E0602.stderr
index 2b3722633..60ecec7cd 100644
--- a/tests/ui/error-codes/E0602.stderr
+++ b/tests/ui/error-codes/E0602.stderr
@@ -1,11 +1,16 @@
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: `#[warn(unknown_lints)]` on by default
-error[E0602]: unknown lint: `bogus`
+warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
-error: aborting due to 2 previous errors
+warning[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+warning: 3 warnings emitted
For more information about this error, try `rustc --explain E0602`.
diff --git a/tests/ui/error-codes/E0609-private-method.rs b/tests/ui/error-codes/E0609-private-method.rs
new file mode 100644
index 000000000..dfa97ad9a
--- /dev/null
+++ b/tests/ui/error-codes/E0609-private-method.rs
@@ -0,0 +1,16 @@
+// This error is an E0609 and *not* an E0615 because the fact that the method exists is not
+// relevant.
+mod foo {
+ pub struct Foo {
+ x: u32,
+ }
+
+ impl Foo {
+ fn method(&self) {}
+ }
+}
+
+fn main() {
+ let f = foo::Foo { x: 0 };
+ f.method; //~ ERROR E0609
+}
diff --git a/tests/ui/error-codes/E0609-private-method.stderr b/tests/ui/error-codes/E0609-private-method.stderr
new file mode 100644
index 000000000..d2a11e906
--- /dev/null
+++ b/tests/ui/error-codes/E0609-private-method.stderr
@@ -0,0 +1,9 @@
+error[E0609]: no field `method` on type `Foo`
+ --> $DIR/E0609-private-method.rs:15:7
+ |
+LL | f.method;
+ | ^^^^^^ unknown field
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/tests/ui/error-codes/E0647.stderr b/tests/ui/error-codes/E0647.stderr
index 08cedfaef..9d1ab9671 100644
--- a/tests/ui/error-codes/E0647.stderr
+++ b/tests/ui/error-codes/E0647.stderr
@@ -1,8 +1,8 @@
-error[E0647]: start function is not allowed to have a `where` clause
+error[E0647]: `#[start]` function is not allowed to have a `where` clause
--> $DIR/E0647.rs:7:50
|
LL | fn start(_: isize, _: *const *const u8) -> isize where (): Copy {
- | ^^^^^^^^^^^^^^ start function cannot have a `where` clause
+ | ^^^^^^^^^^^^^^ `#[start]` function cannot have a `where` clause
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0767.stderr b/tests/ui/error-codes/E0767.stderr
index ee8524730..4b09008f9 100644
--- a/tests/ui/error-codes/E0767.stderr
+++ b/tests/ui/error-codes/E0767.stderr
@@ -19,7 +19,7 @@ LL | | }
| |_________^ expected `()`, found closure
|
= note: expected unit type `()`
- found closure `[closure@$DIR/E0767.rs:3:9: 3:11]`
+ found closure `{closure@$DIR/E0767.rs:3:9: 3:11}`
error: aborting due to 2 previous errors