trait selection errors should poison the typeck results, too, so that const eval can avoid running at all

This commit is contained in:
Oli Scherer 2022-04-13 14:37:36 +00:00
parent b2eba058e6
commit 31e0bf7891
5 changed files with 18 additions and 10 deletions

View File

@ -273,6 +273,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
error: &SelectionError<'tcx>,
fallback_has_occurred: bool,
) {
self.set_tainted_by_errors();
let tcx = self.tcx;
let mut span = obligation.cause.span;

View File

@ -2,5 +2,4 @@ fn main() {
[9; [[9E; h]]];
//~^ ERROR: expected at least one digit in exponent
//~| ERROR: cannot find value `h` in this scope [E0425]
//~| ERROR: constant expression depends on a generic parameter
}

View File

@ -10,14 +10,6 @@ error[E0425]: cannot find value `h` in this scope
LL | [9; [[9E; h]]];
| ^ not found in this scope
error: constant expression depends on a generic parameter
--> $DIR/issue-91434.rs:2:9
|
LL | [9; [[9E; h]]];
| ^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.

View File

@ -0,0 +1,4 @@
fn main() {
[9; || [9; []]];
//~^ ERROR: mismatched types
}

View File

@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/nested_erroneous_ctfe.rs:2:16
|
LL | [9; || [9; []]];
| ^^ expected `usize`, found array of 0 elements
|
= note: expected type `usize`
found array `[_; 0]`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.