diff options
| author | bors <bors@rust-lang.org> | 2023-10-23 09:59:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-23 09:59:40 +0000 |
| commit | a56bd2b944aed6b4a0507cc1870fb4c86d08e48e (patch) | |
| tree | 93fef0ff5217a7dc9b4c2d90affc5e1510c5427c /tests | |
| parent | 6bb4ad6dfb7d373c2f19b6cc8c0f05bd73f6d3cc (diff) | |
| parent | fe8ebb1890574a713bc8ee7cd5cc6cde54989b55 (diff) | |
| download | rust-a56bd2b944aed6b4a0507cc1870fb4c86d08e48e.tar.gz rust-a56bd2b944aed6b4a0507cc1870fb4c86d08e48e.zip | |
Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillot
Avoid a `track_errors` by bubbling up most errors from `check_well_formed` I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them. This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`) cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
Diffstat (limited to 'tests')
25 files changed, 142 insertions, 168 deletions
diff --git a/tests/ui/associated-consts/issue-105330.rs b/tests/ui/associated-consts/issue-105330.rs index 86e45f10b0e..285e89cce49 100644 --- a/tests/ui/associated-consts/issue-105330.rs +++ b/tests/ui/associated-consts/issue-105330.rs @@ -9,13 +9,10 @@ impl TraitWAssocConst for impl Demo { //~ ERROR E0404 } fn foo<A: TraitWAssocConst<A=32>>() { //~ ERROR E0658 - foo::<Demo>()(); //~ ERROR E0271 - //~^ ERROR E0618 - //~| ERROR E0277 + foo::<Demo>()(); } -fn main<A: TraitWAssocConst<A=32>>() { //~ ERROR E0131 +fn main<A: TraitWAssocConst<A=32>>() { //~^ ERROR E0658 - foo::<Demo>(); //~ ERROR E0277 - //~^ ERROR E0271 + foo::<Demo>(); } diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr index 200856caa25..55207909f7a 100644 --- a/tests/ui/associated-consts/issue-105330.stderr +++ b/tests/ui/associated-consts/issue-105330.stderr @@ -25,7 +25,7 @@ LL | fn foo<A: TraitWAssocConst<A=32>>() { = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable error[E0658]: associated const equality is incomplete - --> $DIR/issue-105330.rs:17:29 + --> $DIR/issue-105330.rs:15:29 | LL | fn main<A: TraitWAssocConst<A=32>>() { | ^^^^ @@ -39,85 +39,7 @@ error[E0562]: `impl Trait` only allowed in function and inherent method argument LL | impl TraitWAssocConst for impl Demo { | ^^^^^^^^^ -error[E0131]: `main` function is not allowed to have generic parameters - --> $DIR/issue-105330.rs:17:8 - | -LL | fn main<A: TraitWAssocConst<A=32>>() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` cannot have generic parameters - -error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied - --> $DIR/issue-105330.rs:12:11 - | -LL | foo::<Demo>()(); - | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` - | -help: this trait has no implementations, consider adding one - --> $DIR/issue-105330.rs:1:1 - | -LL | pub trait TraitWAssocConst { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `foo` - --> $DIR/issue-105330.rs:11:11 - | -LL | fn foo<A: TraitWAssocConst<A=32>>() { - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` - -error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32` - --> $DIR/issue-105330.rs:12:11 - | -LL | foo::<Demo>()(); - | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A` - | - = note: expected constant `32` - found constant `<Demo as TraitWAssocConst>::A` -note: required by a bound in `foo` - --> $DIR/issue-105330.rs:11:28 - | -LL | fn foo<A: TraitWAssocConst<A=32>>() { - | ^^^^ required by this bound in `foo` - -error[E0618]: expected function, found `()` - --> $DIR/issue-105330.rs:12:5 - | -LL | fn foo<A: TraitWAssocConst<A=32>>() { - | ----------------------------------- `foo::<Demo>` defined here returns `()` -LL | foo::<Demo>()(); - | ^^^^^^^^^^^^^-- - | | - | call expression requires function - -error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied - --> $DIR/issue-105330.rs:19:11 - | -LL | foo::<Demo>(); - | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` - | -help: this trait has no implementations, consider adding one - --> $DIR/issue-105330.rs:1:1 - | -LL | pub trait TraitWAssocConst { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `foo` - --> $DIR/issue-105330.rs:11:11 - | -LL | fn foo<A: TraitWAssocConst<A=32>>() { - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` - -error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32` - --> $DIR/issue-105330.rs:19:11 - | -LL | foo::<Demo>(); - | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A` - | - = note: expected constant `32` - found constant `<Demo as TraitWAssocConst>::A` -note: required by a bound in `foo` - --> $DIR/issue-105330.rs:11:28 - | -LL | fn foo<A: TraitWAssocConst<A=32>>() { - | ^^^^ required by this bound in `foo` - -error: aborting due to 11 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0131, E0271, E0277, E0404, E0562, E0618, E0658. -For more information about an error, try `rustc --explain E0131`. +Some errors have detailed explanations: E0404, E0562, E0658. +For more information about an error, try `rustc --explain E0404`. diff --git a/tests/ui/associated-consts/issue-58022.rs b/tests/ui/associated-consts/issue-58022.rs index 2a8a1eaa6d3..8e2a441f239 100644 --- a/tests/ui/associated-consts/issue-58022.rs +++ b/tests/ui/associated-consts/issue-58022.rs @@ -11,6 +11,7 @@ impl Bar<[u8]> { const SIZE: usize = 32; fn new(slice: &[u8; Self::SIZE]) -> Self { + //~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time Foo(Box::new(*slice)) //~^ ERROR: expected function, tuple struct or tuple variant, found trait `Foo` } diff --git a/tests/ui/associated-consts/issue-58022.stderr b/tests/ui/associated-consts/issue-58022.stderr index 56d85c066a8..82cbc9ed3b0 100644 --- a/tests/ui/associated-consts/issue-58022.stderr +++ b/tests/ui/associated-consts/issue-58022.stderr @@ -7,13 +7,27 @@ LL | LL | fn new(slice: &[u8; Foo::SIZE]) -> Self; | ^^^^^^^^^ cannot refer to the associated constant of trait +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/issue-58022.rs:13:41 + | +LL | fn new(slice: &[u8; Self::SIZE]) -> Self { + | ^^^^ doesn't have a size known at compile-time + | + = help: within `Bar<[u8]>`, the trait `Sized` is not implemented for `[u8]` +note: required because it appears within the type `Bar<[u8]>` + --> $DIR/issue-58022.rs:8:12 + | +LL | pub struct Bar<T: ?Sized>(T); + | ^^^ + = note: the return type of a function must have a statically known size + error[E0423]: expected function, tuple struct or tuple variant, found trait `Foo` - --> $DIR/issue-58022.rs:14:9 + --> $DIR/issue-58022.rs:15:9 | LL | Foo(Box::new(*slice)) | ^^^ not a function, tuple struct or tuple variant -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0423, E0790. -For more information about an error, try `rustc --explain E0423`. +Some errors have detailed explanations: E0277, E0423, E0790. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-66312.rs b/tests/ui/async-await/issue-66312.rs index 9224971ecb1..fbc58697d48 100644 --- a/tests/ui/async-await/issue-66312.rs +++ b/tests/ui/async-await/issue-66312.rs @@ -6,7 +6,7 @@ trait Test<T> { async fn f() { let x = Some(2); - if x.is_some() { + if x.is_some() { //~ ERROR mismatched types println!("Some"); } } diff --git a/tests/ui/async-await/issue-66312.stderr b/tests/ui/async-await/issue-66312.stderr index 80d294a10a0..dad5807cb50 100644 --- a/tests/ui/async-await/issue-66312.stderr +++ b/tests/ui/async-await/issue-66312.stderr @@ -7,6 +7,13 @@ LL | fn is_some(self: T); = note: type of `self` must be `Self` or a type that dereferences to it = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) -error: aborting due to previous error +error[E0308]: mismatched types + --> $DIR/issue-66312.rs:9:8 + | +LL | if x.is_some() { + | ^^^^^^^^^^^ expected `bool`, found `()` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0307`. +Some errors have detailed explanations: E0307, E0308. +For more information about an error, try `rustc --explain E0307`. diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs index 29aa0f59d74..c254b4ee09d 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs @@ -15,7 +15,7 @@ fn bad_infer_fn<_>() {} fn main() { - let a: All<_, _, _>; + let a: All<_, _, _>; //~ ERROR struct takes 2 generic arguments but 3 all_fn(); let v: [u8; _]; let v: [u8; 10] = [0; _]; diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr index e6d0c743d01..a6b736261e0 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr @@ -19,6 +19,21 @@ LL | struct BadInfer<_>; = help: consider removing `_`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `_` to be a const parameter, use `const _: usize` instead -error: aborting due to 3 previous errors +error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supplied + --> $DIR/infer-arg-test.rs:18:10 + | +LL | let a: All<_, _, _>; + | ^^^ - help: remove this generic argument + | | + | expected 2 generic arguments + | +note: struct defined here, with 2 generic parameters: `T`, `N` + --> $DIR/infer-arg-test.rs:3:8 + | +LL | struct All<'a, T, const N: usize> { + | ^^^ - -------------- + +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0392`. +Some errors have detailed explanations: E0107, E0392. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/consts/issue-39974.rs b/tests/ui/consts/issue-39974.rs index 503647ef4a8..9cb180014b8 100644 --- a/tests/ui/consts/issue-39974.rs +++ b/tests/ui/consts/issue-39974.rs @@ -1,4 +1,5 @@ const LENGTH: f64 = 2; +//~^ ERROR mismatched types struct Thing { f: [[f64; 2]; LENGTH], diff --git a/tests/ui/consts/issue-39974.stderr b/tests/ui/consts/issue-39974.stderr index 56365e51e0a..4bde599039e 100644 --- a/tests/ui/consts/issue-39974.stderr +++ b/tests/ui/consts/issue-39974.stderr @@ -1,9 +1,18 @@ error[E0308]: mismatched types - --> $DIR/issue-39974.rs:4:19 + --> $DIR/issue-39974.rs:5:19 | LL | f: [[f64; 2]; LENGTH], | ^^^^^^ expected `usize`, found `f64` -error: aborting due to previous error +error[E0308]: mismatched types + --> $DIR/issue-39974.rs:1:21 + | +LL | const LENGTH: f64 = 2; + | ^ + | | + | expected `f64`, found integer + | help: use a float literal: `2.0` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/generic-associated-types/issue-86787.rs b/tests/ui/generic-associated-types/issue-86787.rs index 96075ca503d..5edd0a9f02f 100644 --- a/tests/ui/generic-associated-types/issue-86787.rs +++ b/tests/ui/generic-associated-types/issue-86787.rs @@ -22,8 +22,8 @@ where type T = Either<Left::T, Right::T>; type TRef<'a> = Either<&'a Left::T, &'a Right::T> where - <Left as HasChildrenOf>::T: 'a, - <Right as HasChildrenOf>::T: 'a; + <Left as HasChildrenOf>::T: 'a, //~ ERROR impl has stricter requirements than trait + <Right as HasChildrenOf>::T: 'a; //~ ERROR impl has stricter requirements than trait fn ref_children<'a>(&'a self) -> Vec<Self::TRef<'a>> { todo!() diff --git a/tests/ui/generic-associated-types/issue-86787.stderr b/tests/ui/generic-associated-types/issue-86787.stderr index f34c63cf72e..00795abbd05 100644 --- a/tests/ui/generic-associated-types/issue-86787.stderr +++ b/tests/ui/generic-associated-types/issue-86787.stderr @@ -9,5 +9,24 @@ LL | type TRef<'a>; = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information -error: aborting due to previous error +error[E0276]: impl has stricter requirements than trait + --> $DIR/issue-86787.rs:25:37 + | +LL | type TRef<'a>; + | ------------- definition of `TRef` from trait +... +LL | <Left as HasChildrenOf>::T: 'a, + | ^^ impl has extra requirement `<Left as HasChildrenOf>::T: 'a` + +error[E0276]: impl has stricter requirements than trait + --> $DIR/issue-86787.rs:26:38 + | +LL | type TRef<'a>; + | ------------- definition of `TRef` from trait +... +LL | <Right as HasChildrenOf>::T: 'a; + | ^^ impl has extra requirement `<Right as HasChildrenOf>::T: 'a` + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0276`. diff --git a/tests/ui/inference/issue-107090.rs b/tests/ui/inference/issue-107090.rs index a22e12c6d88..799c3641833 100644 --- a/tests/ui/inference/issue-107090.rs +++ b/tests/ui/inference/issue-107090.rs @@ -2,8 +2,8 @@ use std::marker::PhantomData; struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) where Foo<'short, 'out, T>: Convert<'a, 'b>; - //~^ ERROR use of undeclared lifetime name - //~| ERROR use of undeclared lifetime name `'out` +//~^ ERROR use of undeclared lifetime name +//~| ERROR use of undeclared lifetime name `'out` trait Convert<'a, 'b>: Sized { fn cast(&'a self) -> &'b Self; @@ -19,7 +19,7 @@ impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { //~^ ERROR use of undeclared lifetime name - sadness.cast() //~ ERROR mismatched types + sadness.cast() } fn main() {} diff --git a/tests/ui/inference/issue-107090.stderr b/tests/ui/inference/issue-107090.stderr index 55825f7765b..e509e262fb1 100644 --- a/tests/ui/inference/issue-107090.stderr +++ b/tests/ui/inference/issue-107090.stderr @@ -66,19 +66,6 @@ LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, | | | help: consider introducing lifetime `'short` here: `'short,` -error[E0308]: mismatched types - --> $DIR/issue-107090.rs:22:5 - | -LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { - | - expected this type parameter ------- expected `&'out T` because of return type -LL | -LL | sadness.cast() - | ^^^^^^^^^^^^^^ expected `&T`, found `&Foo<'_, '_, T>` - | - = note: expected reference `&'out T` - found reference `&Foo<'_, '_, T>` - -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors -Some errors have detailed explanations: E0261, E0308. -For more information about an error, try `rustc --explain E0261`. +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/infinite/infinite-struct.stderr b/tests/ui/infinite/infinite-struct.stderr index b6c72b1de46..82d147b63cd 100644 --- a/tests/ui/infinite/infinite-struct.stderr +++ b/tests/ui/infinite/infinite-struct.stderr @@ -22,6 +22,10 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle LL | x: Bar<Box<Foo>>, | ++++ + -error: aborting due to 2 previous errors +error: reached the recursion limit finding the struct tail for `Take` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0072`. diff --git a/tests/ui/issues/issue-77919.rs b/tests/ui/issues/issue-77919.rs index 966d76d148a..3cbf493afb8 100644 --- a/tests/ui/issues/issue-77919.rs +++ b/tests/ui/issues/issue-77919.rs @@ -10,4 +10,3 @@ struct Multiply<N, M> { } impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} //~^ ERROR cannot find type `VAL` in this scope -//~| ERROR not all trait items implemented, missing: `VAL` diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/issues/issue-77919.stderr index dbbe70ff069..9d2f859e05a 100644 --- a/tests/ui/issues/issue-77919.stderr +++ b/tests/ui/issues/issue-77919.stderr @@ -20,16 +20,6 @@ help: you might be missing a type parameter LL | impl<N, M, VAL> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} | +++++ -error[E0046]: not all trait items implemented, missing: `VAL` - --> $DIR/issue-77919.rs:11:1 - | -LL | const VAL: T; - | ------------ `VAL` from trait -... -LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0046, E0412. -For more information about an error, try `rustc --explain E0046`. +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/layout/cannot-transmute-unnormalizable-type.rs b/tests/ui/layout/cannot-transmute-unnormalizable-type.rs index d2b6e1d8eba..1a2ff8c4705 100644 --- a/tests/ui/layout/cannot-transmute-unnormalizable-type.rs +++ b/tests/ui/layout/cannot-transmute-unnormalizable-type.rs @@ -16,7 +16,8 @@ struct Other { fn main() { unsafe { + // FIXME(oli-obk): make this report a transmute error again. std::mem::transmute::<Option<()>, Option<&Other>>(None); - //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types + //^ ERROR cannot transmute between types of different sizes, or dependently-sized types } } diff --git a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr index dd5119318ff..ee2c5ab7e39 100644 --- a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr +++ b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr @@ -4,16 +4,6 @@ error[E0412]: cannot find type `Missing` in this scope LL | Missing: Trait, | ^^^^^^^ not found in this scope -error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/cannot-transmute-unnormalizable-type.rs:19:9 - | -LL | std::mem::transmute::<Option<()>, Option<&Other>>(None); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: source type: `Option<()>` (8 bits) - = note: target type: `Option<&Other>` (unable to determine layout for `Other` because `<() as Trait>::RefTarget` cannot be normalized) - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0412, E0512. -For more information about an error, try `rustc --explain E0412`. +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs index 9eeee195e56..f1238ec240f 100644 --- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs +++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs @@ -5,5 +5,9 @@ fn f2<'a>(x: u8, y: Vec<&'a ...>) {} //~^ ERROR C-variadic type `...` may not be nested inside another type fn main() { - let _recovery_witness: () = 0; //~ ERROR mismatched types + // While this is an error, wf-checks happen before typeck, and if any wf-checks + // encountered errors, we do not continue to typeck, even if the items are + // unrelated. + // FIXME(oli-obk): make this report a type mismatch again. + let _recovery_witness: () = 0; } diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr index 8b9d676a45d..7ca6a6d1bbf 100644 --- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr +++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr @@ -10,15 +10,6 @@ error[E0743]: C-variadic type `...` may not be nested inside another type LL | fn f2<'a>(x: u8, y: Vec<&'a ...>) {} | ^^^ -error[E0308]: mismatched types - --> $DIR/variadic-ffi-nested-syntactic-fail.rs:8:33 - | -LL | let _recovery_witness: () = 0; - | -- ^ expected `()`, found integer - | | - | expected due to this - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0308, E0743. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0743`. diff --git a/tests/ui/self/self_type_keyword.rs b/tests/ui/self/self_type_keyword.rs index b42bf8eea1a..96d24715edb 100644 --- a/tests/ui/self/self_type_keyword.rs +++ b/tests/ui/self/self_type_keyword.rs @@ -22,6 +22,8 @@ pub fn main() { //~^ ERROR cannot find macro `Self` in this scope Foo { Self } => (), //~^ ERROR expected identifier, found keyword `Self` + //~| ERROR mismatched types + //~| ERROR `Foo` does not have a field named `Self` } } diff --git a/tests/ui/self/self_type_keyword.stderr b/tests/ui/self/self_type_keyword.stderr index aca08d81163..6e65fae808d 100644 --- a/tests/ui/self/self_type_keyword.stderr +++ b/tests/ui/self/self_type_keyword.stderr @@ -31,19 +31,19 @@ LL | Foo { Self } => (), | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:29:26 + --> $DIR/self_type_keyword.rs:31:26 | LL | extern crate core as Self; | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:34:32 + --> $DIR/self_type_keyword.rs:36:32 | LL | use std::option::Option as Self; | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:39:11 + --> $DIR/self_type_keyword.rs:41:11 | LL | trait Self {} | ^^^^ expected identifier, found keyword @@ -80,7 +80,22 @@ LL | struct Bar<'Self>; | = help: consider removing `'Self`, referring to it in a field, or using a marker such as `PhantomData` -error: aborting due to 12 previous errors +error[E0308]: mismatched types + --> $DIR/self_type_keyword.rs:23:9 + | +LL | match 15 { + | -- this expression has type `{integer}` +... +LL | Foo { Self } => (), + | ^^^^^^^^^^^^ expected integer, found `Foo` + +error[E0026]: struct `Foo` does not have a field named `Self` + --> $DIR/self_type_keyword.rs:23:15 + | +LL | Foo { Self } => (), + | ^^^^ struct `Foo` does not have this field + +error: aborting due to 14 previous errors -Some errors have detailed explanations: E0392, E0531. -For more information about an error, try `rustc --explain E0392`. +Some errors have detailed explanations: E0026, E0308, E0392, E0531. +For more information about an error, try `rustc --explain E0026`. diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs index a1b9a7eba4d..193544ebd3f 100644 --- a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs +++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs @@ -5,7 +5,7 @@ trait Trait { - fn func<const N: u32>() -> [ (); N ]; + fn func<const N: u32>() -> [ (); N ]; //~ ERROR mismatched types } struct S {} diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr index 9843651b1e6..16aaf0615ed 100644 --- a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr +++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr @@ -4,6 +4,12 @@ error[E0308]: mismatched types LL | fn func<const N: u32>() -> [ (); { () }] { | ^^ expected `usize`, found `()` -error: aborting due to previous error +error[E0308]: mismatched types + --> $DIR/const-in-impl-fn-return-type.rs:8:38 + | +LL | fn func<const N: u32>() -> [ (); N ]; + | ^ expected `usize`, found `u32` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. |
