merge with master to pick up pulldown switch

This commit is contained in:
QuietMisdreavus 2017-04-09 10:38:38 -05:00
commit 8dd4c44ef6
1196 changed files with 28940 additions and 37303 deletions

View file

@ -30,5 +30,3 @@ fn main()
// This should not introduce a codegen item
let _ = cgu_generic_function::exported_but_not_generic(3);
}
//~ TRANS_ITEM drop-glue i8

View file

@ -11,8 +11,7 @@
// ignore-tidy-linelength
// compile-flags:-Zprint-trans-items=eager
//~ TRANS_ITEM drop-glue drop_in_place_intrinsic::StructWithDtor[0]
//~ TRANS_ITEM drop-glue-contents drop_in_place_intrinsic::StructWithDtor[0]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic.cgu-0[Internal]
struct StructWithDtor(u32);
impl Drop for StructWithDtor {
@ -23,7 +22,7 @@ impl Drop for StructWithDtor {
//~ TRANS_ITEM fn drop_in_place_intrinsic::main[0]
fn main() {
//~ TRANS_ITEM drop-glue [drop_in_place_intrinsic::StructWithDtor[0]; 2]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic.cgu-0[Internal]
let x = [StructWithDtor(0), StructWithDtor(1)];
drop_slice_in_place(&x);
@ -35,7 +34,7 @@ fn drop_slice_in_place(x: &[StructWithDtor]) {
// This is the interesting thing in this test case: Normally we would
// not have drop-glue for the unsized [StructWithDtor]. This has to be
// generated though when the drop_in_place() intrinsic is used.
//~ TRANS_ITEM drop-glue [drop_in_place_intrinsic::StructWithDtor[0]]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic.cgu-0[Internal]
::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]);
}
}

View file

