Skip to content

Commit cb9b0ed

Browse files
committed
Disable old trans access via -Z orbit, #[rustc_no_mir] or --disable-orbit.
1 parent a66fa96 commit cb9b0ed

File tree

81 files changed

+68
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+68
-422
lines changed

configure

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,6 @@ if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTION
733733
if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi
734734
if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi
735735

736-
if [ -n "$CFG_DISABLE_ORBIT" ]; then putvar CFG_DISABLE_ORBIT; fi
737-
738736
step_msg "looking for build programs"
739737

740738
probe_need CFG_CURL curl

mk/main.mk

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,6 @@ ifdef CFG_ENABLE_DEBUGINFO
162162
CFG_RUSTC_FLAGS += -g
163163
endif
164164

165-
ifdef CFG_DISABLE_ORBIT
166-
$(info cfg: HOLD HOLD HOLD (CFG_DISABLE_ORBIT))
167-
RUSTFLAGS_STAGE1 += -Z orbit=off
168-
RUSTFLAGS_STAGE2 += -Z orbit=off
169-
endif
170-
171165
ifdef SAVE_TEMPS
172166
CFG_RUSTC_FLAGS += -C save-temps
173167
endif

src/librustc/session/config.rs

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,6 @@ macro_rules! options {
605605
pub const parse_bool: Option<&'static str> = None;
606606
pub const parse_opt_bool: Option<&'static str> =
607607
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
608-
pub const parse_all_bool: Option<&'static str> =
609-
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
610608
pub const parse_string: Option<&'static str> = Some("a string");
611609
pub const parse_opt_string: Option<&'static str> = Some("a string");
612610
pub const parse_list: Option<&'static str> = Some("a space-separated list of strings");
@@ -656,25 +654,6 @@ macro_rules! options {
656654
}
657655
}
658656

659-
fn parse_all_bool(slot: &mut bool, v: Option<&str>) -> bool {
660-
match v {
661-
Some(s) => {
662-
match s {
663-
"n" | "no" | "off" => {
664-
*slot = false;
665-
}
666-
"y" | "yes" | "on" => {
667-
*slot = true;
668-
}
669-
_ => { return false; }
670-
}
671-
672-
true
673-
},
674-
None => { *slot = true; true }
675-
}
676-
}
677-
678657
fn parse_opt_string(slot: &mut Option<String>, v: Option<&str>) -> bool {
679658
match v {
680659
Some(s) => { *slot = Some(s.to_string()); true },
@@ -930,8 +909,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
930909
"dump MIR state at various points in translation"),
931910
dump_mir_dir: Option<String> = (None, parse_opt_string, [UNTRACKED],
932911
"the directory the MIR is dumped into"),
933-
orbit: bool = (true, parse_all_bool, [UNTRACKED],
934-
"get MIR where it belongs - everywhere; most importantly, in orbit"),
935912
}
936913

937914
pub fn default_lib_output() -> CrateType {
@@ -1324,15 +1301,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
13241301
})
13251302
});
13261303

