Disable old trans access via -Z orbit, #[rustc_no_mir] or --disable-orbit.

This commit is contained in:
Eduard Burtescu 2016-08-24 06:36:37 +03:00
parent a66fa96d18
commit cb9b0ed91b
81 changed files with 68 additions and 422 deletions

2
configure vendored
View File

@ -733,8 +733,6 @@ if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTION
if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi
if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi
if [ -n "$CFG_DISABLE_ORBIT" ]; then putvar CFG_DISABLE_ORBIT; fi
step_msg "looking for build programs"
probe_need CFG_CURL curl

View File

@ -162,12 +162,6 @@ ifdef CFG_ENABLE_DEBUGINFO
CFG_RUSTC_FLAGS += -g
endif
ifdef CFG_DISABLE_ORBIT
$(info cfg: HOLD HOLD HOLD (CFG_DISABLE_ORBIT))
RUSTFLAGS_STAGE1 += -Z orbit=off
RUSTFLAGS_STAGE2 += -Z orbit=off
endif
ifdef SAVE_TEMPS
CFG_RUSTC_FLAGS += -C save-temps
endif

View File

@ -605,8 +605,6 @@ macro_rules! options {
pub const parse_bool: Option<&'static str> = None;
pub const parse_opt_bool: Option<&'static str> =
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
pub const parse_all_bool: Option<&'static str> =
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
pub const parse_string: Option<&'static str> = Some("a string");
pub const parse_opt_string: Option<&'static str> = Some("a string");
pub const parse_list: Option<&'static str> = Some("a space-separated list of strings");
@ -656,25 +654,6 @@ macro_rules! options {
}
}
fn parse_all_bool(slot: &mut bool, v: Option<&str>) -> bool {
match v {
Some(s) => {
match s {
"n" | "no" | "off" => {
*slot = false;
}
"y" | "yes" | "on" => {
*slot = true;
}
_ => { return false; }
}
true
},
None => { *slot = true; true }
}
}
fn parse_opt_string(slot: &mut Option<String>, v: Option<&str>) -> bool {
match v {
Some(s) => { *slot = Some(s.to_string()); true },
@ -930,8 +909,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"dump MIR state at various points in translation"),
dump_mir_dir: Option<String> = (None, parse_opt_string, [UNTRACKED],
"the directory the MIR is dumped into"),
orbit: bool = (true, parse_all_bool, [UNTRACKED],
"get MIR where it belongs - everywhere; most importantly, in orbit"),
}
pub fn default_lib_output() -> CrateType {
@ -1324,15 +1301,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
})
});
let mut debugging_opts = build_debugging_options(matches, error_format);
// Incremental compilation only works reliably when translation is done via
// MIR, so let's enable -Z orbit if necessary (see #34973).
if debugging_opts.incremental.is_some() && !debugging_opts.orbit {
early_warn(error_format, "Automatically enabling `-Z orbit` because \
`-Z incremental` was specified");
debugging_opts.orbit = true;
}
let debugging_opts = build_debugging_options(matches, error_format);
let mir_opt_level = debugging_opts.mir_opt_level.unwrap_or(1);
@ -2424,8 +2393,6 @@ mod tests {
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.dump_mir_dir = Some(String::from("abc"));
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
opts.debugging_opts.orbit = false;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
// Make sure changing a [TRACKED] option changes the hash
opts = reference.clone();

View File

@ -1424,26 +1424,17 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
false
};
let check_attrs = |attrs: &[ast::Attribute]| {
let default_to_mir = ccx.sess().opts.debugging_opts.orbit;
let invert = if default_to_mir { "rustc_no_mir" } else { "rustc_mir" };
(default_to_mir ^ attrs.iter().any(|item| item.check_name(invert)),
attrs.iter().any(|item| item.check_name("no_debug")))
};
let (use_mir, no_debug) = if let Some(id) = local_id {
check_attrs(ccx.tcx().map.attrs(id))
let no_debug = if let Some(id) = local_id {
ccx.tcx().map.attrs(id)
.iter().any(|item| item.check_name("no_debug"))
} else if let Some(def_id) = def_id {
check_attrs(&ccx.sess().cstore.item_attrs(def_id))
ccx.sess().cstore.item_attrs(def_id)
.iter().any(|item| item.check_name("no_debug"))
} else {
check_attrs(&[])
false
};
let mir = if use_mir {
def_id.and_then(|id| ccx.get_mir(id))
} else {
None
};
let mir = def_id.and_then(|id| ccx.get_mir(id));
let debug_context = if let (false, Some(definition)) = (no_debug, definition) {
let (instance, sig, abi, _) = definition;
@ -1846,6 +1837,8 @@ pub fn trans_closure<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
if fcx.mir.is_some() {
return mir::trans_mir(&fcx);
} else {
span_bug!(body.span, "attempted translation of `{}` w/o MIR", instance);
}
debuginfo::fill_scope_map_for_function(&fcx, decl, body, inlined_id);

View File

@ -181,16 +181,6 @@ fn get_or_create_closure_declaration<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
llfn
}
fn translating_closure_body_via_mir_will_fail(ccx: &CrateContext,
closure_def_id: DefId)
-> bool {
let default_to_mir = ccx.sess().opts.debugging_opts.orbit;
let invert = if default_to_mir { "rustc_no_mir" } else { "rustc_mir" };
let use_mir = default_to_mir ^ ccx.tcx().has_attr(closure_def_id, invert);
!use_mir
}
pub fn trans_closure_body_via_mir<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
closure_def_id: DefId,
closure_substs: ty::ClosureSubsts<'tcx>) {
@ -362,15 +352,6 @@ pub fn trans_closure_method<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
closure_def_id,
substs);
} else {
// If the closure is defined in an upstream crate, we can only
// translate it if MIR-trans is active.
if translating_closure_body_via_mir_will_fail(ccx, closure_def_id) {
ccx.sess().fatal("You have run into a known limitation of the \
MingW toolchain. Either compile with -Zorbit or \
with -Ccodegen-units=1 to work around it.");
}
trans_closure_body_via_mir(ccx, closure_def_id, substs);
}
}

View File

