未验证 提交 08c5999d 编写于 作者: Y Yuki Okushi 提交者: GitHub

Rollup merge of #67967 - JohnTitor:fix-ice-0107, r=matthewjasper

Delay bug to prevent ICE in MIR borrowck

Fixes #67947

r? @matthewjasper
......@@ -28,7 +28,13 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, src: MirSource<'tcx>, body: &mut BodyAndCa
let param_env = tcx.param_env(src.def_id()).with_reveal_all();
let move_data = match MoveData::gather_moves(body, tcx, param_env) {
Ok(move_data) => move_data,
Err(_) => bug!("No `move_errors` should be allowed in MIR borrowck"),
Err((move_data, _)) => {
tcx.sess.delay_span_bug(
body.span,
"No `move_errors` should be allowed in MIR borrowck",
);
move_data
}
};
let elaborate_patch = {
let body = &*body;
......
struct Bug {
A: [(); { *"" }.len()],
//~^ ERROR: cannot move a value of type str
//~| ERROR: cannot move out of a shared reference
}
fn main() {}
error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
--> $DIR/issue-67947.rs:2:13
|
LL | A: [(); { *"" }.len()],
| ^^^^^^^
error[E0507]: cannot move out of a shared reference
--> $DIR/issue-67947.rs:2:15
|
LL | A: [(); { *"" }.len()],
| ^^^ move occurs because value has type `str`, which does not implement the `Copy` trait
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0161, E0507.
For more information about an error, try `rustc --explain E0161`.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册