Rollup merge of #115643 - bvanjoi:fix-115203, r=RalfJung,oli-obk
fix: return early when has tainted in mir-lint Fixes #115203 `a[..]` is of indeterminate size, it had been reported error during borrow check, therefore we skip the mir lint process.
This commit is contained in:
commit
60327bb8b0
@ -39,6 +39,10 @@
|
||||
|
||||
impl<'tcx> MirLint<'tcx> for ConstProp {
|
||||
fn run_lint(&self, tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
|
||||
if body.tainted_by_errors.is_some() {
|
||||
return;
|
||||
}
|
||||
|
||||
// will be evaluated by miri and produce its errors there
|
||||
if body.source.promoted.is_some() {
|
||||
return;
|
||||
|
11
tests/ui/unsized/issue-115203.rs
Normal file
11
tests/ui/unsized/issue-115203.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// compile-flags: --emit link
|
||||
|
||||
fn main() {
|
||||
let a: [i32; 0] = [];
|
||||
match [a[..]] {
|
||||
//~^ ERROR cannot move a value of type `[i32]
|
||||
//~| ERROR cannot move out of type `[i32]`, a non-copy slice
|
||||
[[]] => (),
|
||||
_ => (),
|
||||
}
|
||||
}
|
19
tests/ui/unsized/issue-115203.stderr
Normal file
19
tests/ui/unsized/issue-115203.stderr
Normal file
@ -0,0 +1,19 @@
|
||||
error[E0161]: cannot move a value of type `[i32]`
|
||||
--> $DIR/issue-115203.rs:5:12
|
||||
|
|
||||
LL | match [a[..]] {
|
||||
| ^^^^^ the size of `[i32]` cannot be statically determined
|
||||
|
||||
error[E0508]: cannot move out of type `[i32]`, a non-copy slice
|
||||
--> $DIR/issue-115203.rs:5:12
|
||||
|
|
||||
LL | match [a[..]] {
|
||||
| ^^^^^
|
||||
| |
|
||||
| cannot move out of here
|
||||
| move occurs because value has type `[i32]`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0161, E0508.
|
||||
For more information about an error, try `rustc --explain E0161`.
|
Loading…
Reference in New Issue
Block a user