diff options
| -rw-r--r-- | Cargo.lock | 39 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/pretty.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/thir.rs | 6 | ||||
| -rw-r--r-- | src/test/mir-opt/const_allocation.main.ConstProp.after.32bit.mir | 5 | ||||
| -rw-r--r-- | src/test/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir | 5 | ||||
| -rw-r--r-- | src/test/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir | 3 |
6 files changed, 42 insertions, 22 deletions
diff --git a/Cargo.lock b/Cargo.lock index fe265a05146..b330155d144 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -369,7 +369,7 @@ dependencies = [ "tar", "tempfile", "termcolor", - "toml", + "toml_edit", "unicode-width", "unicode-xid", "url 2.2.2", @@ -455,7 +455,7 @@ dependencies = [ "serde_json", "tar", "termcolor", - "toml", + "toml_edit", "url 2.2.2", ] @@ -711,6 +711,16 @@ dependencies = [ ] [[package]] +name = "combine" +version = "4.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b727aacc797f9fc28e355d21f34709ac4fc9adecfe470ad07b8f4464f53062" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] name = "commoncrypto" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1940,6 +1950,15 @@ dependencies = [ ] [[package]] +name = "kstring" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b310ccceade8121d7d77fee406160e457c2f4e7c7982d589da3499bc7ea4526" +dependencies = [ + "serde", +] + +[[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3146,13 +3165,14 @@ dependencies = [ "tokio-stream", "tokio-util", "toml", + "toml_edit", "url 2.2.2", "walkdir", ] [[package]] name = "rls-analysis" -version = "0.18.2" +version = "0.18.3" dependencies = [ "derive-new", "env_logger 0.9.0", @@ -5152,6 +5172,19 @@ dependencies = [ ] [[package]] +name = "toml_edit" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744e9ed5b352340aa47ce033716991b5589e23781acb97cad37d4ea70560f55b" +dependencies = [ + "combine", + "indexmap", + "itertools 0.10.1", + "kstring", + "serde", +] + +[[package]] name = "topological-sort" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index c263eb6f321..784babffeff 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -686,15 +686,15 @@ pub fn write_allocations<'tcx>( struct CollectAllocIds(BTreeSet<AllocId>); impl<'tcx> Visitor<'tcx> for CollectAllocIds { - fn visit_const(&mut self, c: &&'tcx ty::Const<'tcx>, _loc: Location) { - if let ty::ConstKind::Value(val) = c.val { + fn visit_const(&mut self, c: ty::Const<'tcx>, _loc: Location) { + if let ty::ConstKind::Value(val) = c.val() { self.0.extend(alloc_ids_from_const(val)); } } fn visit_constant(&mut self, c: &Constant<'tcx>, loc: Location) { match c.literal { - ConstantKind::Ty(c) => self.visit_const(&c, loc), + ConstantKind::Ty(c) => self.visit_const(c, loc), ConstantKind::Val(val, _) => { self.0.extend(alloc_ids_from_const(val)); } diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs index a4e2a7c3e91..04bc0c8b521 100644 --- a/compiler/rustc_middle/src/thir.rs +++ b/compiler/rustc_middle/src/thir.rs @@ -717,11 +717,7 @@ impl<'tcx> fmt::Display for Pat<'tcx> { Some(&adt_def.variants[variant_index]) } _ => self.ty.ty_adt_def().and_then(|adt| { - if !adt.is_enum() { - Some(adt.non_enum_variant()) - } else { - None - } + if !adt.is_enum() { Some(adt.non_enum_variant()) } else { None } }), }; diff --git a/src/test/mir-opt/const_allocation.main.ConstProp.after.32bit.mir b/src/test/mir-opt/const_allocation.main.ConstProp.after.32bit.mir index 8e02dca4fb8..f8a8afa92e0 100644 --- a/src/test/mir-opt/const_allocation.main.ConstProp.after.32bit.mir +++ b/src/test/mir-opt/const_allocation.main.ConstProp.after.32bit.mir @@ -9,12 +9,9 @@ fn main() -> () { StorageLive(_1); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8 StorageLive(_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8 _2 = const {alloc1: &&[(Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8 - // ty::Const - // + ty: &&[(std::option::Option<i32>, &[&str])] - // + val: Value(Scalar(alloc1)) // mir::Constant // + span: $DIR/const_allocation.rs:8:5: 8:8 - // + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc1)) } + // + literal: Const { ty: &&[(Option<i32>, &[&str])], val: Value(Scalar(alloc1)) } _1 = (*_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8 StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9 StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9 diff --git a/src/test/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir b/src/test/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir index 059b721f5bb..8b5ad40c9f9 100644 --- a/src/test/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir +++ b/src/test/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir @@ -9,12 +9,9 @@ fn main() -> () { StorageLive(_1); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 StorageLive(_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 _2 = const {alloc1: &&[(Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 - // ty::Const - // + ty: &&[(std::option::Option<i32>, &[&u8])] - // + val: Value(Scalar(alloc1)) // mir::Constant // + span: $DIR/const_allocation2.rs:5:5: 5:8 - // + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc1)) } + // + literal: Const { ty: &&[(Option<i32>, &[&u8])], val: Value(Scalar(alloc1)) } _1 = (*_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8 StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9 StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9 diff --git a/src/test/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir b/src/test/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir index 32000340dce..991cf40d1b7 100644 --- a/src/test/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir +++ b/src/test/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir @@ -9,9 +9,6 @@ fn main() -> () { StorageLive(_1); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8 StorageLive(_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8 _2 = const {alloc1: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8 - // ty::Const - // + ty: &&Packed - // + val: Value(Scalar(alloc1)) // mir::Constant // + span: $DIR/const_allocation3.rs:5:5: 5:8 // + literal: Const { ty: &&Packed, val: Value(Scalar(alloc1)) } |
