diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-01-30 12:00:11 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-01-30 12:26:26 +0000 |
| commit | 4d75f618323cb26a31396f20fe91c35efba9b823 (patch) | |
| tree | 5199029df546a317a16c8e1477bf118b4d9f05d4 /compiler/rustc_mir_transform/src | |
| parent | fd649a3cc5e9f17c8aee070227e8c71f094560b7 (diff) | |
| download | rust-4d75f618323cb26a31396f20fe91c35efba9b823.tar.gz rust-4d75f618323cb26a31396f20fe91c35efba9b823.zip | |
Use `Mutability::{is_mut, is_not}`
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/const_prop.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_mir_transform/src/shim.rs | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 5c45abc5a17..9699611e9b0 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -5,7 +5,6 @@ use std::cell::Cell; use either::Right; -use rustc_ast::Mutability; use rustc_const_eval::const_eval::CheckAlignment; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def::DefKind; @@ -289,7 +288,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine<'mir, 'tcx> } // If the static allocation is mutable, then we can't const prop it as its content // might be different at runtime. - if alloc.inner().mutability == Mutability::Mut { + if alloc.inner().mutability.is_mut() { throw_machine_stop_str!("can't access mutable globals in ConstProp"); } diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index 8d4fe74e7d3..e9ca6f7c93c 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -427,7 +427,7 @@ impl<'tcx> CloneShimBuilder<'tcx> { fn make_place(&mut self, mutability: Mutability, ty: Ty<'tcx>) -> Place<'tcx> { let span = self.span; let mut local = LocalDecl::new(ty, span); - if mutability == Mutability::Not { + if mutability.is_not() { local = local.immutable(); } Place::from(self.local_decls.push(local)) |
