Skip to content

Commit f3e56de

Browse files
committed
Avoid follow-up errors and ICEs after missing lifetime errors on data structures
1 parent 486bc27 commit f3e56de

21 files changed

+45
-204
lines changed

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,9 @@ impl<'tcx> InferCtxt<'tcx> {
12731273
where
12741274
T: TypeFoldable<TyCtxt<'tcx>>,
12751275
{
1276+
if let Err(guar) = value.error_reported() {
1277+
self.set_tainted_by_errors(guar);
1278+
}
12761279
if !value.has_non_region_infer() {
12771280
return value;
12781281
}

tests/crashes/124083.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/crashes/124262.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/crashes/125155.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/crashes/125888.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/crashes/125992.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

tests/crashes/126648.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/crashes/126666.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/ui/const-generics/issues/issue-62878.min.stderr

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,7 @@ help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
3030
LL + #![feature(generic_arg_infer)]
3131
|
3232

33-
error[E0284]: type annotations needed
34-
--> $DIR/issue-62878.rs:10:5
35-
|
36-
LL | foo::<_, { [1] }>();
37-
| ^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
38-
|
39-
note: required by a const generic parameter in `foo`
40-
--> $DIR/issue-62878.rs:5:8
41-
|
42-
LL | fn foo<const N: usize, const A: [u8; N]>() {}
43-
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
44-
45-
error[E0284]: type annotations needed
46-
--> $DIR/issue-62878.rs:10:5
47-
|
48-
LL | foo::<_, { [1] }>();
49-
| ^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `A` declared on the function `foo`
50-
|
51-
note: required by a const generic parameter in `foo`
52-
--> $DIR/issue-62878.rs:5:24
53-
|
54-
LL | fn foo<const N: usize, const A: [u8; N]>() {}
55-
| ^^^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
56-
57-
error: aborting due to 5 previous errors
33+
error: aborting due to 3 previous errors
5834

59-
Some errors have detailed explanations: E0284, E0747, E0770.
60-
For more information about an error, try `rustc --explain E0284`.
35+
Some errors have detailed explanations: E0747, E0770.
36+
For more information about an error, try `rustc --explain E0747`.

tests/ui/const-generics/issues/issue-62878.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ fn foo<const N: usize, const A: [u8; N]>() {}
99
fn main() {
1010
foo::<_, { [1] }>();
1111
//[min]~^ ERROR: type provided when a constant was expected
12-
//[min]~| ERROR type annotations needed
13-
//[min]~| ERROR type annotations needed
1412
}

0 commit comments

Comments
 (0)