From 34155a87f6898f29106d4c6095b6e8f77b2290d0 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 29 Sep 2016 01:11:54 +0200 Subject: [PATCH] Change the `local` prefix to `_` There's no need for a long prefix, since there's nothing to distinguish anymore. --- src/librustc/mir/repr.rs | 4 +-- src/librustc_trans/mir/constant.rs | 2 +- src/test/codegen/lifetime_start_end.rs | 8 ++--- src/test/mir-opt/deaggregator_test.rs | 16 +++++----- src/test/mir-opt/deaggregator_test_enum.rs | 14 ++++----- src/test/mir-opt/storage_ranges.rs | 34 +++++++++++----------- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs index 34b46ed66a2..5da2e2f6fda 100644 --- a/src/librustc/mir/repr.rs +++ b/src/librustc/mir/repr.rs @@ -85,7 +85,7 @@ pub struct Mir<'tcx> { /// Number of arguments this function takes. /// - /// Starting at local1, `arg_count` locals will be provided by the caller + /// Starting at local 1, `arg_count` locals will be provided by the caller /// and can be assumed to be initialized. /// /// If this MIR was built for a constant, this will be 0. @@ -323,7 +323,7 @@ pub enum BorrowKind { /////////////////////////////////////////////////////////////////////////// // Variables and temps -newtype_index!(Local, "local"); +newtype_index!(Local, "_"); pub const RETURN_POINTER: Local = Local(0); diff --git a/src/librustc_trans/mir/constant.rs b/src/librustc_trans/mir/constant.rs index b68a9a962c7..c0e7af845ec 100644 --- a/src/librustc_trans/mir/constant.rs +++ b/src/librustc_trans/mir/constant.rs @@ -230,7 +230,7 @@ impl<'a, 'tcx> MirConstContext<'a, 'tcx> { locals: (0..mir.local_decls.len()).map(|_| None).collect(), }; for (i, arg) in args.into_iter().enumerate() { - // Locals after local0 are the function arguments + // Locals after local 0 are the function arguments let index = mir::Local::new(i + 1); context.locals[index] = Some(arg); } diff --git a/src/test/codegen/lifetime_start_end.rs b/src/test/codegen/lifetime_start_end.rs index 128eb72d212..81f6cf309da 100644 --- a/src/test/codegen/lifetime_start_end.rs +++ b/src/test/codegen/lifetime_start_end.rs @@ -30,11 +30,11 @@ pub fn test() { // CHECK: [[S_b:%[0-9]+]] = bitcast %"2.std::option::Option"** %b to i8* // CHECK: call void @llvm.lifetime.start(i{{[0-9 ]+}}, i8* [[S_b]]) -// CHECK: [[S_local5:%[0-9]+]] = bitcast %"2.std::option::Option"* %local5 to i8* -// CHECK: call void @llvm.lifetime.start(i{{[0-9 ]+}}, i8* [[S_local5]]) +// CHECK: [[S__5:%[0-9]+]] = bitcast %"2.std::option::Option"* %_5 to i8* +// CHECK: call void @llvm.lifetime.start(i{{[0-9 ]+}}, i8* [[S__5]]) -// CHECK: [[E_local5:%[0-9]+]] = bitcast %"2.std::option::Option"* %local5 to i8* -// CHECK: call void @llvm.lifetime.end(i{{[0-9 ]+}}, i8* [[E_local5]]) +// CHECK: [[E__5:%[0-9]+]] = bitcast %"2.std::option::Option"* %_5 to i8* +// CHECK: call void @llvm.lifetime.end(i{{[0-9 ]+}}, i8* [[E__5]]) // CHECK: [[E_b:%[0-9]+]] = bitcast %"2.std::option::Option"** %b to i8* // CHECK: call void @llvm.lifetime.end(i{{[0-9 ]+}}, i8* [[E_b]]) diff --git a/src/test/mir-opt/deaggregator_test.rs b/src/test/mir-opt/deaggregator_test.rs index 66c3dfbf48c..36738ba1f7d 100644 --- a/src/test/mir-opt/deaggregator_test.rs +++ b/src/test/mir-opt/deaggregator_test.rs @@ -23,19 +23,19 @@ fn main() {} // END RUST SOURCE // START rustc.node13.Deaggregator.before.mir // bb0: { -// local2 = local1; // scope 0 at main.rs:8:8: 8:9 -// local3 = local2; // scope 1 at main.rs:9:14: 9:15 -// local0 = Baz { x: local3, y: const F32(0), z: const false }; // scope ... +// _2 = _1; // scope 0 at main.rs:8:8: 8:9 +// _3 = _2; // scope 1 at main.rs:9:14: 9:15 +// _0 = Baz { x: _3, y: const F32(0), z: const false }; // scope ... // goto -> bb1; // scope 1 at main.rs:8:1: 10:2 // } // END rustc.node13.Deaggregator.before.mir // START rustc.node13.Deaggregator.after.mir // bb0: { -// local2 = local1; // scope 0 at main.rs:8:8: 8:9 -// local3 = local2; // scope 1 at main.rs:9:14: 9:15 -// (local0.0: usize) = local3; // scope 1 at main.rs:9:5: 9:34 -// (local0.1: f32) = const F32(0); // scope 1 at main.rs:9:5: 9:34 -// (local0.2: bool) = const false; // scope 1 at main.rs:9:5: 9:34 +// _2 = _1; // scope 0 at main.rs:8:8: 8:9 +// _3 = _2; // scope 1 at main.rs:9:14: 9:15 +// (_0.0: usize) = _3; // scope 1 at main.rs:9:5: 9:34 +// (_0.1: f32) = const F32(0); // scope 1 at main.rs:9:5: 9:34 +// (_0.2: bool) = const false; // scope 1 at main.rs:9:5: 9:34 // goto -> bb1; // scope 1 at main.rs:8:1: 10:2 // } // END rustc.node13.Deaggregator.after.mir diff --git a/src/test/mir-opt/deaggregator_test_enum.rs b/src/test/mir-opt/deaggregator_test_enum.rs index 5d182f367b5..f5426e410cf 100644 --- a/src/test/mir-opt/deaggregator_test_enum.rs +++ b/src/test/mir-opt/deaggregator_test_enum.rs @@ -28,18 +28,18 @@ fn main() { // END RUST SOURCE // START rustc.node10.Deaggregator.before.mir // bb0: { -// local2 = local1; // scope 0 at main.rs:7:8: 7:9 -// local3 = local2; // scope 1 at main.rs:8:19: 8:20 -// local0 = Baz::Foo { x: local3 }; // scope 1 at main.rs:8:5: 8:21 +// _2 = _1; // scope 0 at main.rs:7:8: 7:9 +// _3 = _2; // scope 1 at main.rs:8:19: 8:20 +// _0 = Baz::Foo { x: _3 }; // scope 1 at main.rs:8:5: 8:21 // goto -> bb1; // scope 1 at main.rs:7:1: 9:2 // } // END rustc.node10.Deaggregator.before.mir // START rustc.node10.Deaggregator.after.mir // bb0: { -// local2 = local1; // scope 0 at main.rs:7:8: 7:9 -// local3 = local2; // scope 1 at main.rs:8:19: 8:20 -// ((local0 as Foo).0: usize) = local3; // scope 1 at main.rs:8:5: 8:21 -// discriminant(local0) = 1; // scope 1 at main.rs:8:5: 8:21 +// _2 = _1; // scope 0 at main.rs:7:8: 7:9 +// _3 = _2; // scope 1 at main.rs:8:19: 8:20 +// ((_0 as Foo).0: usize) = _3; // scope 1 at main.rs:8:5: 8:21 +// discriminant(_0) = 1; // scope 1 at main.rs:8:5: 8:21 // goto -> bb1; // scope 1 at main.rs:7:1: 9:2 // } // END rustc.node10.Deaggregator.after.mir diff --git a/src/test/mir-opt/storage_ranges.rs b/src/test/mir-opt/storage_ranges.rs index a4905281e46..aa798231b34 100644 --- a/src/test/mir-opt/storage_ranges.rs +++ b/src/test/mir-opt/storage_ranges.rs @@ -21,23 +21,23 @@ fn main() { // END RUST SOURCE // START rustc.node4.TypeckMir.before.mir // bb0: { -// StorageLive(local1); // scope 0 at storage_ranges.rs:12:9: 12:10 -// local1 = const 0i32; // scope 0 at storage_ranges.rs:12:13: 12:14 -// StorageLive(local3); // scope 1 at storage_ranges.rs:14:13: 14:14 -// StorageLive(local4); // scope 1 at storage_ranges.rs:14:18: 14:25 -// StorageLive(local5); // scope 1 at storage_ranges.rs:14:23: 14:24 -// local5 = local1; // scope 1 at storage_ranges.rs:14:23: 14:24 -// local4 = std::option::Option::Some(local5,); // scope 1 at storage_ranges.rs:14:18: 14:25 -// local3 = &local4; // scope 1 at storage_ranges.rs:14:17: 14:25 -// StorageDead(local5); // scope 1 at storage_ranges.rs:14:23: 14:24 -// local2 = (); // scope 2 at storage_ranges.rs:13:5: 15:6 -// StorageDead(local4); // scope 1 at storage_ranges.rs:14:18: 14:25 -// StorageDead(local3); // scope 1 at storage_ranges.rs:14:13: 14:14 -// StorageLive(local6); // scope 1 at storage_ranges.rs:16:9: 16:10 -// local6 = const 1i32; // scope 1 at storage_ranges.rs:16:13: 16:14 -// local0 = (); // scope 3 at storage_ranges.rs:11:11: 17:2 -// StorageDead(local6); // scope 1 at storage_ranges.rs:16:9: 16:10 -// StorageDead(local1); // scope 0 at storage_ranges.rs:14:9: 14:10 +// StorageLive(_1); // scope 0 at storage_ranges.rs:12:9: 12:10 +// _1 = const 0i32; // scope 0 at storage_ranges.rs:12:13: 12:14 +// StorageLive(_3); // scope 1 at storage_ranges.rs:14:13: 14:14 +// StorageLive(_4); // scope 1 at storage_ranges.rs:14:18: 14:25 +// StorageLive(_5); // scope 1 at storage_ranges.rs:14:23: 14:24 +// _5 = _1; // scope 1 at storage_ranges.rs:14:23: 14:24 +// _4 = std::option::Option::Some(_5,); // scope 1 at storage_ranges.rs:14:18: 14:25 +// _3 = &_4; // scope 1 at storage_ranges.rs:14:17: 14:25 +// StorageDead(_5); // scope 1 at storage_ranges.rs:14:23: 14:24 +// _2 = (); // scope 2 at storage_ranges.rs:13:5: 15:6 +// StorageDead(_4); // scope 1 at storage_ranges.rs:14:18: 14:25 +// StorageDead(_3); // scope 1 at storage_ranges.rs:14:13: 14:14 +// StorageLive(_6); // scope 1 at storage_ranges.rs:16:9: 16:10 +// _6 = const 1i32; // scope 1 at storage_ranges.rs:16:13: 16:14 +// _0 = (); // scope 3 at storage_ranges.rs:11:11: 17:2 +// StorageDead(_6); // scope 1 at storage_ranges.rs:16:9: 16:10 +// StorageDead(_1); // scope 0 at storage_ranges.rs:14:9: 14:10 // goto -> bb1; // scope 0 at storage_ranges.rs:11:1: 17:2 // } //