Skip to content

Commit 31e0bf7

Browse files
committed
trait selection errors should poison the typeck results, too, so that const eval can avoid running at all
1 parent b2eba05 commit 31e0bf7

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
273273
error: &SelectionError<'tcx>,
274274
fallback_has_occurred: bool,
275275
) {
276+
self.set_tainted_by_errors();
276277
let tcx = self.tcx;
277278
let mut span = obligation.cause.span;
278279

src/test/ui/consts/issue-91434.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ fn main() {
22
[9; [[9E; h]]];
33
//~^ ERROR: expected at least one digit in exponent
44
//~| ERROR: cannot find value `h` in this scope [E0425]
5-
//~| ERROR: constant expression depends on a generic parameter
65
}

src/test/ui/consts/issue-91434.stderr

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ error[E0425]: cannot find value `h` in this scope
1010
LL | [9; [[9E; h]]];
1111
| ^ not found in this scope
1212

13-
error: constant expression depends on a generic parameter
14-
--> $DIR/issue-91434.rs:2:9
15-
|
16-
LL | [9; [[9E; h]]];
17-
| ^^^^^^^^^
18-
|
19-
= note: this may fail depending on what value the parameter takes
20-
21-
error: aborting due to 3 previous errors
13+
error: aborting due to 2 previous errors
2214

2315
For more information about this error, try `rustc --explain E0425`.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn main() {
2+
[9; || [9; []]];
3+
//~^ ERROR: mismatched types
4+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/nested_erroneous_ctfe.rs:2:16
3+
|
4+
LL | [9; || [9; []]];
5+
| ^^ expected `usize`, found array of 0 elements
6+
|
7+
= note: expected type `usize`
8+
found array `[_; 0]`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)