@ -28,10 +28,12 @@ fn main() {
//~ TRANS_ITEM fn function_as_argument::take_fn_once[0]<u32, &str, fn(u32, &str)>
//~ TRANS_ITEM fn function_as_argument::function[0]<u32, &str>
//~ TRANS_ITEM fn core::ops[0]::FnOnce[0]::call_once[0]<fn(u32, &str), (u32, &str)>
take_fn_once(function, 0u32, "abc");
//~ TRANS_ITEM fn function_as_argument::take_fn_once[0]<char, f64, fn(char, f64)>
//~ TRANS_ITEM fn function_as_argument::function[0]<char, f64>
//~ TRANS_ITEM fn core::ops[0]::FnOnce[0]::call_once[0]<fn(char, f64), (char, f64)>
take_fn_once(function, 'c', 0f64);
//~ TRANS_ITEM fn function_as_argument::take_fn_pointer[0]<i32, ()>
@ -42,5 +44,3 @@ fn main() {
//~ TRANS_ITEM fn function_as_argument::function[0]<f32, i64>
take_fn_pointer(function, 0f32, 0i64);
}
//~ TRANS_ITEM drop-glue i8

View file

@ -45,8 +45,7 @@ enum EnumNoDrop<T1, T2> {
struct NonGenericNoDrop(i32);
struct NonGenericWithDrop(i32);
//~ TRANS_ITEM drop-glue generic_drop_glue::NonGenericWithDrop[0]
//~ TRANS_ITEM drop-glue-contents generic_drop_glue::NonGenericWithDrop[0]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue.cgu-0[Internal]
impl Drop for NonGenericWithDrop {
//~ TRANS_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0]
@ -55,13 +54,11 @@ impl Drop for NonGenericWithDrop {
//~ TRANS_ITEM fn generic_drop_glue::main[0]
fn main() {
//~ TRANS_ITEM drop-glue generic_drop_glue::StructWithDrop[0]<i8, char>
//~ TRANS_ITEM drop-glue-contents generic_drop_glue::StructWithDrop[0]<i8, char>
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<i8, char>
let _ = StructWithDrop { x: 0i8, y: 'a' }.x;
//~ TRANS_ITEM drop-glue generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>
//~ TRANS_ITEM drop-glue-contents generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>
let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y;
@ -70,19 +67,17 @@ fn main() {
// This is supposed to generate drop-glue because it contains a field that
// needs to be dropped.
//~ TRANS_ITEM drop-glue generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue.cgu-0[Internal]
let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y;
//~ TRANS_ITEM drop-glue generic_drop_glue::EnumWithDrop[0]<i32, i64>
//~ TRANS_ITEM drop-glue-contents generic_drop_glue::EnumWithDrop[0]<i32, i64>
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<i32, i64>
let _ = match EnumWithDrop::A::<i32, i64>(0) {
EnumWithDrop::A(x) => x,
EnumWithDrop::B(x) => x as i32
};
//~ TRANS_ITEM drop-glue generic_drop_glue::EnumWithDrop[0]<f64, f32>
//~ TRANS_ITEM drop-glue-contents generic_drop_glue::EnumWithDrop[0]<f64, f32>
//~TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<f64, f32>
let _ = match EnumWithDrop::B::<f64, f32>(1.0) {
EnumWithDrop::A(x) => x,
@ -99,5 +94,3 @@ fn main() {
EnumNoDrop::B(x) => x as f64
};
}
//~ TRANS_ITEM drop-glue i8

View file

@ -31,12 +31,13 @@ impl<T> Trait for Struct<T> {
fn main() {
let s1 = Struct { _a: 0u32 };
//~ TRANS_ITEM drop-glue i8
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable.cgu-0[Internal]
//~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u32>
//~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u32>
let _ = &s1 as &Trait;
let s1 = Struct { _a: 0u64 };
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable.cgu-0[Internal]
//~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u64>
//~ TRANS_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u64>
let _ = &s1 as &Trait;

View file

@ -40,5 +40,3 @@ fn main() {
//~ TRANS_ITEM fn items_within_generic_items::generic_fn[0]<i8>
let _ = generic_fn(0i8);
}
//~ TRANS_ITEM drop-glue i8

View file

@ -13,8 +13,7 @@
#![deny(dead_code)]
//~ TRANS_ITEM drop-glue non_generic_drop_glue::StructWithDrop[0]
//~ TRANS_ITEM drop-glue-contents non_generic_drop_glue::StructWithDrop[0]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue.cgu-0[Internal]
struct StructWithDrop {
x: i32
}
@ -28,8 +27,7 @@ struct StructNoDrop {
x: i32
}
//~ TRANS_ITEM drop-glue non_generic_drop_glue::EnumWithDrop[0]
//~ TRANS_ITEM drop-glue-contents non_generic_drop_glue::EnumWithDrop[0]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue.cgu-0[Internal]
enum EnumWithDrop {
A(i32)
}
@ -54,5 +52,3 @@ fn main() {
EnumNoDrop::A(x) => x
};
}
//~ TRANS_ITEM drop-glue i8

View file

@ -77,5 +77,3 @@ fn main() {
let x = Struct { _x: 0 };
x.bar();
}
//~ TRANS_ITEM drop-glue i8

View file

@ -68,5 +68,3 @@ impl Deref for Equatable {
&self.0
}
}
//~ TRANS_ITEM drop-glue i8

View file

@ -20,4 +20,3 @@ pub fn foo<T>() { }
fn main() { }
//~ TRANS_ITEM fn static_init::main[0]
//~ TRANS_ITEM drop-glue i8

View file

@ -60,5 +60,3 @@ fn main() {
//~ TRANS_ITEM static statics_and_consts::foo[0]::STATIC2[2]
//~ TRANS_ITEM fn statics_and_consts::main[0]
//~ TRANS_ITEM drop-glue i8

View file

@ -78,5 +78,3 @@ fn main() {
//~ TRANS_ITEM fn trait_implementations::{{impl}}[3]::bar[0]<&str, &str>
0f32.bar("&str", "&str");
}
//~ TRANS_ITEM drop-glue i8

View file

@ -40,23 +40,27 @@ fn take_foo_mut<T, F: FnMut(T) -> T>(mut f: F, arg: T) -> T {
fn main() {
//~ TRANS_ITEM fn trait_method_as_argument::take_foo_once[0]<u32, fn(u32) -> u32>
//~ TRANS_ITEM fn trait_method_as_argument::{{impl}}[0]::foo[0]
//~ TRANS_ITEM fn core::ops[0]::FnOnce[0]::call_once[0]<fn(u32) -> u32, (u32)>
take_foo_once(Trait::foo, 0u32);
//~ TRANS_ITEM fn trait_method_as_argument::take_foo_once[0]<char, fn(char) -> char>
//~ TRANS_ITEM fn trait_method_as_argument::Trait[0]::foo[0]<char>
//~ TRANS_ITEM fn core::ops[0]::FnOnce[0]::call_once[0]<fn(char) -> char, (char)>
take_foo_once(Trait::foo, 'c');
//~ TRANS_ITEM fn trait_method_as_argument::take_foo[0]<u32, fn(u32) -> u32>
//~ TRANS_ITEM fn core::ops[0]::Fn[0]::call[0]<fn(u32) -> u32, (u32)>
take_foo(Trait::foo, 0u32);
//~ TRANS_ITEM fn trait_method_as_argument::take_foo[0]<char, fn(char) -> char>
//~ TRANS_ITEM fn core::ops[0]::Fn[0]::call[0]<fn(char) -> char, (char)>
take_foo(Trait::foo, 'c');
//~ TRANS_ITEM fn trait_method_as_argument::take_foo_mut[0]<u32, fn(u32) -> u32>
//~ TRANS_ITEM fn core::ops[0]::FnMut[0]::call_mut[0]<fn(char) -> char, (char)>
take_foo_mut(Trait::foo, 0u32);
//~ TRANS_ITEM fn trait_method_as_argument::take_foo_mut[0]<char, fn(char) -> char>
//~ TRANS_ITEM fn core::ops[0]::FnMut[0]::call_mut[0]<fn(u32) -> u32, (u32)>
take_foo_mut(Trait::foo, 'c');
}
//~ TRANS_ITEM drop-glue i8

View file

@ -66,5 +66,3 @@ fn main() {
//~ TRANS_ITEM fn trait_method_default_impl::SomeGenericTrait[0]::bar[0]<u32, i16, ()>
0u32.bar(0i16, ());
}
//~ TRANS_ITEM drop-glue i8

View file

@ -13,12 +13,11 @@
#![deny(dead_code)]
//~ TRANS_ITEM drop-glue transitive_drop_glue::Root[0]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue.cgu-0[Internal]
struct Root(Intermediate);
//~ TRANS_ITEM drop-glue transitive_drop_glue::Intermediate[0]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue.cgu-0[Internal]
struct Intermediate(Leaf);
//~ TRANS_ITEM drop-glue transitive_drop_glue::Leaf[0]
//~ TRANS_ITEM drop-glue-contents transitive_drop_glue::Leaf[0]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue.cgu-0[Internal]
struct Leaf;
impl Drop for Leaf {
@ -39,17 +38,15 @@ fn main() {
let _ = Root(Intermediate(Leaf));
//~ TRANS_ITEM drop-glue transitive_drop_glue::RootGen[0]<u32>
//~ TRANS_ITEM drop-glue transitive_drop_glue::IntermediateGen[0]<u32>
//~ TRANS_ITEM drop-glue transitive_drop_glue::LeafGen[0]<u32>
//~ TRANS_ITEM drop-glue-contents transitive_drop_glue::LeafGen[0]<u32>
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<u32>
let _ = RootGen(IntermediateGen(LeafGen(0u32)));
//~ TRANS_ITEM drop-glue transitive_drop_glue::RootGen[0]<i16>
//~ TRANS_ITEM drop-glue transitive_drop_glue::IntermediateGen[0]<i16>
//~ TRANS_ITEM drop-glue transitive_drop_glue::LeafGen[0]<i16>
//~ TRANS_ITEM drop-glue-contents transitive_drop_glue::LeafGen[0]<i16>
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<i16>
let _ = RootGen(IntermediateGen(LeafGen(0i16)));
}

View file

@ -13,8 +13,7 @@
#![deny(dead_code)]
//~ TRANS_ITEM drop-glue tuple_drop_glue::Dropped[0]
//~ TRANS_ITEM drop-glue-contents tuple_drop_glue::Dropped[0]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue.cgu-0[Internal]
struct Dropped;
impl Drop for Dropped {
@ -24,10 +23,10 @@ impl Drop for Dropped {
//~ TRANS_ITEM fn tuple_drop_glue::main[0]
fn main() {
//~ TRANS_ITEM drop-glue (u32, tuple_drop_glue::Dropped[0])
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue.cgu-0[Internal]
let x = (0u32, Dropped);
//~ TRANS_ITEM drop-glue (i16, (tuple_drop_glue::Dropped[0], bool))
//~ TRANS_ITEM drop-glue (tuple_drop_glue::Dropped[0], bool)
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue.cgu-0[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue.cgu-0[Internal]
let x = (0i16, (Dropped, true));
}

View file

@ -57,11 +57,13 @@ fn main()
{
// simple case
let bool_sized = &true;
//~ TRANS_ITEM drop-glue i8
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<bool> @@ unsizing.cgu-0[Internal]
//~ TRANS_ITEM fn unsizing::{{impl}}[0]::foo[0]
let _bool_unsized = bool_sized as &Trait;
let char_sized = &true;
let char_sized = &'a';
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<char> @@ unsizing.cgu-0[Internal]
//~ TRANS_ITEM fn unsizing::{{impl}}[1]::foo[0]
let _char_unsized = char_sized as &Trait;
@ -71,11 +73,13 @@ fn main()
_b: 2,
_c: 3.0f64
};
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<f64> @@ unsizing.cgu-0[Internal]
//~ TRANS_ITEM fn unsizing::{{impl}}[2]::foo[0]
let _struct_unsized = struct_sized as &Struct<Trait>;
// custom coercion
let wrapper_sized = Wrapper(&0u32);
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ unsizing.cgu-0[Internal]
//~ TRANS_ITEM fn unsizing::{{impl}}[3]::foo[0]
let _wrapper_sized = wrapper_sized as Wrapper<Trait>;
}

View file

@ -86,4 +86,3 @@ impl NonGeneric {
// Only the non-generic methods should be instantiated:
//~ TRANS_ITEM fn unused_traits_and_generics::{{impl}}[3]::foo[0]
//~ TRANS_ITEM drop-glue i8

View file

@ -20,15 +20,14 @@
// aux-build:cgu_extern_drop_glue.rs
extern crate cgu_extern_drop_glue;
//~ TRANS_ITEM drop-glue cgu_extern_drop_glue::Struct[0] @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal]
//~ TRANS_ITEM drop-glue-contents cgu_extern_drop_glue::Struct[0] @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<cgu_extern_drop_glue::Struct[0]> @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal]
struct LocalStruct(cgu_extern_drop_glue::Struct);
//~ TRANS_ITEM fn extern_drop_glue::user[0] @@ extern_drop_glue[External]
fn user()
{
//~ TRANS_ITEM drop-glue extern_drop_glue::LocalStruct[0] @@ extern_drop_glue[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<extern_drop_glue::LocalStruct[0]> @@ extern_drop_glue[Internal]
let _ = LocalStruct(cgu_extern_drop_glue::Struct(0));
}
@ -40,7 +39,7 @@ mod mod1 {
//~ TRANS_ITEM fn extern_drop_glue::mod1[0]::user[0] @@ extern_drop_glue-mod1[External]
fn user()
{
//~ TRANS_ITEM drop-glue extern_drop_glue::mod1[0]::LocalStruct[0] @@ extern_drop_glue-mod1[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<extern_drop_glue::mod1[0]::LocalStruct[0]> @@ extern_drop_glue-mod1[Internal]
let _ = LocalStruct(cgu_extern_drop_glue::Struct(0));
}
}

View file

@ -60,5 +60,3 @@ mod mod3 {
// once for the current crate
//~ TRANS_ITEM fn cgu_generic_function::foo[0]<&str> @@ cgu_generic_function.volatile[External]
//~ TRANS_ITEM fn cgu_generic_function::bar[0]<&str> @@ cgu_generic_function.volatile[External]
//~ TRANS_ITEM drop-glue i8

View file

@ -16,8 +16,7 @@
#![allow(dead_code)]
#![crate_type="lib"]
//~ TRANS_ITEM drop-glue local_drop_glue::Struct[0] @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal]
//~ TRANS_ITEM drop-glue-contents local_drop_glue::Struct[0] @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::Struct[0]> @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal]
struct Struct {
_a: u32
}
@ -27,7 +26,7 @@ impl Drop for Struct {
fn drop(&mut self) {}
}
//~ TRANS_ITEM drop-glue local_drop_glue::Outer[0] @@ local_drop_glue[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::Outer[0]> @@ local_drop_glue[Internal]
struct Outer {
_a: Struct
}
@ -46,10 +45,10 @@ mod mod1
{
use super::Struct;
//~ TRANS_ITEM drop-glue local_drop_glue::mod1[0]::Struct2[0] @@ local_drop_glue-mod1[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<local_drop_glue::mod1[0]::Struct2[0]> @@ local_drop_glue-mod1[Internal]
struct Struct2 {
_a: Struct,
//~ TRANS_ITEM drop-glue (u32, local_drop_glue::Struct[0]) @@ local_drop_glue-mod1[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal]
_b: (u32, Struct),
}

View file

@ -80,5 +80,3 @@ mod mod2 {
static BAZ: u64 = 0;
}
}
//~ TRANS_ITEM drop-glue i8

View file

@ -46,5 +46,3 @@ mod mod1 {
static BAR: u32 = 0;
}
}
//~ TRANS_ITEM drop-glue i8

View file

@ -69,7 +69,7 @@ mod mod1 {
//~ TRANS_ITEM fn vtable_through_const::main[0] @@ vtable_through_const[External]
fn main() {
//~ TRANS_ITEM drop-glue i8 @@ vtable_through_const[Internal]
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ vtable_through_const[Internal]
// Since Trait1::do_something() is instantiated via its default implementation,
// it is considered a generic and is instantiated here only because it is

View file

@ -121,13 +121,13 @@ pub fn unsafe_slice(_: &[UnsafeInner]) {
fn str(_: &[u8]) {
}
// CHECK: @trait_borrow(i8* nonnull, void (i8*)** noalias nonnull readonly)
// CHECK: @trait_borrow({}* nonnull, {}* noalias nonnull readonly)
// FIXME #25759 This should also have `nocapture`
#[no_mangle]
fn trait_borrow(_: &Drop) {
}
// CHECK: @trait_box(i8* noalias nonnull, void (i8*)** noalias nonnull readonly)
// CHECK: @trait_box({}* noalias nonnull, {}* noalias nonnull readonly)
#[no_mangle]
fn trait_box(_: Box<Drop>) {
}

View file

@ -0,0 +1,41 @@
// Copyright 2015 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-tidy-linelength
// This test is for *-windows-msvc only.
// ignore-android
// ignore-bitrig
// ignore-macos
// ignore-dragonfly
// ignore-freebsd
// ignore-haiku
// ignore-ios
// ignore-linux
// ignore-netbsd
// ignore-openbsd
// ignore-solaris
// ignore-emscripten
// compile-flags: -C no-prepopulate-passes -C panic=abort -O
#![crate_type = "lib"]
// CHECK: Function Attrs: uwtable
// CHECK-NEXT: define void @normal_uwtable()
#[no_mangle]
pub fn normal_uwtable() {
}
// CHECK: Function Attrs: nounwind uwtable
// CHECK-NEXT: define void @extern_uwtable()
#[no_mangle]
pub extern fn extern_uwtable() {
}

View file

@ -0,0 +1,41 @@
// Copyright 2017 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-msvc
// compile-flags: -O -C no-prepopulate-passes
#![crate_type="lib"]
struct S;
impl Drop for S {
fn drop(&mut self) {
}
}
fn might_unwind() {
}
// CHECK-LABEL: @test
#[no_mangle]
pub fn test() {
let _s = S;
// Check that the personality slot alloca gets a lifetime start in each cleanup block, not just
// in the first one.
// CHECK-LABEL: cleanup:
// CHECK: bitcast{{.*}}personalityslot
// CHECK-NEXT: call void @llvm.lifetime.start
// CHECK-LABEL: cleanup1:
// CHECK: bitcast{{.*}}personalityslot
// CHECK-NEXT: call void @llvm.lifetime.start
might_unwind();
might_unwind();
}

View file

@ -35,7 +35,6 @@
// non-pub fields, marked with SILLY below)
#![feature(staged_api)]
#![feature(pub_restricted)]
#![stable(feature = "unit_test", since = "0.0.0")]

View file

@ -20,6 +20,7 @@ extern crate derive_b;
#[C] //~ ERROR: The attribute `C` is currently unknown to the compiler
#[B(D)]
#[B(E = "foo")]
#[B arbitrary tokens] //~ expected one of `(` or `=`, found `arbitrary`
struct B;
fn main() {}

View file

@ -27,14 +27,6 @@ fn main() {
&ps,
syntax::ext::expand::ExpansionConfig::default("qquote".to_string()),
&mut resolver);
cx.bt_push(syntax::codemap::ExpnInfo {
call_site: DUMMY_SP,
callee: syntax::codemap::NameAndSpan {
format: syntax::codemap::MacroBang(Symbol::intern("")),
allow_internal_unstable: false,
span: None,
}
});
let cx = &mut cx;
assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23");

View file

@ -17,15 +17,12 @@ struct Bar<'a> {
x: &'a Foo + 'a,
//~^ ERROR E0178
//~| NOTE expected a path
//~| ERROR at least one non-builtin trait is required for an object type
y: &'a mut Foo + 'a,
//~^ ERROR E0178
//~| NOTE expected a path
//~| ERROR at least one non-builtin trait is required for an object type
z: fn() -> Foo + 'a,
//~^ ERROR E0178
//~| NOTE expected a path
//~| ERROR at least one non-builtin trait is required for an object type
}
fn main() {

View file

@ -30,7 +30,7 @@ extern crate allocator_dylib;
// that this just passes on those platforms we link in some other allocator to
// ensure we get the same error.
//
// So long as we CI linux/OSX we should be good.
// So long as we CI linux/macOS we should be good.
#[cfg(any(target_os = "linux", target_os = "macos"))]
extern crate alloc_jemalloc;
#[cfg(not(any(target_os = "linux", target_os = "macos")))]

View file

@ -28,7 +28,7 @@ extern crate allocator_dylib2;
// that this just passes on those platforms we link in some other allocator to
// ensure we get the same error.
//
// So long as we CI linux/OSX we should be good.
// So long as we CI linux/macOS we should be good.
#[cfg(any(all(target_os = "linux", any(target_arch = "x86", target_arch = "x86_64")),
target_os = "macos"))]
extern crate alloc_system;

View file

@ -27,7 +27,7 @@ fn main() {
x; //~ value moved here
let y = Int(2);
//~^use `mut y` here to make mutable
//~^ consider changing this to `mut y`
y //~ error: cannot borrow immutable local variable `y` as mutable
//~| cannot borrow
+=

View file

@ -23,7 +23,7 @@ fn indirect_write_to_imm_box() {
let mut x: isize = 1;
let y: Box<_> = box &mut x;
let p = &y;
***p = 2; //~ ERROR cannot assign to data in an immutable container
***p = 2; //~ ERROR cannot assign to data in a `&` reference
drop(p);
}
@ -43,7 +43,6 @@ fn borrow_in_var_from_var_via_imm_box() {
let p = &y;
let q = &***p;
**y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
//~^ ERROR cannot assign to data in an immutable container
drop(p);
drop(q);
}
@ -64,7 +63,6 @@ fn borrow_in_var_from_field_via_imm_box() {
let p = &y;
let q = &***p;
**y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
//~^ ERROR cannot assign to data in an immutable container
drop(p);
drop(q);
}
@ -85,7 +83,6 @@ fn borrow_in_field_from_var_via_imm_box() {
let p = &y.a;
let q = &***p;
**y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
//~^ ERROR cannot assign to data in an immutable container
drop(p);
drop(q);
}
@ -106,7 +103,6 @@ fn borrow_in_field_from_field_via_imm_box() {
let p = &y.a;
let q = &***p;
**y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
//~^ ERROR cannot assign to data in an immutable container
drop(p);
drop(q);
}

View file

@ -0,0 +1,43 @@
// Copyright 2017 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.
#![feature(catch_expr)]
// This test checks that borrows made and returned inside catch blocks are properly constrained
pub fn main() {
{
// Test that borrows returned from a catch block must be valid for the lifetime of the
// result variable
let _result: Result<(), &str> = do catch {
let my_string = String::from("");
let my_str: & str = & my_string;
Err(my_str) ?;
Err("") ?;
Ok(())
}; //~ ERROR `my_string` does not live long enough
}
{
// Test that borrows returned from catch blocks freeze their referent
let mut i = 5;
let k = &mut i;
let mut j: Result<(), &mut i32> = do catch {
Err(k) ?;
i = 10; //~ ERROR cannot assign to `i` because it is borrowed
Ok(())
};
::std::mem::drop(k); //~ ERROR use of moved value: `k`
i = 40; //~ ERROR cannot assign to `i` because it is borrowed
let i_ptr = if let Err(i_ptr) = j { i_ptr } else { panic ! ("") };
*i_ptr = 50;
}
}

View file

@ -1,4 +1,4 @@
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -8,16 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -C debug-assertions=no
// exec-env:RUST_LOG=conditional-debug-macro-off=4
#![feature(rustc_private)]
#[macro_use]
extern crate log;
#![feature(catch_expr)]
pub fn main() {
// only panics if println! evaluates its argument.
debug!("{:?}", { if true { panic!() } });
let res: Result<i32, i32> = do catch {
Err("")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` is not satisfied
Ok(5)
};
let res: Result<i32, i32> = do catch {
Ok("") //~ mismatched types
};
}

View file

@ -0,0 +1,51 @@
// Copyright 2017 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.
#![feature(catch_expr)]
// This test checks that borrows made and returned inside catch blocks are properly constrained
pub fn main() {
{
// Test that a borrow which *might* be returned still freezes its referent
let mut i = 222;
let x: Result<&i32, ()> = do catch {
Err(())?;
Ok(&i)
};
x.ok().cloned();
i = 0; //~ ERROR cannot assign to `i` because it is borrowed
let _ = i;
}
{
let x = String::new();
let _y: Result<(), ()> = do catch {
Err(())?;
::std::mem::drop(x);
Ok(())
};
println!("{}", x); //~ ERROR use of moved value: `x`
}
{
// Test that a borrow which *might* be assigned to an outer variable still freezes
// its referent
let mut i = 222;
let j;
let x: Result<(), ()> = do catch {
Err(())?;
j = &i;
Ok(())
};
i = 0; //~ ERROR cannot assign to `i` because it is borrowed
let _ = i;
}
}

View file

@ -1,4 +1,4 @@
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -8,20 +8,19 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// exec-env:RUST_LOG=logging_enabled=info
// ignore-emscripten: FIXME(#31622)
#![feature(catch_expr)]
#![feature(rustc_private)]
#[macro_use]
extern crate log;
fn use_val<T: Sized>(_x: T) {}
pub fn main() {
if log_enabled!(log::DEBUG) {
panic!("what?! debugging?");
}
if !log_enabled!(log::INFO) {
panic!("what?! no info?");
}
let cfg_res;
let _: Result<(), ()> = do catch {
Err(())?;
cfg_res = 5;
Ok::<(), ()>(())?;
use_val(cfg_res);
Ok(())
};
assert_eq!(cfg_res, 5); //~ ERROR use of possibly uninitialized variable
}

View file

@ -8,20 +8,16 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// gate-test-pub_restricted
#![feature(never_type)]
pub(crate) //~ ERROR experimental
mod foo {}
fn foo(x: usize, y: !, z: usize) { }
pub(self) //~ ERROR experimental
mod bar {}
fn cast_a() {
let y = {return; 22} as !;
}
struct S {
pub(self) x: i32, //~ ERROR experimental
}
impl S {
pub(self) fn f() {} //~ ERROR experimental
}
extern {
pub(self) fn f(); //~ ERROR experimental
fn cast_b() {
let y = 22 as !; //~ ERROR non-scalar cast
}
fn main() { }

View file

@ -0,0 +1,90 @@
// 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.
#![feature(never_type)]
fn foo(x: usize, y: !, z: usize) { }
fn call_foo_a() {
// FIXME(#40800) -- accepted beacuse divergence happens **before**
// the coercion to `!`, but within same expression. Not clear that
// these are the rules we want.
foo(return, 22, 44);
}
fn call_foo_b() {
// Divergence happens in the argument itself, definitely ok.
foo(22, return, 44);
}
fn call_foo_c() {
// This test fails because the divergence happens **after** the
// coercion to `!`:
foo(22, 44, return); //~ ERROR mismatched types
}
fn call_foo_d() {
// This test passes because `a` has type `!`:
let a: ! = return;
let b = 22;
let c = 44;
foo(a, b, c); // ... and hence a reference to `a` is expected to diverge.
}
fn call_foo_e() {
// This test probably could pass but we don't *know* that `a`
// has type `!` so we don't let it work.
let a = return;
let b = 22;
let c = 44;
foo(a, b, c); //~ ERROR mismatched types
}
fn call_foo_f() {
// This fn fails because `a` has type `usize`, and hence a
// reference to is it **not** considered to diverge.
let a: usize = return;
let b = 22;
let c = 44;
foo(a, b, c); //~ ERROR mismatched types
}
fn array_a() {
// Accepted: return is coerced to `!` just fine, and then `22` can be
// because we already diverged.
let x: [!; 2] = [return, 22];
}
fn array_b() {
// Error: divergence has not yet occurred.
let x: [!; 2] = [22, return]; //~ ERROR mismatched types
}
fn tuple_a() {
// No divergence at all.
let x: (usize, !, usize) = (22, 44, 66); //~ ERROR mismatched types
}
fn tuple_b() {
// Divergence happens before coercion: OK
let x: (usize, !, usize) = (return, 44, 66);
}
fn tuple_c() {
// Divergence happens before coercion: OK
let x: (usize, !, usize) = (22, return, 66);
}
fn tuple_d() {
// Error: divergence happens too late
let x: (usize, !, usize) = (22, 44, return); //~ ERROR mismatched types
}
fn main() { }

View file

@ -0,0 +1,25 @@
// Copyright 2017 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.
const x: bool = match Some(true) {
Some(value) => true,
//~^ ERROR: constant contains unimplemented expression type [E0019]
_ => false
};
const y: bool = {
match Some(true) {
Some(value) => true,
//~^ ERROR: constant contains unimplemented expression type [E0019]
_ => false
}
};
fn main() {}

View file

@ -22,16 +22,6 @@ impl Deserialize for () {
}
}
fn doit() -> Result<(), String> {
let _ = match Deserialize::deserialize() {
//~^ ERROR code relies on type
//~| WARNING previously accepted
Ok(x) => x,
Err(e) => return Err(e),
};
Ok(())
}
trait ImplementedForUnitButNotNever {}
impl ImplementedForUnitButNotNever for () {}
@ -46,6 +36,6 @@ fn smeg() {
}
fn main() {
let _ = doit();
smeg();
}

View file

@ -8,24 +8,18 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(unreachable_code)]
pub fn expr_while_23() {
let mut x = 23;
let mut y = 23;
let mut z = 23;
// After #39485, this test used to pass, but that change was reverted
// due to numerous inference failures like #39808, so it now fails
// again. #39485 made it so that diverging types never propagate
// upward; but we now do propagate such types upward in many more
// cases.
while x > 0 {
x -= 1;
while y > 0 {
y -= 1;
while z > 0 { z -= 1; }
if x > 10 {
return;
"unreachable";
}
}
}
fn g() {
&panic!() //~ ERROR mismatched types
}
fn f() -> isize {
(return 1, return 2) //~ ERROR mismatched types
}
fn main() {}

View file

@ -0,0 +1,19 @@
// Copyright 2017 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.
#![feature(use_extern_macros)]
pub use std::panic; //~ NOTE previous macro export here
#[macro_export]
macro_rules! panic { () => {} } //~ ERROR a macro named `panic` has already been exported
//~| NOTE `panic` already exported
fn main() {}

View file

@ -0,0 +1,15 @@
// Copyright 2017 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.
#[allow(unused_variables)]
fn main() {
let x: &'static u32 = &42; //~ error: does not live long enough
let y: &'static Option<u32> = &None; //~ error: does not live long enough
}

View file

@ -0,0 +1,15 @@
// Copyright 2017 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.
#[used]
fn foo() {}
//~^^ ERROR the `#[used]` attribute is an experimental feature
fn main() {}

View file

@ -25,7 +25,6 @@ fn f() {
bar::m! { //~ ERROR ambiguous
//~| NOTE macro-expanded items do not shadow when used in a macro invocation path
mod bar { pub use two_macros::m; } //~ NOTE could refer to the name defined here
//~^^^ NOTE in this expansion
}
}
@ -37,6 +36,5 @@ fn g() {
baz::m! { //~ ERROR ambiguous
//~| NOTE macro-expanded items do not shadow when used in a macro invocation path
mod baz { pub use two_macros::m; } //~ NOTE could refer to the name defined here
//~^^^ NOTE in this expansion
}
}

View file

@ -28,7 +28,6 @@ mod m2 {
m! { //~ ERROR ambiguous
//~| NOTE macro-expanded macro imports do not shadow
use foo::m; //~ NOTE could refer to the name imported here
//~^^^ NOTE in this expansion
}
}
@ -43,7 +42,6 @@ mod m3 {
m! { //~ ERROR ambiguous
//~| NOTE macro-expanded macro imports do not shadow
use two_macros::n as m; //~ NOTE could refer to the name imported here
//~^^^ NOTE in this expansion
}
}
}

View file

@ -0,0 +1,71 @@
// Copyright 2017 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.
// aux-build:two_macros.rs
#![feature(use_extern_macros)]
mod foo {
extern crate two_macros;
pub use self::two_macros::m as panic;
}
mod m1 {
use foo::panic; // ok
fn f() { panic!(); }
}
mod m2 {
use foo::*; //~ NOTE `panic` could refer to the name imported here
fn f() { panic!(); } //~ ERROR ambiguous
//~| NOTE `panic` is also a builtin macro
//~| NOTE consider adding an explicit import of `panic` to disambiguate
}
mod m3 {
::two_macros::m!(use foo::panic;); //~ NOTE `panic` could refer to the name imported here
fn f() { panic!(); } //~ ERROR ambiguous
//~| NOTE `panic` is also a builtin macro
//~| NOTE macro-expanded macro imports do not shadow
}
mod m4 {
macro_rules! panic { () => {} } // ok
panic!();
}
mod m5 {
macro_rules! m { () => {
macro_rules! panic { () => {} } //~ ERROR `panic` is already in scope
//~| NOTE macro-expanded `macro_rules!`s may not shadow existing macros
} }
m!(); //~ NOTE in this expansion
//~| NOTE in this expansion
panic!();
}
#[macro_use(n)] //~ NOTE `n` could also refer to the name imported here
extern crate two_macros;
mod bar {
pub use two_macros::m as n;
}
mod m6 {
use bar::n; // ok
n!();
}
mod m7 {
use bar::*; //~ NOTE `n` could refer to the name imported here
n!(); //~ ERROR ambiguous
//~| NOTE consider adding an explicit import of `n` to disambiguate
}
fn main() {}

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
#![deny(unused)]
mod foo {

View file

@ -9,5 +9,5 @@
// except according to those terms.
fn main() {
(return)[0]; //~ ERROR the type of this value must be known in this context
(return)[0]; //~ ERROR cannot index a value of type `!`
}

View file

@ -13,7 +13,7 @@
fn main() {
fn bar<T>(_: T) {}
[0][0u8]; //~ ERROR: the trait bound `u8: std::slice::SliceIndex<{integer}>` is not satisfied
[0][0u8]; //~ ERROR: the trait bound `u8: std::slice::SliceIndex<[{integer}]>` is not satisfied
[0][0]; // should infer to be a usize

View file

@ -19,8 +19,8 @@ pub fn main() {
v[3i32]; //~ERROR : std::ops::Index<i32>` is not satisfied
s.as_bytes()[3_usize];
s.as_bytes()[3];
s.as_bytes()[3u8]; //~ERROR : std::slice::SliceIndex<u8>` is not satisfied
s.as_bytes()[3i8]; //~ERROR : std::slice::SliceIndex<u8>` is not satisfied
s.as_bytes()[3u32]; //~ERROR : std::slice::SliceIndex<u8>` is not satisfied
s.as_bytes()[3i32]; //~ERROR : std::slice::SliceIndex<u8>` is not satisfied
s.as_bytes()[3u8]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied
s.as_bytes()[3i8]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied
s.as_bytes()[3u32]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied
s.as_bytes()[3i32]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied
}

View file

@ -8,12 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn g() {
&panic!()
}
fn f() -> isize {
(return 1, return 2)
//~^ ERROR mismatched types
//~| expected type `isize`
//~| found type `(!, !)`
//~| expected isize, found tuple
}
fn main() {}

View file

@ -9,5 +9,5 @@
// except according to those terms.
fn main() {
return.is_failure //~ ERROR the type of this value must be known in this context
return.is_failure //~ ERROR no field `is_failure` on type `!`
}

View file

@ -10,7 +10,7 @@
fn main() {
loop {
break.push(1) //~ ERROR the type of this value must be known in this context
break.push(1) //~ ERROR no method named `push` found for type `!`
;
}
}

View file

@ -9,6 +9,6 @@
// except according to those terms.
fn main() {
*return //~ ERROR the type of this value must be known in this context
*return //~ ERROR type `!` cannot be dereferenced
;
}

View file

@ -13,6 +13,5 @@
// into it.
fn main() {
(return)((),());
//~^ ERROR the type of this value must be known
(return)((),()); //~ ERROR expected function, found `!`
}

View file

@ -21,5 +21,5 @@ impl<A> vec_monad<A> for Vec<A> {
}
fn main() {
["hi"].bind(|x| [x] );
//~^ ERROR no method named `bind` found for type `[&'static str; 1]` in the current scope
//~^ ERROR no method named `bind` found for type `[&str; 1]` in the current scope
}

View file

@ -21,5 +21,4 @@ fn main() {
foo!(1i32.foo());
//~^ ERROR no method named `foo` found for type `i32` in the current scope
//~^^ NOTE in this expansion of foo!
}

View file

@ -12,14 +12,14 @@
fn main() {
let _: i32 =
'a: //~ ERROR mismatched types
loop { break };
'a: // in this case, the citation is just the `break`:
loop { break }; //~ ERROR mismatched types
let _: i32 =
'b: //~ ERROR mismatched types
while true { break };
while true { break }; // but here we cite the whole loop
let _: i32 =
'c: //~ ERROR mismatched types
for _ in None { break };
for _ in None { break }; // but here we cite the whole loop
let _: i32 =
'd: //~ ERROR mismatched types
while let Some(_) = None { break };

View file

@ -12,7 +12,7 @@ fn main() {
match op {
Some(ref v) => { let a = &mut v; },
//~^ ERROR:cannot borrow immutable
//~| use `ref mut v` here to make mutable
//~| cannot borrow mutably
None => {},
}
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn main () {
let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `+`, `,`, or `>`, found `=`
let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=`
let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
//~^ ERROR cannot find value `sr` in this scope
}

View file

@ -0,0 +1,67 @@
// Copyright 2017 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.
enum Fruit {
Apple(i64),
//~^ HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
//~| HELP there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`?
Orange(i64),
}
fn should_return_fruit() -> Apple {
//~^ ERROR cannot find type `Apple` in this scope
//~| NOTE not found in this scope
Apple(5)
//~^ ERROR cannot find function `Apple` in this scope
//~| NOTE not found in this scope
//~| HELP possible candidate is found in another module, you can import it into scope
}
fn should_return_fruit_too() -> Fruit::Apple {
//~^ ERROR expected type, found variant `Fruit::Apple`
//~| NOTE not a type
Apple(5)
//~^ ERROR cannot find function `Apple` in this scope
//~| NOTE not found in this scope
//~| HELP possible candidate is found in another module, you can import it into scope
}
fn foo() -> Ok {
//~^ ERROR expected type, found variant `Ok`
//~| NOTE not a type
//~| HELP there is an enum variant
//~| HELP there is an enum variant
Ok(())
}
fn bar() -> Variant3 {
//~^ ERROR cannot find type `Variant3` in this scope
//~| NOTE not found in this scope
}
fn qux() -> Some {
//~^ ERROR expected type, found variant `Some`
//~| NOTE not a type
//~| HELP there is an enum variant
//~| HELP there is an enum variant
Some(1)
}
fn main() {}
mod x {
enum Enum {
Variant1,
Variant2(),
Variant3(usize),
//~^ HELP there is an enum variant `x::Enum::Variant3`, did you mean to use `x::Enum`?
Variant4 {},
}
}

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -8,6 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub fn pat_tup_5() {
let (_x, _y) = (5, 55);
#![feature(closure_to_fn_coercion)]
fn main() {
let bar: fn(&mut u32) = |_| {}; //~ ERROR mismatched types
//~| expected concrete lifetime, found bound lifetime parameter
fn foo(x: Box<Fn(&i32)>) {}
let bar = Box::new(|x: &i32| {}) as Box<Fn(_)>;
foo(bar); //~ ERROR mismatched types
//~| expected concrete lifetime, found bound lifetime parameter
}

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -8,10 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(slice_patterns)]
fn f(_: &[f32]) {}
pub fn pat_vec_7() {
match [7, 77, 777, 7777] {
[x, y, ..] => x + y
};
fn main() {
() + f(&[1.0]);
//~^ ERROR binary operation `+` cannot be applied to type `()`
}

View file

@ -0,0 +1,16 @@
// Copyright 2017 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.
fn main() {
[0; ..10];
//~^ ERROR mismatched types
//~| expected type `usize`
//~| found type `std::ops::RangeTo<{integer}>`
}

View file

@ -0,0 +1,16 @@
// Copyright 2017 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.
trait T { m!(); } //~ ERROR cannot find macro `m!` in this scope
struct S;
impl S { m!(); } //~ ERROR cannot find macro `m!` in this scope
fn main() {}

View file

@ -0,0 +1,16 @@
// Copyright 2017 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.
fn f(_: &[f32]) {}
fn main() {
()[f(&[1.0])];
//~^ ERROR cannot index a value of type `()`
}

View file

@ -0,0 +1,17 @@
// Copyright 2013 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.
fn main() {
&panic!()
//~^ ERROR mismatched types
//~| expected type `()`
//~| found type `&_`
//~| expected (), found reference
}

View file

@ -40,37 +40,40 @@ fn main() {
loop {
break 'while_loop 123;
//~^ ERROR `break` with value from a `while` loop
//~| ERROR mismatched types
break 456;
break 789;
};
}
'while_let_loop: while let Some(_) = Some(()) {
while let Some(_) = Some(()) {
if break () { //~ ERROR `break` with value from a `while let` loop
break;
break None;
//~^ ERROR `break` with value from a `while let` loop
//~| ERROR mismatched types
}
}
while let Some(_) = Some(()) {
break None;
//~^ ERROR `break` with value from a `while let` loop
}
'while_let_loop: while let Some(_) = Some(()) {
loop {
break 'while_let_loop "nope";
//~^ ERROR `break` with value from a `while let` loop
//~| ERROR mismatched types
break 33;
};
}
'for_loop: for _ in &[1,2,3] {
for _ in &[1,2,3] {
break (); //~ ERROR `break` with value from a `for` loop
break [()];
//~^ ERROR `break` with value from a `for` loop
//~| ERROR mismatched types
}
'for_loop: for _ in &[1,2,3] {
loop {
break Some(3);
break 'for_loop Some(17);
//~^ ERROR `break` with value from a `for` loop
//~| ERROR mismatched types
};
}

View file

@ -8,7 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z parse-only
#[doc = $not_there] //~ error: unexpected token: `$`
fn main() { }

View file

@ -14,4 +14,5 @@ fn main() {
globnar::brotz!(); //~ ERROR non-ident macro paths are experimental
::foo!(); //~ ERROR non-ident macro paths are experimental
foo::<T>!(); //~ ERROR type parameters are not allowed on macros
#[derive(foo::Bar)] struct T; //~ ERROR non-ident macro paths are experimental
}

View file

@ -9,11 +9,11 @@
// except according to those terms.
#[derive(Copy(Bad))]
//~^ ERROR malformed `derive` entry
//~^ ERROR expected one of `)`, `,`, or `::`, found `(`
struct Test1;
#[derive(Copy="bad")]
//~^ ERROR malformed `derive` entry
//~^ ERROR expected one of `)`, `,`, or `::`, found `=`
struct Test2;
#[derive()]

View file

@ -11,7 +11,7 @@
// ignore-macos
// ignore-ios
// compile-flags:-l framework=foo
// error-pattern: native frameworks are only available on OSX targets
// error-pattern: native frameworks are only available on macOS targets
fn main() {
}

View file

@ -0,0 +1,22 @@
// 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.
#![allow(warnings)]
#![deny(unreachable_code)]
enum Void { }
fn foo(v: Void) {
match v { }
let x = 2; //~ ERROR unreachable
}
fn main() {
}

View file

@ -8,9 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// gate-test-windows_subsystem
#![allow(unused_parens)]
#![deny(unreachable_code)]
#![windows_subsystem = "console"]
//~^ ERROR: the windows subsystem attribute is currently unstable
fn main() {}
fn main() {
match (return) { } //~ ERROR unreachable expression
}

View file

@ -0,0 +1,17 @@
// 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.
fn foo<T>() -> T { panic!("Rocks for my pillow") }
fn main() {
let x = match () { //~ ERROR type annotations needed
() => foo() // T here should be unresolved
};
}

View file

@ -17,7 +17,7 @@ impl S {
}
fn func(arg: S) {
//~^ here to make mutable
//~^ consider changing this to `mut arg`
arg.mutate();
//~^ ERROR cannot borrow immutable argument
//~| cannot borrow mutably
@ -25,7 +25,7 @@ fn func(arg: S) {
fn main() {
let local = S;
//~^ here to make mutable
//~^ consider changing this to `mut local`
local.mutate();
//~^ ERROR cannot borrow immutable local variable
//~| cannot borrow mutably

View file

@ -16,5 +16,6 @@
fn main() {
let x: ! = panic!("aah"); //~ ERROR unused
drop(x); //~ ERROR unreachable
//~^ ERROR unreachable
}

View file

@ -11,6 +11,7 @@
// Test that we can't use another type in place of !
#![feature(never_type)]
#![deny(warnings)]
fn main() {
let x: ! = "hello"; //~ ERROR mismatched types

View file

@ -1,41 +0,0 @@
// Copyright 2015 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.
// Test that diverging types default to ! when feature(never_type) is enabled. This test is the
// same as run-pass/unit-fallback.rs except that ! is enabled.
#![feature(never_type)]
trait Balls: Sized {
fn smeg() -> Result<Self, ()>;
}
impl Balls for () {
fn smeg() -> Result<(), ()> { Ok(()) }
}
struct Flah;
impl Flah {
fn flah<T: Balls>(&self) -> Result<T, ()> {
T::smeg()
}
}
fn doit() -> Result<(), ()> {
// The type of _ is unconstrained here and should default to !
let _ = try!(Flah.flah()); //~ ERROR the trait bound
Ok(())
}
fn main() {
let _ = doit();
}

View file

@ -24,7 +24,7 @@ fn make_bar<T:Bar<u32>>(t: &T) -> &Bar<u32> {
fn make_baz<T:Baz>(t: &T) -> &Baz {
//~^ ERROR E0038
//~| NOTE the trait cannot use `Self` as a type parameter in the supertrait listing
//~| NOTE the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
//~| NOTE the trait `Baz` cannot be made into an object
t
}

View file

@ -20,10 +20,10 @@ fn main() {
let x = &[1, 2, 3] as &[i32];
x[1i32]; //~ ERROR E0277
//~| NOTE slice indices are of type `usize` or ranges of `usize`
//~| NOTE trait `std::slice::SliceIndex<i32>` is not implemented for `i32`
//~| NOTE trait `std::slice::SliceIndex<[i32]>` is not implemented for `i32`
//~| NOTE required because of the requirements on the impl of `std::ops::Index<i32>`
x[..1i32]; //~ ERROR E0277
//~| NOTE slice indices are of type `usize` or ranges of `usize`
//~| NOTE trait `std::slice::SliceIndex<i32>` is not implemented for `std::ops::RangeTo<i32>`
//~| NOTE trait `std::slice::SliceIndex<[i32]>` is not implemented for `std::ops::RangeTo<i32>`
//~| NOTE requirements on the impl of `std::ops::Index<std::ops::RangeTo<i32>>`
}

View file

@ -12,7 +12,7 @@
#[link(name = "foo", kind = "framework")]
extern {}
//~^^ ERROR: native frameworks are only available on OSX
//~^^ ERROR: native frameworks are only available on macOS
fn main() {
}

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
pub(crate) struct Crate;
#[derive(Default)]
pub struct Universe {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs, pub_restricted)]
#![feature(rustc_attrs)]
#![allow(warnings)]
mod foo {

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
mod foo {
struct Priv;
mod bar {

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
#![deny(private_in_public)]
#![allow(warnings)]

View file

@ -10,7 +10,6 @@
// aux-build:pub_restricted.rs
#![feature(pub_restricted)]
#![deny(private_in_public)]
#![allow(warnings)]
extern crate pub_restricted;

View file

@ -8,11 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
mod foo {
type T = ();
struct S1(pub(foo) (), pub(T), pub(crate) (), pub(((), T)));
struct S2(pub((foo)) ()); //~ ERROR expected one of `+` or `,`, found `(`
//~| ERROR expected one of `+`, `;`, or `where`, found `(`
struct S1(pub(in foo) (), pub(T), pub(crate) (), pub(((), T)));
struct S2(pub((foo)) ());
//~^ ERROR expected `,`, found `(`
//~| ERROR expected one of `;` or `where`, found `(`
}

View file

@ -8,14 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
macro_rules! define_struct {
($t:ty) => {
struct S1(pub $t);
struct S2(pub (foo) ());
struct S3(pub $t ()); //~ ERROR expected one of `+` or `,`, found `(`
//~| ERROR expected one of `+`, `;`, or `where`, found `(`
struct S2(pub (in foo) ());
struct S3(pub $t ());
//~^ ERROR expected `,`, found `(`
//~| ERROR expected one of `;` or `where`, found `(`
}
}

View file

@ -8,14 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
macro_rules! define_struct {
($t:ty) => {
struct S1(pub($t));
struct S2(pub (foo) ());
struct S3(pub($t) ()); //~ ERROR expected one of `+` or `,`, found `(`
//~| ERROR expected one of `+`, `;`, or `where`, found `(`
struct S2(pub (in foo) ());
struct S3(pub($t) ());
//~^ ERROR expected `,`, found `(`
//~| ERROR expected one of `;` or `where`, found `(`
}
}

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
macro_rules! m {
($p: path) => (pub(in $p) struct Z;)
}

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
#![feature(untagged_unions)]
mod m {

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(pub_restricted)]
#![feature(untagged_unions)]
mod m {

View file

@ -18,7 +18,7 @@ trait SomeTrait { }
// Bounds on object types:
struct Foo<'a,'b,'c> { //~ ERROR parameter `'b` is never used
struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used
// All of these are ok, because we can derive exactly one bound:
a: Box<IsStatic>,
b: Box<Is<'static>>,

View file

@ -13,9 +13,6 @@
// over time, but this test used to exhibit some pretty bogus messages
// that were not remotely helpful.
// error-pattern:cannot infer
// error-pattern:cannot outlive the lifetime 'a
// error-pattern:must be valid for the static lifetime
// error-pattern:cannot infer
// error-pattern:cannot outlive the lifetime 'a
// error-pattern:must be valid for the static lifetime

View file

@ -16,17 +16,11 @@ struct an_enum<'a>(&'a isize);
struct a_class<'a> { x:&'a isize }
fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> {
return e; //~ ERROR mismatched types
//~| expected type `an_enum<'b>`
//~| found type `an_enum<'a>`
//~| lifetime mismatch
return e; //~ ERROR mismatched types
}
fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> {
return e; //~ ERROR mismatched types
//~| expected type `a_class<'b>`
//~| found type `a_class<'a>`
//~| lifetime mismatch
return e; //~ ERROR mismatched types
}
fn main() { }

Some files were not shown because too many files have changed in this diff Show more