1327-
let mut debugging_opts = build_debugging_options(matches, error_format);
1328-
1329-
// Incremental compilation only works reliably when translation is done via
1330-
// MIR, so let's enable -Z orbit if necessary (see #34973).
1331-
if debugging_opts.incremental.is_some() && !debugging_opts.orbit {
1332-
early_warn(error_format, "Automatically enabling `-Z orbit` because \
1333-
`-Z incremental` was specified");
1334-
debugging_opts.orbit = true;
1335-
}
1304+
let debugging_opts = build_debugging_options(matches, error_format);
13361305

13371306
let mir_opt_level = debugging_opts.mir_opt_level.unwrap_or(1);
13381307

@@ -2424,8 +2393,6 @@ mod tests {
24242393
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
24252394
opts.debugging_opts.dump_mir_dir = Some(String::from("abc"));
24262395
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
2427-
opts.debugging_opts.orbit = false;
2428-
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
24292396

24302397
// Make sure changing a [TRACKED] option changes the hash
24312398
opts = reference.clone();

src/librustc_trans/base.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,26 +1424,17 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
14241424
false
14251425
};
14261426

1427-
let check_attrs = |attrs: &[ast::Attribute]| {
1428-
let default_to_mir = ccx.sess().opts.debugging_opts.orbit;
1429-
let invert = if default_to_mir { "rustc_no_mir" } else { "rustc_mir" };
1430-
(default_to_mir ^ attrs.iter().any(|item| item.check_name(invert)),
1431-
attrs.iter().any(|item| item.check_name("no_debug")))
1432-
};
1433-
1434-
let (use_mir, no_debug) = if let Some(id) = local_id {
1435-
check_attrs(ccx.tcx().map.attrs(id))
1427+
let no_debug = if let Some(id) = local_id {
1428+
ccx.tcx().map.attrs(id)
1429+
.iter().any(|item| item.check_name("no_debug"))
14361430
} else if let Some(def_id) = def_id {
1437-
check_attrs(&ccx.sess().cstore.item_attrs(def_id))
1431+
ccx.sess().cstore.item_attrs(def_id)
1432+
.iter().any(|item| item.check_name("no_debug"))
14381433
} else {
1439-
check_attrs(&[])
1434+
false
14401435
};
14411436

1442-
let mir = if use_mir {
1443-
def_id.and_then(|id| ccx.get_mir(id))
1444-
} else {
1445-
None
1446-
};
1437+
let mir = def_id.and_then(|id| ccx.get_mir(id));
14471438

14481439
let debug_context = if let (false, Some(definition)) = (no_debug, definition) {
14491440
let (instance, sig, abi, _) = definition;
@@ -1846,6 +1837,8 @@ pub fn trans_closure<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
18461837

18471838
if fcx.mir.is_some() {
18481839
return mir::trans_mir(&fcx);
1840+
} else {
1841+
span_bug!(body.span, "attempted translation of `{}` w/o MIR", instance);
18491842
}
18501843

18511844
debuginfo::fill_scope_map_for_function(&fcx, decl, body, inlined_id);

src/librustc_trans/closure.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,6 @@ fn get_or_create_closure_declaration<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
181181
llfn
182182
}
183183

184-
fn translating_closure_body_via_mir_will_fail(ccx: &CrateContext,
185-
closure_def_id: DefId)
186-
-> bool {
187-
let default_to_mir = ccx.sess().opts.debugging_opts.orbit;
188-
let invert = if default_to_mir { "rustc_no_mir" } else { "rustc_mir" };
189-
let use_mir = default_to_mir ^ ccx.tcx().has_attr(closure_def_id, invert);
190-
191-
!use_mir
192-
}
193-
194184
pub fn trans_closure_body_via_mir<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
195185
closure_def_id: DefId,
196186
closure_substs: ty::ClosureSubsts<'tcx>) {
@@ -362,15 +352,6 @@ pub fn trans_closure_method<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
362352
closure_def_id,
363353
substs);
364354
} else {
365-
// If the closure is defined in an upstream crate, we can only
366-
// translate it if MIR-trans is active.
367-
368-
if translating_closure_body_via_mir_will_fail(ccx, closure_def_id) {
369-
ccx.sess().fatal("You have run into a known limitation of the \
370-
MingW toolchain. Either compile with -Zorbit or \
371-
with -Ccodegen-units=1 to work around it.");
372-
}
373-
374355
trans_closure_body_via_mir(ccx, closure_def_id, substs);
375356
}
376357
}

