diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-05-21 12:12:46 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-06-28 10:08:09 -0700 |
| commit | f33a75c20ced68f5f9b384ab213ced26a1276107 (patch) | |
| tree | 4c23dd7d27276f3146d67f0b23087f21134e3207 /src/librustc_mir | |
| parent | 66f0cef1b1284b3c4f8d94c1bed0b4fda3d2053c (diff) | |
| download | rust-f33a75c20ced68f5f9b384ab213ced26a1276107.tar.gz rust-f33a75c20ced68f5f9b384ab213ced26a1276107.zip | |
Remove `control_flow_destroyed` and properly lower `&&` and `||`
Diffstat (limited to 'src/librustc_mir')
| -rw-r--r-- | src/librustc_mir/shim.rs | 1 | ||||
| -rw-r--r-- | src/librustc_mir/transform/check_consts/validation.rs | 40 | ||||
| -rw-r--r-- | src/librustc_mir/transform/const_prop.rs | 1 | ||||
| -rw-r--r-- | src/librustc_mir/transform/promote_consts.rs | 1 |
4 files changed, 0 insertions, 43 deletions
diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 8327affd982..5671b5b4f04 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -251,7 +251,6 @@ fn new_body<'tcx>( arg_count, vec![], span, - vec![], None, ) } diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index d263bf12e88..238ad703fb0 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -207,8 +207,6 @@ impl Validator<'mir, 'tcx> { } } - check_short_circuiting_in_const_local(self.ccx); - if body.is_cfg_cyclic() { // We can't provide a good span for the error here, but this should be caught by the // HIR const-checker anyways. @@ -626,44 +624,6 @@ fn error_min_const_fn_violation(tcx: TyCtxt<'_>, span: Span, msg: Cow<'_, str>) .emit(); } -fn check_short_circuiting_in_const_local(ccx: &ConstCx<'_, 'tcx>) { - let body = ccx.body; - - if body.control_flow_destroyed.is_empty() { - return; - } - - let mut locals = body.vars_iter(); - if let Some(local) = locals.next() { - let span = body.local_decls[local].source_info.span; - let mut error = ccx.tcx.sess.struct_span_err( - span, - &format!( - "new features like let bindings are not permitted in {}s \ - which also use short circuiting operators", - ccx.const_kind(), - ), - ); - for (span, kind) in body.control_flow_destroyed.iter() { - error.span_note( - *span, - &format!( - "use of {} here does not actually short circuit due to \ - the const evaluator presently not being able to do control flow. \ - See issue #49146 <https://github.com/rust-lang/rust/issues/49146> \ - for more information.", - kind - ), - ); - } - for local in locals { - let span = body.local_decls[local].source_info.span; - error.span_note(span, "more locals are defined here"); - } - error.emit(); - } -} - fn check_return_ty_is_sync(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, hir_id: HirId) { let ty = body.return_ty(); tcx.infer_ctxt().enter(|infcx| { diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index a891f12c8e1..5d0d7c15478 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -133,7 +133,6 @@ impl<'tcx> MirPass<'tcx> for ConstProp { body.arg_count, Default::default(), tcx.def_span(source.def_id()), - Default::default(), body.generator_kind, ); diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 8bcbcd79ae6..bd7ebaa01f8 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -1142,7 +1142,6 @@ pub fn promote_candidates<'tcx>( 0, vec![], body.span, - vec![], body.generator_kind, ); promoted.ignore_interior_mut_in_const_validation = true; |
