Skip to content

Commit 2d5b2d8

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

23 files changed

+48
-225
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/rustdoc-ui/unable-fulfill-trait.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub struct Foo<'a, 'b, T> {
44
field1: dyn Bar<'a, 'b>,
55
//~^ ERROR
66
//~| ERROR
7-
//~| ERROR
87
}
98

109
pub trait Bar<'x, 's, U>

tests/rustdoc-ui/unable-fulfill-trait.stderr

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | field1: dyn Bar<'a, 'b>,
55
| ^^^ expected 1 generic argument
66
|
77
note: trait defined here, with 1 generic parameter: `U`
8-
--> $DIR/unable-fulfill-trait.rs:10:11
8+
--> $DIR/unable-fulfill-trait.rs:9:11
99
|
1010
LL | pub trait Bar<'x, 's, U>
1111
| ^^^ -
@@ -20,24 +20,7 @@ error[E0227]: ambiguous lifetime bound, explicit lifetime bound required
2020
LL | field1: dyn Bar<'a, 'b>,
2121
| ^^^^^^^^^^^^^^^
2222

23-
error[E0478]: lifetime bound not satisfied
24-
--> $DIR/unable-fulfill-trait.rs:4:13
25-
|
26-
LL | field1: dyn Bar<'a, 'b>,
27-
| ^^^^^^^^^^^^^^^
28-
|
29-
note: lifetime parameter instantiated with the lifetime `'b` as defined here
30-
--> $DIR/unable-fulfill-trait.rs:3:20
31-
|
32-
LL | pub struct Foo<'a, 'b, T> {
33-
| ^^
34-
note: but lifetime parameter must outlive the lifetime `'a` as defined here
35-
--> $DIR/unable-fulfill-trait.rs:3:16
36-
|
37-
LL | pub struct Foo<'a, 'b, T> {
38-
| ^^
39-
40-
error: aborting due to 3 previous errors
23+
error: aborting due to 2 previous errors
4124

42-
Some errors have detailed explanations: E0107, E0227, E0478.
25+
Some errors have detailed explanations: E0107, E0227.
4326
For more information about an error, try `rustc --explain E0107`.

0 commit comments

Comments
 (0)