src/librustc_trans/consts.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,12 +1150,7 @@ pub fn trans_static(ccx: &CrateContext,
11501150
let def_id = ccx.tcx().map.local_def_id(id);
11511151
let datum = get_static(ccx, def_id);
11521152

1153-
let check_attrs = |attrs: &[ast::Attribute]| {
1154-
let default_to_mir = ccx.sess().opts.debugging_opts.orbit;
1155-
let invert = if default_to_mir { "rustc_no_mir" } else { "rustc_mir" };
1156-
default_to_mir ^ attrs.iter().any(|item| item.check_name(invert))
1157-
};
1158-
let use_mir = check_attrs(ccx.tcx().map.attrs(id));
1153+
let use_mir = true;
11591154

11601155
let v = if use_mir {
11611156
::mir::trans_static_initializer(ccx, def_id)

src/librustc_trans/mir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'tcx> LocalRef<'tcx> {
145145
///////////////////////////////////////////////////////////////////////////
146146

147147
pub fn trans_mir<'blk, 'tcx: 'blk>(fcx: &'blk FunctionContext<'blk, 'tcx>) {
148-
let bcx = fcx.init(false, None).build();
148+
let bcx = fcx.init(true, None).build();
149149
let mir = bcx.mir();
150150

151151
// Analyze the temps to determine which must be lvalues

src/libsyntax/feature_gate.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,6 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGat
517517
is just used for rustc unit tests \
518518
and will never be stable",
519519
cfg_fn!(rustc_attrs))),
520-
("rustc_no_mir", Whitelisted, Gated("rustc_attrs",
521-
"the `#[rustc_no_mir]` attribute \
522-
is just used to make tests pass \
523-
and will never be stable",
524-
cfg_fn!(rustc_attrs))),
525520
("rustc_inherit_overflow_checks", Whitelisted, Gated("rustc_attrs",
526521
"the `#[rustc_inherit_overflow_checks]` \
527522
attribute is just used to control \

src/test/codegen/adjustments.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14-
#![feature(rustc_attrs)]
1514

1615
// Hack to get the correct size for the length part in slices
1716
// CHECK: @helper([[USIZE:i[0-9]+]])
@@ -21,13 +20,12 @@ fn helper(_: usize) {
2120

2221
// CHECK-LABEL: @no_op_slice_adjustment
2322
#[no_mangle]
24-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2523
pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] {
2624
// We used to generate an extra alloca and memcpy for the block's trailing expression value, so
2725
// check that we copy directly to the return value slot
28-
// CHECK: [[SRC:%[0-9]+]] = bitcast { i8*, [[USIZE]] }* %x to
29-
// CHECK: [[DST:%[0-9]+]] = bitcast { i8*, [[USIZE]] }* %sret_slot to i8*
30-
// CHECK: call void @llvm.memcpy.{{.*}}(i8* [[DST]], i8* [[SRC]],
26+
// CHECK: %2 = insertvalue { i8*, [[USIZE]] } undef, i8* %0, 0
27+
// CHECK: %3 = insertvalue { i8*, [[USIZE]] } %2, [[USIZE]] %1, 1
28+
// CHECK: ret { i8*, [[USIZE]] } %3
3129
{ x }
3230
}
3331

src/test/codegen/coercions.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,19 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14-
#![feature(rustc_attrs)]
1514

1615
static X: i32 = 5;
1716

1817
// CHECK-LABEL: @raw_ptr_to_raw_ptr_noop
1918
// CHECK-NOT: alloca
2019
#[no_mangle]
21-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2220
pub fn raw_ptr_to_raw_ptr_noop() -> *const i32{
2321
&X as *const i32
2422
}
2523

2624
// CHECK-LABEL: @reference_to_raw_ptr_noop
2725
// CHECK-NOT: alloca
2826
#[no_mangle]
29-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
3027
pub fn reference_to_raw_ptr_noop() -> *const i32 {
3128
&X
3229
}

src/test/codegen/consts.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14-
#![feature(rustc_attrs)]
1514

1615
// Below, these constants are defined as enum variants that by itself would
1716
// have a lower alignment than the enum type. Ensure that we mark them
@@ -20,11 +19,12 @@
2019
// CHECK: @STATIC = {{.*}}, align 4
2120

2221
// This checks the constants from inline_enum_const
23-
// CHECK: @const{{[0-9]+}} = {{.*}}, align 2
22+
// CHECK: @ref{{[0-9]+}} = {{.*}}, align 2
2423

2524
// This checks the constants from {low,high}_align_const, they share the same
2625
// constant, but the alignment differs, so the higher one should be used
27-
// CHECK: @const{{[0-9]+}} = {{.*}}, align 4
26+
// CHECK: [[LOW_HIGH:@ref[0-9]+]] = {{.*}}, align 4
27+
// CHECK: [[LOW_HIGH_REF:@const[0-9]+]] = {{.*}} [[LOW_HIGH]]
2828

2929
#[derive(Copy, Clone)]
3030

@@ -40,32 +40,28 @@ pub static STATIC: E<i16, i32> = E::A(0);
4040

4141
// CHECK-LABEL: @static_enum_const
4242
#[no_mangle]
43-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
4443
pub fn static_enum_const() -> E<i16, i32> {
4544
STATIC
4645
}
4746

4847
// CHECK-LABEL: @inline_enum_const
4948
#[no_mangle]
50-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
5149
pub fn inline_enum_const() -> E<i8, i16> {
52-
E::A(0)
50+
*&E::A(0)
5351
}
5452

5553
// CHECK-LABEL: @low_align_const
5654
#[no_mangle]
57-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
5855
pub fn low_align_const() -> E<i16, [i16; 3]> {
5956
// Check that low_align_const and high_align_const use the same constant
60-
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{[0-9]+}}, i8* {{.*}} [[LOW_HIGH:@const[0-9]+]]
61-
E::A(0)
57+
// CHECK: load {{.*}} bitcast ({ i16, i16, [4 x i8] }** [[LOW_HIGH_REF]]
58+
*&E::A(0)
6259
}
6360

6461
// CHECK-LABEL: @high_align_const
6562
#[no_mangle]
66-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
6763
pub fn high_align_const() -> E<i16, i32> {
6864
// Check that low_align_const and high_align_const use the same constant
69-
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{[0-9]}}, i8* {{.*}} [[LOW_HIGH]]
70-
E::A(0)
65+
// CHECK: load {{.*}} bitcast ({ i16, i16, [4 x i8] }** [[LOW_HIGH_REF]]
66+
*&E::A(0)
7167
}

src/test/codegen/drop.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14-
#![feature(rustc_attrs)]
1514

1615
struct SomeUniqueName;
1716

@@ -25,19 +24,20 @@ pub fn possibly_unwinding() {
2524

2625
// CHECK-LABEL: @droppy
2726
#[no_mangle]
28-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2927
pub fn droppy() {
3028
// Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, so
3129
// that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the
3230
// regular function exit. We used to have problems with quadratic growths of drop calls in such
3331
// functions.
34-
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
35-
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
36-
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
32+
// CHECK-NOT: invoke{{.*}}drop{{.*}}SomeUniqueName
3733
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
3834
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
3935
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
4036
// CHECK-NOT: call{{.*}}drop{{.*}}SomeUniqueName
37+
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
38+
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
39+
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
40+
// CHECK-NOT: {{(call|invoke).*}}drop{{.*}}SomeUniqueName
4141
// The next line checks for the } that ends the function definition
4242
// CHECK-LABEL: {{^[}]}}
4343
let _s = SomeUniqueName;

src/test/codegen/loads.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// compile-flags: -C no-prepopulate-passes
1212

1313
#![crate_type = "lib"]
14-
#![feature(rustc_attrs)]
1514

1615
pub struct Bytes {
1716
a: u8,
@@ -22,15 +21,14 @@ pub struct Bytes {
2221

2322
// CHECK-LABEL: @borrow
2423
#[no_mangle]
25-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
2624
pub fn borrow(x: &i32) -> &i32 {
2725
// CHECK: load {{(i32\*, )?}}i32** %x{{.*}}, !nonnull
26+
&x; // keep variable in an alloca
2827
x
2928
}
3029

3130
// CHECK-LABEL: @_box
3231
#[no_mangle]
33-
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
3432
pub fn _box(x: Box<i32>) -> i32 {
3533
// CHECK: load {{(i32\*, )?}}i32** %x{{.*}}, !nonnull
3634
*x

src/test/codegen/mir_zst_stores.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// compile-flags: -C no-prepopulate-passes
1212

13-
#![feature(rustc_attrs)]
1413
#![crate_type = "lib"]
1514
use std::marker::PhantomData;
1615

@@ -19,7 +18,6 @@ struct Zst { phantom: PhantomData<Zst> }
1918

2019
// CHECK-LABEL: @mir
2120
#[no_mangle]
22-
#[rustc_mir]
2321
fn mir(){
2422
// CHECK-NOT: getelementptr
2523
// CHECK-NOT: store{{.*}}undef

0 commit comments

Comments
 (0)