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/E0026-teach.stderr2
-rw-r--r--tests/ui/error-codes/E0277.stderr3
-rw-r--r--tests/ui/error-codes/E0389.stderr2
-rw-r--r--tests/ui/error-codes/E0719.rs1
-rw-r--r--tests/ui/error-codes/E0719.stderr12
-rw-r--r--tests/ui/error-codes/E0746.fixed18
-rw-r--r--tests/ui/error-codes/E0746.rs2
-rw-r--r--tests/ui/error-codes/E0746.stderr22
-rw-r--r--tests/ui/error-codes/E0771.rs2
-rw-r--r--tests/ui/error-codes/E0771.stderr8
10 files changed, 37 insertions, 35 deletions
diff --git a/tests/ui/error-codes/E0026-teach.stderr b/tests/ui/error-codes/E0026-teach.stderr
index 1a80edcbb..3d460490e 100644
--- a/tests/ui/error-codes/E0026-teach.stderr
+++ b/tests/ui/error-codes/E0026-teach.stderr
@@ -4,7 +4,7 @@ error[E0026]: struct `Thing` does not have a field named `z`
LL | Thing { x, y, z } => {}
| ^ struct `Thing` does not have this field
|
- = note: This error indicates that a struct pattern attempted to extract a non-existent field from a struct. Struct fields are identified by the name used before the colon : so struct patterns should resemble the declaration of the struct type being matched.
+ = note: This error indicates that a struct pattern attempted to extract a nonexistent field from a struct. Struct fields are identified by the name used before the colon : so struct patterns should resemble the declaration of the struct type being matched.
If you are using shorthand field patterns but want to refer to the struct field by a different name, you should rename it explicitly.
diff --git a/tests/ui/error-codes/E0277.stderr b/tests/ui/error-codes/E0277.stderr
index 2b4784d7e..440e43dff 100644
--- a/tests/ui/error-codes/E0277.stderr
+++ b/tests/ui/error-codes/E0277.stderr
@@ -5,7 +5,8 @@ LL | fn f(p: Path) { }
| ^ doesn't have a size known at compile-time
|
= help: within `Path`, the trait `Sized` is not implemented for `[u8]`
- = note: required because it appears within the type `Path`
+note: required because it appears within the type `Path`
+ --> $SRC_DIR/std/src/path.rs:LL:COL
= help: unsized fn params are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
|
diff --git a/tests/ui/error-codes/E0389.stderr b/tests/ui/error-codes/E0389.stderr
index 51c4c92ad..e4001856c 100644
--- a/tests/ui/error-codes/E0389.stderr
+++ b/tests/ui/error-codes/E0389.stderr
@@ -7,7 +7,7 @@ LL | fancy_ref.num = 6;
help: consider changing this to be a mutable reference
|
LL | let fancy_ref = &mut (&mut fancy);
- | ~~~~~~~~~~~~~~~~~
+ | +++
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0719.rs b/tests/ui/error-codes/E0719.rs
index 3311e1909..cbf1bb219 100644
--- a/tests/ui/error-codes/E0719.rs
+++ b/tests/ui/error-codes/E0719.rs
@@ -1,5 +1,6 @@
trait Foo: Iterator<Item = i32, Item = i32> {}
//~^ ERROR is already specified
+//~| ERROR is already specified
type Unit = ();
diff --git a/tests/ui/error-codes/E0719.stderr b/tests/ui/error-codes/E0719.stderr
index b342d6343..e302f406d 100644
--- a/tests/ui/error-codes/E0719.stderr
+++ b/tests/ui/error-codes/E0719.stderr
@@ -7,13 +7,21 @@ LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
- --> $DIR/E0719.rs:6:42
+ --> $DIR/E0719.rs:1:33
+ |
+LL | trait Foo: Iterator<Item = i32, Item = i32> {}
+ | ---------- ^^^^^^^^^^ re-bound here
+ | |
+ | `Item` bound here first
+
+error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+ --> $DIR/E0719.rs:7:42
|
LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
| --------- ^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0719`.
diff --git a/tests/ui/error-codes/E0746.fixed b/tests/ui/error-codes/E0746.fixed
deleted file mode 100644
index ca8319aa0..000000000
--- a/tests/ui/error-codes/E0746.fixed
+++ /dev/null
@@ -1,18 +0,0 @@
-// run-rustfix
-#![allow(dead_code)]
-struct Struct;
-trait Trait {}
-impl Trait for Struct {}
-impl Trait for u32 {}
-
-fn foo() -> impl Trait { Struct }
-//~^ ERROR E0746
-
-fn bar() -> impl Trait { //~ ERROR E0746
- if true {
- return 0;
- }
- 42
-}
-
-fn main() {}
diff --git a/tests/ui/error-codes/E0746.rs b/tests/ui/error-codes/E0746.rs
index bf5ba8fff..86b5b7444 100644
--- a/tests/ui/error-codes/E0746.rs
+++ b/tests/ui/error-codes/E0746.rs
@@ -1,5 +1,5 @@
-// run-rustfix
#![allow(dead_code)]
+
struct Struct;
trait Trait {}
impl Trait for Struct {}
diff --git a/tests/ui/error-codes/E0746.stderr b/tests/ui/error-codes/E0746.stderr
index 2153b59ad..9fe90ab7b 100644
--- a/tests/ui/error-codes/E0746.stderr
+++ b/tests/ui/error-codes/E0746.stderr
@@ -4,11 +4,14 @@ error[E0746]: return type cannot have an unboxed trait object
LL | fn foo() -> dyn Trait { Struct }
| ^^^^^^^^^ doesn't have a size known at compile-time
|
- = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
-help: use `impl Trait` as the return type, as all return paths are of type `Struct`, which implements `Trait`
+help: return an `impl Trait` instead of a `dyn Trait`, if all returned values are the same type
|
LL | fn foo() -> impl Trait { Struct }
- | ~~~~~~~~~~
+ | ~~~~
+help: box the return type, and wrap all of the returned values in `Box::new`
+ |
+LL | fn foo() -> Box<dyn Trait> { Box::new(Struct) }
+ | ++++ + +++++++++ +
error[E0746]: return type cannot have an unboxed trait object
--> $DIR/E0746.rs:11:13
@@ -16,11 +19,18 @@ error[E0746]: return type cannot have an unboxed trait object
LL | fn bar() -> dyn Trait {
| ^^^^^^^^^ doesn't have a size known at compile-time
|
- = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
-help: use `impl Trait` as the return type, as all return paths are of type `{integer}`, which implements `Trait`
+help: return an `impl Trait` instead of a `dyn Trait`, if all returned values are the same type
|
LL | fn bar() -> impl Trait {
- | ~~~~~~~~~~
+ | ~~~~
+help: box the return type, and wrap all of the returned values in `Box::new`
+ |
+LL ~ fn bar() -> Box<dyn Trait> {
+LL | if true {
+LL ~ return Box::new(0);
+LL | }
+LL ~ Box::new(42)
+ |
error: aborting due to 2 previous errors
diff --git a/tests/ui/error-codes/E0771.rs b/tests/ui/error-codes/E0771.rs
index 67e7d106a..c0a2e98a7 100644
--- a/tests/ui/error-codes/E0771.rs
+++ b/tests/ui/error-codes/E0771.rs
@@ -1,7 +1,7 @@
#![feature(adt_const_params)]
//~^ WARN the feature `adt_const_params` is incomplete
-fn function_with_str<'a, const STRING: &'a str>() {} //~ ERROR E0771
+fn function_with_str<'a, const STRING: &'a str>() {} //~ ERROR E0770
fn main() {
function_with_str::<"Hello, world!">()
diff --git a/tests/ui/error-codes/E0771.stderr b/tests/ui/error-codes/E0771.stderr
index b759399a9..9450c61c2 100644
--- a/tests/ui/error-codes/E0771.stderr
+++ b/tests/ui/error-codes/E0771.stderr
@@ -1,10 +1,10 @@
-error[E0771]: use of non-static lifetime `'a` in const generic
+error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/E0771.rs:4:41
|
LL | fn function_with_str<'a, const STRING: &'a str>() {}
- | ^^
+ | ^^ the type must not depend on the parameter `'a`
|
- = note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
+ = note: lifetime parameters may not be used in the type of const parameters
warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/E0771.rs:1:12
@@ -17,4 +17,4 @@ LL | #![feature(adt_const_params)]
error: aborting due to previous error; 1 warning emitted
-For more information about this error, try `rustc --explain E0771`.
+For more information about this error, try `rustc --explain E0770`.