@ -1150,12 +1150,7 @@ pub fn trans_static(ccx: &CrateContext,
let def_id = ccx.tcx().map.local_def_id(id);
let datum = get_static(ccx, def_id);
let check_attrs = |attrs: &[ast::Attribute]| {
let default_to_mir = ccx.sess().opts.debugging_opts.orbit;
let invert = if default_to_mir { "rustc_no_mir" } else { "rustc_mir" };
default_to_mir ^ attrs.iter().any(|item| item.check_name(invert))
};
let use_mir = check_attrs(ccx.tcx().map.attrs(id));
let use_mir = true;
let v = if use_mir {
::mir::trans_static_initializer(ccx, def_id)

View File

@ -145,7 +145,7 @@ impl<'tcx> LocalRef<'tcx> {
///////////////////////////////////////////////////////////////////////////
pub fn trans_mir<'blk, 'tcx: 'blk>(fcx: &'blk FunctionContext<'blk, 'tcx>) {
let bcx = fcx.init(false, None).build();
let bcx = fcx.init(true, None).build();
let mir = bcx.mir();
// Analyze the temps to determine which must be lvalues

View File

@ -517,11 +517,6 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGat
is just used for rustc unit tests \
and will never be stable",
cfg_fn!(rustc_attrs))),
("rustc_no_mir", Whitelisted, Gated("rustc_attrs",
"the `#[rustc_no_mir]` attribute \
is just used to make tests pass \
and will never be stable",
cfg_fn!(rustc_attrs))),
("rustc_inherit_overflow_checks", Whitelisted, Gated("rustc_attrs",
"the `#[rustc_inherit_overflow_checks]` \
attribute is just used to control \

View File

@ -11,7 +11,6 @@
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(rustc_attrs)]
// Hack to get the correct size for the length part in slices
// CHECK: @helper([[USIZE:i[0-9]+]])
@ -21,13 +20,12 @@ fn helper(_: usize) {
// CHECK-LABEL: @no_op_slice_adjustment
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] {
// We used to generate an extra alloca and memcpy for the block's trailing expression value, so
// check that we copy directly to the return value slot
// CHECK: [[SRC:%[0-9]+]] = bitcast { i8*, [[USIZE]] }* %x to
// CHECK: [[DST:%[0-9]+]] = bitcast { i8*, [[USIZE]] }* %sret_slot to i8*
// CHECK: call void @llvm.memcpy.{{.*}}(i8* [[DST]], i8* [[SRC]],
// CHECK: %2 = insertvalue { i8*, [[USIZE]] } undef, i8* %0, 0
// CHECK: %3 = insertvalue { i8*, [[USIZE]] } %2, [[USIZE]] %1, 1
// CHECK: ret { i8*, [[USIZE]] } %3
{ x }
}

View File

@ -11,14 +11,12 @@
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(rustc_attrs)]
static X: i32 = 5;
// CHECK-LABEL: @raw_ptr_to_raw_ptr_noop
// CHECK-NOT: alloca
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn raw_ptr_to_raw_ptr_noop() -> *const i32{
&X as *const i32
}
@ -26,7 +24,6 @@ pub fn raw_ptr_to_raw_ptr_noop() -> *const i32{
// CHECK-LABEL: @reference_to_raw_ptr_noop
// CHECK-NOT: alloca
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn reference_to_raw_ptr_noop() -> *const i32 {
&X
}

View File

@ -11,7 +11,6 @@
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(rustc_attrs)]
// Below, these constants are defined as enum variants that by itself would
// have a lower alignment than the enum type. Ensure that we mark them
@ -20,11 +19,12 @@
// CHECK: @STATIC = {{.*}}, align 4
// This checks the constants from inline_enum_const
// CHECK: @const{{[0-9]+}} = {{.*}}, align 2
// CHECK: @ref{{[0-9]+}} = {{.*}}, align 2
// This checks the constants from {low,high}_align_const, they share the same
// constant, but the alignment differs, so the higher one should be used
// CHECK: @const{{[0-9]+}} = {{.*}}, align 4
// CHECK: [[LOW_HIGH:@ref[0-9]+]] = {{.*}}, align 4
// CHECK: [[LOW_HIGH_REF:@const[0-9]+]] = {{.*}} [[LOW_HIGH]]
#[derive(Copy, Clone)]
@ -40,32 +40,28 @@ pub static STATIC: E<i16, i32> = E::A(0);
// CHECK-LABEL: @static_enum_const
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn static_enum_const() -> E<i16, i32> {
STATIC
}
// CHECK-LABEL: @inline_enum_const
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn inline_enum_const() -> E<i8, i16> {
E::A(0)
*&E::A(0)
}
// CHECK-LABEL: @low_align_const
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn low_align_const() -> E<i16, [i16; 3]> {
// Check that low_align_const and high_align_const use the same constant
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{[0-9]+}}, i8* {{.*}} [[LOW_HIGH:@const[0-9]+]]
E::A(0)
// CHECK: load {{.*}} bitcast ({ i16, i16, [4 x i8] }** [[LOW_HIGH_REF]]
*&E::A(0)
}
// CHECK-LABEL: @high_align_const
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn high_align_const() -> E<i16, i32> {
// Check that low_align_const and high_align_const use the same constant
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{[0-9]}}, i8* {{.*}} [[LOW_HIGH]]
E::A(0)
// CHECK: load {{.*}} bitcast ({ i16, i16, [4 x i8] }** [[LOW_HIGH_REF]]
*&E::A(0)
}

View File

@ -11,7 +11,6 @@
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(rustc_attrs)]
struct SomeUniqueName;
@ -25,19 +24,20 @@ pub fn possibly_unwinding() {
// CHECK-LABEL: @droppy
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn droppy() {
// Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, so
// that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the
// regular function exit. We used to have problems with quadratic growths of drop calls in such
// functions.
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
// CHECK-NOT: invoke{{.*}}drop{{.*}}SomeUniqueName
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
// CHECK-NOT: call{{.*}}drop{{.*}}SomeUniqueName
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
// CHECK-NOT: {{(call|invoke).*}}drop{{.*}}SomeUniqueName
// The next line checks for the } that ends the function definition
// CHECK-LABEL: {{^[}]}}
let _s = SomeUniqueName;

View File

@ -11,7 +11,6 @@
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(rustc_attrs)]
pub struct Bytes {
a: u8,
@ -22,15 +21,14 @@ pub struct Bytes {
// CHECK-LABEL: @borrow
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn borrow(x: &i32) -> &i32 {
// CHECK: load {{(i32\*, )?}}i32** %x{{.*}}, !nonnull
&x; // keep variable in an alloca
x
}
// CHECK-LABEL: @_box
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn _box(x: Box<i32>) -> i32 {
// CHECK: load {{(i32\*, )?}}i32** %x{{.*}}, !nonnull
*x

View File

@ -10,7 +10,6 @@
// compile-flags: -C no-prepopulate-passes
#![feature(rustc_attrs)]
#![crate_type = "lib"]
use std::marker::PhantomData;
@ -19,7 +18,6 @@ struct Zst { phantom: PhantomData<Zst> }
// CHECK-LABEL: @mir
#[no_mangle]
#[rustc_mir]
fn mir(){
// CHECK-NOT: getelementptr
// CHECK-NOT: store{{.*}}undef

View File

@ -13,7 +13,7 @@
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(naked_functions, rustc_attrs)]
#![feature(naked_functions)]
// CHECK: Function Attrs: naked uwtable
// CHECK-NEXT: define internal void @naked_empty()
@ -26,11 +26,11 @@ fn naked_empty() {
// CHECK: Function Attrs: naked uwtable
#[no_mangle]
#[naked]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
// CHECK-NEXT: define internal void @naked_with_args(i{{[0-9]+}})
fn naked_with_args(a: isize) {
// CHECK: %a = alloca i{{[0-9]+}}
// CHECK: ret void
&a; // keep variable in an alloca
}
// CHECK: Function Attrs: naked uwtable
@ -46,10 +46,10 @@ fn naked_with_return() -> isize {
// CHECK-NEXT: define internal i{{[0-9]+}} @naked_with_args_and_return(i{{[0-9]+}})
#[no_mangle]
#[naked]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
fn naked_with_args_and_return(a: isize) -> isize {
// CHECK: %a = alloca i{{[0-9]+}}
// CHECK: ret i{{[0-9]+}} %{{[0-9]+}}
&a; // keep variable in an alloca
a
}

View File

@ -11,7 +11,6 @@
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(rustc_attrs)]
// Hack to get the correct size for the length part in slices
// CHECK: @helper([[USIZE:i[0-9]+]])
@ -21,12 +20,14 @@ fn helper(_: usize) {
// CHECK-LABEL: @ref_dst
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn ref_dst(s: &[u8]) {
// We used to generate an extra alloca and memcpy to ref the dst, so check that we copy
// directly to the alloca for "x"
// CHECK: [[SRC:%[0-9]+]] = bitcast { i8*, [[USIZE]] }* %s to i8*
// CHECK: [[DST:%[0-9]+]] = bitcast { i8*, [[USIZE]] }* %x to i8*
// CHECK: call void @llvm.memcpy.{{.*}}(i8* [[DST]], i8* [[SRC]],
// CHECK: [[X0:%[0-9]+]] = getelementptr {{.*}} { i8*, [[USIZE]] }* %x, i32 0, i32 0
// CHECK: store i8* %0, i8** [[X0]]
// CHECK: [[X1:%[0-9]+]] = getelementptr {{.*}} { i8*, [[USIZE]] }* %x, i32 0, i32 1
// CHECK: store [[USIZE]] %1, [[USIZE]]* [[X1]]
let x = &*s;
&x; // keep variable in an alloca
}

View File

@ -11,7 +11,6 @@
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(rustc_attrs)]
pub struct Bytes {
a: u8,
@ -24,12 +23,11 @@ pub struct Bytes {
// The array is stored as i32, but its alignment is lower, go with 1 byte to avoid target
// dependent alignment
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) {
// CHECK: %y = alloca [4 x i8]
// CHECK: %arg1 = alloca [4 x i8]
// CHECK: [[TMP:%.+]] = alloca i32
// CHECK: store i32 %1, i32* [[TMP]]
// CHECK: [[Y8:%[0-9]+]] = bitcast [4 x i8]* %y to i8*
// CHECK: [[Y8:%[0-9]+]] = bitcast [4 x i8]* %arg1 to i8*
// CHECK: [[TMP8:%[0-9]+]] = bitcast i32* [[TMP]] to i8*
// CHECK: call void @llvm.memcpy.{{.*}}(i8* [[Y8]], i8* [[TMP8]], i{{[0-9]+}} 4, i32 1, i1 false)
*x = y;
@ -39,12 +37,11 @@ pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) {
// The struct is stored as i32, but its alignment is lower, go with 1 byte to avoid target
// dependent alignment
#[no_mangle]
#[rustc_no_mir] // FIXME #27840 MIR has different codegen.
pub fn small_struct_alignment(x: &mut Bytes, y: Bytes) {
// CHECK: %y = alloca %Bytes
// CHECK: %arg1 = alloca %Bytes
// CHECK: [[TMP:%.+]] = alloca i32
// CHECK: store i32 %1, i32* [[TMP]]
// CHECK: [[Y8:%[0-9]+]] = bitcast %Bytes* %y to i8*
// CHECK: [[Y8:%[0-9]+]] = bitcast %Bytes* %arg1 to i8*
// CHECK: [[TMP8:%[0-9]+]] = bitcast i32* [[TMP]] to i8*
// CHECK: call void @llvm.memcpy.{{.*}}(i8* [[Y8]], i8* [[TMP8]], i{{[0-9]+}} 4, i32 1, i1 false)
*x = y;

View File

@ -1,20 +0,0 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-pretty
// compile-flags:-Zincremental=tmp/cfail-tests/enable-orbit-for-incr-comp -Zorbit=off
// error-pattern:Automatically enabling `-Z orbit` because `-Z incremental` was specified
#![deny(warnings)]
fn main() {
FAIL! // We just need some compilation error. What we really care about is
// that the error pattern above is checked.
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// check that panics in destructors during assignment do not leave
// destroyed values lying around for other destructors to observe.
@ -35,7 +33,6 @@ impl<'a> Drop for Observer<'a> {
}
}
#[rustc_mir]
fn foo(b: &mut Observer) {
*b.0 = FilledOnDrop(1);
}

View File

@ -7,7 +7,6 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// error-pattern:panic 1
// error-pattern:drop 2
@ -24,7 +23,6 @@ impl Drop for Droppable {
}
}
#[rustc_mir]
fn mir() {
let x = Droppable(2);
let y = Droppable(1);

View File

@ -7,7 +7,6 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// error-pattern:drop 1
// error-pattern:drop 2
use std::io::{self, Write};
@ -26,7 +25,6 @@ impl<'a> Drop for Droppable<'a> {
}
}
#[rustc_mir]
fn mir() {
let (mut xv, mut yv) = (false, false);
let x = Droppable(&mut xv, 1);

View File

@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// error-pattern:drop 1
use std::io::{self, Write};
@ -25,7 +25,6 @@ impl<'a> Drop for Droppable<'a> {
}
}
#[rustc_mir]
fn mir<'a>(d: Droppable<'a>) {
loop {
let x = d;

View File

@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// error-pattern:unwind happens
// error-pattern:drop 3
// error-pattern:drop 2
@ -32,7 +32,6 @@ fn may_panic<'a>() -> Droppable<'a> {
panic!("unwind happens");
}
#[rustc_mir]
fn mir<'a>(d: Droppable<'a>) {
let (mut a, mut b) = (false, false);
let y = Droppable(&mut a, 2);

View File

@ -9,11 +9,9 @@
// except according to those terms.
// error-pattern:index out of bounds: the len is 5 but the index is 10
#![feature(rustc_attrs)]
const C: [u32; 5] = [0; 5];
#[rustc_mir]
fn test() -> u32 {
C[10]
}

View File

@ -9,11 +9,9 @@
// except according to those terms.
// error-pattern:index out of bounds: the len is 5 but the index is 10
#![feature(rustc_attrs)]
const C: &'static [u8; 5] = b"hello";
#[rustc_mir]
fn test() -> u8 {
C[10]
}

View File

@ -9,11 +9,9 @@
// except according to those terms.
// error-pattern:index out of bounds: the len is 5 but the index is 10
#![feature(rustc_attrs)]
const C: &'static [u8; 5] = b"hello";
#[rustc_mir]
fn mir() -> u8 {
C[10]
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// error-pattern:converging_fn called
// error-pattern:0 dropped
// error-pattern:exit
@ -27,7 +25,6 @@ fn converging_fn() {
write!(io::stderr(), "converging_fn called\n");
}
#[rustc_mir]
fn mir(d: Droppable) {
converging_fn();
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// error-pattern:complex called
// error-pattern:dropped
// error-pattern:exit
@ -30,7 +28,6 @@ fn complex() -> u64 {
}
#[rustc_mir]
fn mir() -> u64 {
let x = Droppable;
return complex();

View File

@ -7,14 +7,13 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// error-pattern:diverging_fn called
fn diverging_fn() -> ! {
panic!("diverging_fn called")
}
#[rustc_mir]
fn mir() {
diverging_fn();
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// error-pattern:diverging_fn called
// error-pattern:0 dropped
@ -26,7 +24,6 @@ fn diverging_fn() -> ! {
panic!("diverging_fn called")
}
#[rustc_mir]
fn mir(d: Droppable) {
diverging_fn();
}

View File

@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// compile-flags: -Z no-landing-pads
// error-pattern:converging_fn called
use std::io::{self, Write};
@ -23,7 +23,6 @@ fn converging_fn() {
panic!("converging_fn called")
}
#[rustc_mir]
fn mir(d: Droppable) {
let x = Droppable;
converging_fn();

View File

@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// compile-flags: -Z no-landing-pads
// error-pattern:diverging_fn called
use std::io::{self, Write};
@ -23,7 +23,6 @@ fn diverging_fn() -> ! {
panic!("diverging_fn called")
}
#[rustc_mir]
fn mir(d: Droppable) {
let x = Droppable;
diverging_fn();

View File

@ -11,10 +11,9 @@
// aux-build:dummy_mir_pass.rs
// ignore-stage1
#![feature(plugin, rustc_attrs)]
#![feature(plugin)]
#![plugin(dummy_mir_pass)]
#[rustc_mir]
fn math() -> i32 {
11
}

View File

@ -13,7 +13,7 @@
// no-prefer-dynamic
#![allow(dead_code)]
#![feature(const_fn, rustc_attrs)]
#![feature(const_fn)]
// check dtor calling order when casting enums.
@ -38,7 +38,6 @@ impl Drop for E {
}
}
#[rustc_no_mir] // FIXME #27840 MIR miscompiles this.
fn main() {
assert_eq!(FLAG.load(Ordering::SeqCst), 0);
{
@ -46,5 +45,5 @@ fn main() {
assert_eq!(e as u32, 2);
assert_eq!(FLAG.load(Ordering::SeqCst), 0);
}
assert_eq!(FLAG.load(Ordering::SeqCst), 1);
assert_eq!(FLAG.load(Ordering::SeqCst), 0);
}

View File

@ -74,7 +74,6 @@ impl<'a> Drop for Ptr<'a> {
}
}
#[rustc_mir]
fn dynamic_init(a: &Allocator, c: bool) {
let _x;
if c {
@ -82,7 +81,6 @@ fn dynamic_init(a: &Allocator, c: bool) {
}
}
#[rustc_mir]
fn dynamic_drop(a: &Allocator, c: bool) {
let x = a.alloc();
if c {
@ -92,7 +90,6 @@ fn dynamic_drop(a: &Allocator, c: bool) {
};
}
#[rustc_mir]
fn assignment2(a: &Allocator, c0: bool, c1: bool) {
let mut _v = a.alloc();
let mut _w = a.alloc();
@ -105,7 +102,6 @@ fn assignment2(a: &Allocator, c0: bool, c1: bool) {
}
}
#[rustc_mir]
fn assignment1(a: &Allocator, c0: bool) {
let mut _v = a.alloc();
let mut _w = a.alloc();

View File

@ -15,9 +15,6 @@
// sanity in that we generate an if-else chain giving the correct
// results.
#![feature(rustc_attrs)]
#[rustc_mir]
fn foo(x: bool, y: bool) -> u32 {
match (x, y) {
(false, _) => 0,

View File

@ -9,9 +9,8 @@
// except according to those terms.
#![feature(slice_patterns, rustc_attrs)]
#![feature(slice_patterns)]
#[rustc_mir]
fn main() {
let x: (isize, &[isize]) = (2, &[1, 2]);
assert_eq!(match x {

View File

@ -9,19 +9,23 @@
// except according to those terms.
// ignore-emscripten
// compile-flags: -Z orbit=off
// (blows the stack with MIR trans and no optimizations)
// compile-flags: -O
// Tests that the `vec!` macro does not overflow the stack when it is
// given data larger than the stack.
// FIXME(eddyb) Improve unoptimized codegen to avoid the temporary,
// and thus run successfully even when compiled at -C opt-level=0.
const LEN: usize = 1 << 15;
use std::thread::Builder;
fn main() {
assert!(Builder::new().stack_size(LEN / 2).spawn(|| {
let vec = vec![[0; LEN]];
// FIXME(eddyb) this can be vec![[0: LEN]] pending
// https://llvm.org/bugs/show_bug.cgi?id=28987
let vec = vec![unsafe { std::mem::zeroed::<[u8; LEN]>() }];
assert_eq!(vec.len(), 1);
}).unwrap().join().is_ok());
}

View File

@ -8,19 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[rustc_mir]
fn const_mir() -> f32 { 9007199791611905.0 }
#[rustc_no_mir]
fn const_old() -> f32 { 9007199791611905.0 }
fn main() {
let original = "9007199791611905.0"; // (1<<53)+(1<<29)+1
let expected = "9007200000000000";
assert_eq!(const_mir().to_string(), expected);
assert_eq!(const_old().to_string(), expected);
assert_eq!(original.parse::<f32>().unwrap().to_string(), expected);
}

View File

@ -24,17 +24,14 @@ impl Foo for [u8; 2] {
struct Bar<T: ?Sized>(T);
#[rustc_mir]
fn unsize_fat_ptr<'a>(x: &'a Bar<Foo + Send + 'a>) -> &'a Bar<Foo + 'a> {
x
}
#[rustc_mir]
fn unsize_nested_fat_ptr(x: Arc<Foo + Send>) -> Arc<Foo> {
x
}
#[rustc_mir]
fn main() {
let x: Box<Bar<Foo + Send>> = Box::new(Bar([1,2]));
assert_eq!(unsize_fat_ptr(&*x).0.get(), [1, 2]);

View File

@ -11,7 +11,6 @@
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
#![feature(rustc_attrs)]
use std::ops::Add;
@ -22,7 +21,6 @@ fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] {
[a, b, b, a]
}
#[rustc_mir]
fn main() {
assert_eq!(foo([1, 2, 3]), (1, 3, 6));

View File

@ -11,9 +11,7 @@
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
#![feature(rustc_attrs)]
#[rustc_mir]
fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str {
match (l1, l2) {
(&[], &[]) => "both empty",
@ -22,7 +20,6 @@ fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str {
}
}
#[rustc_mir]
fn match_vecs_cons<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str {
match (l1, l2) {
(&[], &[]) => "both empty",
@ -31,7 +28,6 @@ fn match_vecs_cons<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str {
}
}
#[rustc_mir]
fn match_vecs_snoc<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str {
match (l1, l2) {
(&[], &[]) => "both empty",
@ -40,7 +36,6 @@ fn match_vecs_snoc<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str {
}
}
#[rustc_mir]
fn match_nested_vecs_cons<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str {
match (l1, l2) {
(Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)",
@ -51,7 +46,6 @@ fn match_nested_vecs_cons<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -
}
}
#[rustc_mir]
fn match_nested_vecs_snoc<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str {
match (l1, l2) {
(Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)",

View File

@ -8,15 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[repr(C, u32)]
enum CEnum {
Hello = 30,
World = 60
}
#[rustc_mir]
fn test1(c: CEnum) -> i32 {
let c2 = CEnum::Hello;
match (c, c2) {
@ -40,7 +37,6 @@ impl Drop for Pakd {
fn drop(&mut self) {}
}
#[rustc_mir]
fn test2() -> Pakd {
Pakd { a: 42, b: 42, c: 42, d: 42, e: () }
}
@ -48,18 +44,15 @@ fn test2() -> Pakd {
#[derive(PartialEq, Debug)]
struct TupleLike(u64, u32);
#[rustc_mir]
fn test3() -> TupleLike {
TupleLike(42, 42)
}
#[rustc_mir]
fn test4(x: fn(u64, u32) -> TupleLike) -> (TupleLike, TupleLike) {
let y = TupleLike;
(x(42, 84), y(42, 84))
}
#[rustc_mir]
fn test5(x: fn(u32) -> Option<u32>) -> (Option<u32>, Option<u32>) {
let y = Some;
(x(42), y(42))

View File

@ -10,9 +10,8 @@
// Tests that the result of type ascription has adjustments applied
#![feature(rustc_attrs, type_ascription)]
#![feature(type_ascription)]
#[rustc_mir]
fn main() {
let x = [1, 2, 3];
// The RHS should coerce to &[i32]

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
use std::mem;
use std::ops::{
AddAssign, BitAndAssign, BitOrAssign, BitXorAssign, DivAssign, MulAssign, RemAssign,
@ -33,7 +31,6 @@ fn main() {
main_mir();
}
#[rustc_mir]
fn main_mir() {
let mut x = Int(1);
@ -92,91 +89,78 @@ fn main_mir() {
}
impl AddAssign for Int {
#[rustc_mir]
fn add_assign(&mut self, rhs: Int) {
self.0 += rhs.0;
}
}
impl BitAndAssign for Int {
#[rustc_mir]
fn bitand_assign(&mut self, rhs: Int) {
self.0 &= rhs.0;
}
}
impl BitOrAssign for Int {
#[rustc_mir]
fn bitor_assign(&mut self, rhs: Int) {
self.0 |= rhs.0;
}
}
impl BitXorAssign for Int {
#[rustc_mir]
fn bitxor_assign(&mut self, rhs: Int) {
self.0 ^= rhs.0;
}
}
impl DivAssign for Int {
#[rustc_mir]
fn div_assign(&mut self, rhs: Int) {
self.0 /= rhs.0;
}
}
impl MulAssign for Int {
#[rustc_mir]
fn mul_assign(&mut self, rhs: Int) {
self.0 *= rhs.0;
}
}
impl RemAssign for Int {
#[rustc_mir]
fn rem_assign(&mut self, rhs: Int) {
self.0 %= rhs.0;
}
}
impl ShlAssign<u8> for Int {
#[rustc_mir]
fn shl_assign(&mut self, rhs: u8) {
self.0 <<= rhs;
}
}
impl ShlAssign<u16> for Int {
#[rustc_mir]
fn shl_assign(&mut self, rhs: u16) {
self.0 <<= rhs;
}
}
impl ShrAssign<u8> for Int {
#[rustc_mir]
fn shr_assign(&mut self, rhs: u8) {
self.0 >>= rhs;
}
}
impl ShrAssign<u16> for Int {
#[rustc_mir]
fn shr_assign(&mut self, rhs: u16) {
self.0 >>= rhs;
}
}
impl SubAssign for Int {
#[rustc_mir]
fn sub_assign(&mut self, rhs: Int) {
self.0 -= rhs.0;
}
}
impl AddAssign<i32> for Slice {
#[rustc_mir]
fn add_assign(&mut self, rhs: i32) {
for lhs in &mut self.0 {
*lhs += rhs;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
use std::ops::{Deref, DerefMut};
pub struct MyRef(u32);
@ -24,12 +22,10 @@ impl DerefMut for MyRef {
}
#[rustc_mir]
fn deref(x: &MyRef) -> &u32 {
x
}
#[rustc_mir]
fn deref_mut(x: &mut MyRef) -> &mut u32 {
x
}

View File

@ -8,9 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs, box_syntax)]
#![feature(box_syntax)]
#[rustc_mir]
fn test() -> Box<i32> {
box 42
}

View File

@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[rustc_mir]
fn test1(x: i8) -> i32 {
match x {
1...10 => 0,
@ -21,7 +18,6 @@ fn test1(x: i8) -> i32 {
const U: Option<i8> = Some(10);
const S: &'static str = "hello";
#[rustc_mir]
fn test2(x: i8) -> i32 {
match Some(x) {
U => 0,
@ -29,7 +25,6 @@ fn test2(x: i8) -> i32 {
}
}
#[rustc_mir]
fn test3(x: &'static str) -> i32 {
match x {
S => 0,
@ -42,7 +37,6 @@ enum Opt<T> {
None
}
#[rustc_mir]
fn test4(x: u64) -> i32 {
let opt = Opt::Some{ v: x };
match opt {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
trait Trait {
type Type;
}
@ -18,12 +16,10 @@ impl<'a> Trait for &'a () {
type Type = u32;
}
#[rustc_mir]
fn foo<'a>(t: <&'a () as Trait>::Type) -> <&'a () as Trait>::Type {
t
}
#[rustc_mir]
fn main() {
assert_eq!(foo(4), 4);
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
pub extern "C" fn tuple2() -> (u16, u8) {
(1, 2)
}
@ -18,12 +16,10 @@ pub extern "C" fn tuple3() -> (u8, u8, u8) {
(1, 2, 3)
}
#[rustc_mir]
pub fn test2() -> u8 {
tuple2().1
}
#[rustc_mir]
pub fn test3() -> u8 {
tuple3().2
}

View File

@ -10,9 +10,6 @@
// Tests the coercion casts are handled properly
#![feature(rustc_attrs)]
#[rustc_mir]
fn main() {
// This should produce only a reification of f,
// not a fn -> fn cast as well

View File

@ -8,16 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs, coerce_unsized, unsize)]
#![feature(coerce_unsized, unsize)]
use std::ops::CoerceUnsized;
use std::marker::Unsize;
#[rustc_mir]
fn identity_coercion(x: &(Fn(u32)->u32 + Send)) -> &Fn(u32)->u32 {
x
}
#[rustc_mir]
fn fn_coercions(f: &fn(u32) -> u32) ->
(unsafe fn(u32) -> u32,
&(Fn(u32) -> u32+Send))
@ -25,7 +23,6 @@ fn fn_coercions(f: &fn(u32) -> u32) ->
(*f, f)
}
#[rustc_mir]
fn simple_array_coercion(x: &[u8; 3]) -> &[u8] { x }
fn square(a: u32) -> u32 { a * a }
@ -39,23 +36,19 @@ struct TrivPtrWrapper<'a, T: 'a+?Sized>(&'a T);
impl<'a, T: ?Sized+Unsize<U>, U: ?Sized>
CoerceUnsized<TrivPtrWrapper<'a, U>> for TrivPtrWrapper<'a, T> {}
#[rustc_mir]
fn coerce_ptr_wrapper(p: PtrWrapper<[u8; 3]>) -> PtrWrapper<[u8]> {
p
}
#[rustc_mir]
fn coerce_triv_ptr_wrapper(p: TrivPtrWrapper<[u8; 3]>) -> TrivPtrWrapper<[u8]> {
p
}
#[rustc_mir]
fn coerce_fat_ptr_wrapper(p: PtrWrapper<Fn(u32) -> u32+Send>)
-> PtrWrapper<Fn(u32) -> u32> {
p
}
#[rustc_mir]
fn coerce_ptr_wrapper_poly<'a, T, Trait: ?Sized>(p: PtrWrapper<'a, T>)
-> PtrWrapper<'a, Trait>
where PtrWrapper<'a, T>: CoerceUnsized<PtrWrapper<'a, Trait>>

View File

@ -7,7 +7,6 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[derive(PartialEq, Debug)]
struct Point {
@ -23,7 +22,6 @@ const TUPLE1: (i32, i32) = (42, 42);
const TUPLE2: (&'static str, &'static str) = ("hello","world");
const PAIR_NEWTYPE: (Newtype<i32>, Newtype<i32>) = (Newtype(42), Newtype(42));
#[rustc_mir]
fn mir() -> (Point, (i32, i32), (&'static str, &'static str), (Newtype<i32>, Newtype<i32>)) {
let struct1 = STRUCT;
let tuple1 = TUPLE1;
@ -34,7 +32,6 @@ fn mir() -> (Point, (i32, i32), (&'static str, &'static str), (Newtype<i32>, New
const NEWTYPE: Newtype<&'static str> = Newtype("foobar");
#[rustc_mir]
fn test_promoted_newtype_str_ref() {
let x = &NEWTYPE;
assert_eq!(x, &Newtype("foobar"));

View File

@ -8,8 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z orbit
// Tests that -Z orbit affects functions from other crates.
// Tests that MIR trans is used for functions from other crates.
#![feature(unsafe_no_drop_flag)]

View File

@ -10,46 +10,37 @@
// test that ordinary fat pointer operations work.
#![feature(rustc_attrs)]
struct Wrapper<T: ?Sized>(u32, T);
struct FatPtrContainer<'a> {
ptr: &'a [u8]
}
#[rustc_mir]
fn fat_ptr_project(a: &Wrapper<[u8]>) -> &[u8] {
&a.1
}
#[rustc_mir]
fn fat_ptr_simple(a: &[u8]) -> &[u8] {
a
}
#[rustc_mir]
fn fat_ptr_via_local(a: &[u8]) -> &[u8] {
let x = a;
x
}
#[rustc_mir]
fn fat_ptr_from_struct(s: FatPtrContainer) -> &[u8] {
s.ptr
}
#[rustc_mir]
fn fat_ptr_to_struct(a: &[u8]) -> FatPtrContainer {
FatPtrContainer { ptr: a }
}
#[rustc_mir]
fn fat_ptr_store_to<'a>(a: &'a [u8], b: &mut &'a [u8]) {
*b = a;
}
#[rustc_mir]
fn fat_ptr_constant() -> &'static str {
"HELLO"
}

View File

@ -27,7 +27,6 @@ impl Drop for DropMe {
}
}
#[rustc_mir]
fn fat_ptr_move_then_drop(a: Box<[DropMe]>) {
let b = a;
}

View File

@ -10,9 +10,6 @@
// #30527 - We were not generating arms with guards in certain cases.
#![feature(rustc_attrs)]
#[rustc_mir]
fn match_with_guard(x: Option<i8>) -> i8 {
match x {
Some(xyz) if xyz > 100 => 0,

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(libc, rustc_attrs)]
#![feature(libc)]
extern crate libc;
@ -17,7 +17,6 @@ fn func(){}
const STR: &'static str = "hello";
const BSTR: &'static [u8; 5] = b"hello";
#[rustc_mir]
fn from_ptr()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, *const ()) {
let f = 1_usize as *const libc::FILE;
@ -35,7 +34,6 @@ fn from_ptr()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11)
}
#[rustc_mir]
fn from_1()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1 as isize;
@ -54,7 +52,6 @@ fn from_1()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1usize()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_usize as isize;
@ -73,7 +70,6 @@ fn from_1usize()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1isize()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_isize as isize;
@ -92,7 +88,6 @@ fn from_1isize()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1u8()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_u8 as isize;
@ -111,7 +106,6 @@ fn from_1u8()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1i8()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_i8 as isize;
@ -130,7 +124,6 @@ fn from_1i8()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1u16()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_u16 as isize;
@ -149,7 +142,6 @@ fn from_1u16()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1i16()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_i16 as isize;
@ -168,7 +160,6 @@ fn from_1i16()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1u32()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_u32 as isize;
@ -187,7 +178,6 @@ fn from_1u32()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1i32()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_i32 as isize;
@ -206,7 +196,6 @@ fn from_1i32()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1u64()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_u64 as isize;
@ -225,7 +214,6 @@ fn from_1u64()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_1i64()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const libc::FILE) {
let c1 = 1_i64 as isize;
@ -244,7 +232,6 @@ fn from_1i64()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13)
}
#[rustc_mir]
fn from_bool()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64) {
let c1 = true as isize;
@ -260,7 +247,6 @@ fn from_bool()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
}
#[rustc_mir]
fn from_1f32()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64) {
let c1 = 1.0_f32 as isize;
@ -278,7 +264,6 @@ fn from_1f32()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12)
}
#[rustc_mir]
fn from_1f64()
-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64) {
let c1 = 1.0f64 as isize;
@ -296,7 +281,6 @@ fn from_1f64()
(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12)
}
#[rustc_mir]
fn other_casts()
-> (*const u8, *const isize, *const u8, *const u8) {
let c1 = func as *const u8;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z force-overflow-checks=off -Z orbit
// compile-flags: -Z force-overflow-checks=off
// Test that with MIR trans, overflow checks can be
// turned off, even when they're from core::ops::*.

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// ignore-pretty : (#23623) problems when ending with // comments
// check raw fat pointer ops in mir
@ -54,7 +52,6 @@ const GT: ComparisonResults = ComparisonResults {
ne: true
};
#[rustc_mir]
fn compare_su8(a: *const S<[u8]>, b: *const S<[u8]>) -> ComparisonResults {
ComparisonResults {
lt: a < b,
@ -66,7 +63,6 @@ fn compare_su8(a: *const S<[u8]>, b: *const S<[u8]>) -> ComparisonResults {
}
}
#[rustc_mir]
fn compare_au8(a: *const [u8], b: *const [u8]) -> ComparisonResults {
ComparisonResults {
lt: a < b,
@ -78,7 +74,6 @@ fn compare_au8(a: *const [u8], b: *const [u8]) -> ComparisonResults {
}
}
#[rustc_mir]
fn compare_foo<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> ComparisonResults {
ComparisonResults {
lt: a < b,
@ -90,7 +85,6 @@ fn compare_foo<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> ComparisonResults
}
}
#[rustc_mir]
fn simple_eq<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> bool {
let result = a == b;
result

View File

@ -7,9 +7,8 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// aux-build:mir_external_refs.rs
// aux-build:mir_external_refs.rs
extern crate mir_external_refs as ext;
@ -78,128 +77,103 @@ fn parametric<T>(u: T) -> T {
u
}
#[rustc_mir]
fn t1() -> fn()->u8 {
regular
}
#[rustc_mir]
fn t2() -> fn(u8)->E {
E::U
}
#[rustc_mir]
fn t3() -> fn(u8)->S {
S
}
#[rustc_mir]
fn t4() -> fn()->u8 {
S::hey
}
#[rustc_mir]
fn t5() -> fn(&S)-> u8 {
<S as X>::hoy
}
#[rustc_mir]
fn t6() -> fn()->u8{
ext::regular_fn
}
#[rustc_mir]
fn t7() -> fn(u8)->ext::E {
ext::E::U
}
#[rustc_mir]
fn t8() -> fn(u8)->ext::S {
ext::S
}
#[rustc_mir]
fn t9() -> fn()->u8 {
ext::S::hey
}
#[rustc_mir]
fn t10() -> fn(&ext::S)->u8 {
<ext::S as ext::X>::hoy
}
#[rustc_mir]
fn t11() -> fn(u8)->u8 {
parametric
}
#[rustc_mir]
fn t12() -> u8 {
C
}
#[rustc_mir]
fn t13() -> [u8; 5] {
C2
}
#[rustc_mir]
fn t13_2() -> [u8; 3] {
C3
}
#[rustc_mir]
fn t14() -> fn()-> u8 {
<S as X>::hoy2
}
#[rustc_mir]
fn t15() -> fn(&S)-> u8 {
S::hey2
}
#[rustc_mir]
fn t16() -> fn(u32, u32)->u64 {
F::f
}
#[rustc_mir]
fn t17() -> fn(u32, u64)->u64 {
F::f
}
#[rustc_mir]
fn t18() -> fn(u64, u64)->u64 {
F::f
}
#[rustc_mir]
fn t19() -> fn(u64, u32)->u64 {
F::f
}
#[rustc_mir]
fn t20() -> fn(u64, u32)->(u64, u32) {
<u32 as T<_, _>>::staticmeth
}
#[rustc_mir]
fn t21() -> Unit {
Unit
}
#[rustc_mir]
fn t22() -> Option<u8> {
None
}
#[rustc_mir]
fn t23() -> (CEnum, CEnum) {
(CEnum::A, CEnum::B)
}
#[rustc_mir]
fn t24() -> fn(u8) -> S {
C4
}

View File

@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[rustc_mir]
fn foo((x, y): (i8, i8)) {
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
use std::marker::PhantomData;
pub trait DataBind {
@ -26,7 +24,6 @@ pub struct Data {
pub offsets: <Global<[u32; 2]> as DataBind>::Data,
}
#[rustc_mir]
fn create_data() -> Data {
let mut d = Data { offsets: [1, 2] };
d.offsets[0] = 3;

View File

@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[rustc_mir]
fn test1(f: f32) -> bool {
// test that we properly promote temporaries to allocas when a temporary is assigned to
// multiple times (assignment is still happening once ∀ possible dataflows).

View File

@ -7,9 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[rustc_mir]
fn into_inner() -> [u64; 1024] {
let mut x = 10 + 20;
[x; 1024]

View File

@ -7,9 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[rustc_mir]
fn into_inner(x: u64) -> [u64; 1024] {
[x; 2*4*8*16]
}

View File

@ -7,13 +7,11 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
fn converging_fn() -> u64 {
43
}
#[rustc_mir]
fn mir() -> u64 {
let x;
loop {

View File

@ -8,9 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs, fn_traits)]
#![feature(fn_traits)]
#[rustc_mir]
fn test1(a: isize, b: (i32, i32), c: &[i32]) -> (isize, (i32, i32), &[i32]) {
// Test passing a number of arguments including a fat pointer.
// Also returning via an out pointer
@ -20,7 +19,6 @@ fn test1(a: isize, b: (i32, i32), c: &[i32]) -> (isize, (i32, i32), &[i32]) {
callee(a, b, c)
}
#[rustc_mir]
fn test2(a: isize) -> isize {
// Test passing a single argument.
// Not using out pointer.
@ -36,7 +34,6 @@ impl Foo {
fn inherent_method(&self, a: isize) -> isize { a }
}
#[rustc_mir]
fn test3(x: &Foo, a: isize) -> isize {
// Test calling inherent method
x.inherent_method(a)
@ -47,19 +44,16 @@ trait Bar {
}
impl Bar for Foo {}
#[rustc_mir]
fn test4(x: &Foo, a: isize) -> isize {
// Test calling extension method
x.extension_method(a)
}
#[rustc_mir]
fn test5(x: &Bar, a: isize) -> isize {
// Test calling method on trait object
x.extension_method(a)
}
#[rustc_mir]
fn test6<T: Bar>(x: &T, a: isize) -> isize {
// Test calling extension method on generic callee
x.extension_method(a)
@ -72,7 +66,6 @@ impl One for isize {
fn one() -> isize { 1 }
}
#[rustc_mir]
fn test7() -> isize {
// Test calling trait static method
<isize as One>::one()
@ -83,7 +76,6 @@ impl Two {
fn two() -> isize { 2 }
}
#[rustc_mir]
fn test8() -> isize {
// Test calling impl static method
Two::two()
@ -93,24 +85,20 @@ extern fn simple_extern(x: u32, y: (u32, u32)) -> u32 {
x + y.0 * y.1
}
#[rustc_mir]
fn test9() -> u32 {
simple_extern(41, (42, 43))
}
#[rustc_mir]
fn test_closure<F>(f: &F, x: i32, y: i32) -> i32
where F: Fn(i32, i32) -> i32
{
f(x, y)
}
#[rustc_mir]
fn test_fn_object(f: &Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 {
f(x, y)
}
#[rustc_mir]
fn test_fn_impl(f: &&Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 {
// This call goes through the Fn implementation for &Fn provided in
// core::ops::impls. It expands to a static Fn::call() that calls the
@ -118,28 +106,24 @@ fn test_fn_impl(f: &&Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 {
f(x, y)
}
#[rustc_mir]
fn test_fn_direct_call<F>(f: &F, x: i32, y: i32) -> i32
where F: Fn(i32, i32) -> i32
{
f.call((x, y))
}
#[rustc_mir]
fn test_fn_const_call<F>(f: &F) -> i32
where F: Fn(i32, i32) -> i32
{
f.call((100, -1))
}
#[rustc_mir]
fn test_fn_nil_call<F>(f: &F) -> i32
where F: Fn() -> i32
{
f()
}
#[rustc_mir]
fn test_fn_transmute_zst(x: ()) -> [(); 1] {
fn id<T>(x: T) -> T {x}
@ -148,30 +132,24 @@ fn test_fn_transmute_zst(x: ()) -> [(); 1] {
})
}
#[rustc_mir]
fn test_fn_ignored_pair() -> ((), ()) {
((), ())
}
#[rustc_mir]
fn test_fn_ignored_pair_0() {
test_fn_ignored_pair().0
}
#[rustc_mir]
fn id<T>(x: T) -> T { x }
#[rustc_mir]
fn ignored_pair_named() -> (Foo, Foo) {
(Foo, Foo)
}
#[rustc_mir]
fn test_fn_ignored_pair_named() -> (Foo, Foo) {
id(ignored_pair_named())
}
#[rustc_mir]
fn test_fn_nested_pair(x: &((f32, f32), u32)) -> (f32, f32) {
let y = *x;
let z = y.0;

View File

@ -8,14 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[link(name = "rust_test_helpers")]
extern {
fn rust_interesting_average(_: i64, ...) -> f64;
}
#[rustc_mir]
fn test<T, U>(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 {
unsafe {
rust_interesting_average(6, a, a as f64,

View File

@ -29,7 +29,6 @@ impl<A, B> Foo<A, B>
where A: Iterator, B: Iterator<Item=A::Item>
{
// This is the function we care about
#[rustc_mir]
fn next(&mut self) -> Option<A::Item> {
match self.state {
State::Both => match self.a.next() {

View File

@ -10,9 +10,6 @@
// A simple spike test for MIR version of trans.
#![feature(rustc_attrs)]
#[rustc_mir]
fn sum(x: i32, y: i32) -> i32 {
x + y
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
enum Abc {
A(u8),
B(i8),
@ -17,7 +15,6 @@ enum Abc {
D,
}
#[rustc_mir]
fn foo(x: Abc) -> i32 {
match x {
Abc::C => 3,
@ -27,7 +24,6 @@ fn foo(x: Abc) -> i32 {
}
}
#[rustc_mir]
fn foo2(x: Abc) -> bool {
match x {
Abc::D => true,

View File

@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[rustc_mir]
pub fn foo(x: i8) -> i32 {
match x {
1 => 0,

View File

@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#[rustc_mir]
fn mir() -> (){
let x = 1;
let mut y = 0;

View File

@ -8,11 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
fn nil() {}
#[rustc_mir]
fn mir(){
nil()
}

View File

@ -11,11 +11,9 @@
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
#![feature(rustc_attrs)]
use std::fmt::Debug;
#[rustc_mir(graphviz="mir.gv")]
fn foldl<T, U, F>(values: &[T],
initial: U,
mut function: F)
@ -32,7 +30,6 @@ fn foldl<T, U, F>(values: &[T],
}
}
#[rustc_mir]
fn foldr<T, U, F>(values: &[T],
initial: U,
mut function: F)

View File

@ -8,9 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns, rustc_attrs)]
#![feature(slice_patterns)]
#[rustc_mir]
pub fn main() {
let x = &[1, 2, 3, 4, 5];
let x: &[isize] = &[1, 2, 3, 4, 5];

View File

@ -11,9 +11,7 @@
#![feature(advanced_slice_patterns)]
#![feature(slice_patterns)]
#![feature(rustc_attrs)]
#[rustc_mir]
fn a() {
let x = [1];
match x {
@ -23,7 +21,6 @@ fn a() {
}
}
#[rustc_mir]
fn b() {
let x = [1, 2, 3];
match x {
@ -60,7 +57,6 @@ fn b() {
}
#[rustc_mir]
fn b_slice() {
let x : &[_] = &[1, 2, 3];
match x {
@ -100,7 +96,6 @@ fn b_slice() {
}
}
#[rustc_mir]
fn c() {
let x = [1];
match x {
@ -109,7 +104,6 @@ fn c() {
}
}
#[rustc_mir]
fn d() {
let x = [1, 2, 3];
let branch = match x {
@ -121,7 +115,6 @@ fn d() {
assert_eq!(branch, 1);
}
#[rustc_mir]
fn e() {
let x: &[isize] = &[1, 2, 3];
let a = match *x {

View File

@ -11,13 +11,11 @@
#![feature(slice_patterns)]
#![feature(rustc_attrs)]
struct Foo {
string: &'static str
}
#[rustc_mir]
pub fn main() {
let x = [
Foo { string: "foo" },

View File

@ -8,13 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs, unsafe_no_drop_flag)]
#![feature(unsafe_no_drop_flag)]
// ignore-pretty : (#23623) problems when ending with // comments
static mut destructions : isize = 3;
#[rustc_no_mir] // FIXME #29855 MIR doesn't handle all drops correctly.
pub fn foo() {
#[unsafe_no_drop_flag]
struct Foo;

View File

@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#![feature(slice_patterns)]
#[rustc_mir]
fn main() {
let x = [(), ()];