diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2017-12-10 22:47:55 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2017-12-14 23:23:07 +0300 |
| commit | d4e51a8fb286444a8c276a05a1c3ba6ba8ca6576 (patch) | |
| tree | 242ff95d0af269023f4cd5dd1df92fec60ca346d /src/test/compile-fail | |
| parent | 3a2ad576c5d4b92bacc3355b14cc7a9bc704c782 (diff) | |
| download | rust-d4e51a8fb286444a8c276a05a1c3ba6ba8ca6576.tar.gz rust-d4e51a8fb286444a8c276a05a1c3ba6ba8ca6576.zip | |
Move compile-fail tests with NOTE/HELP annotations to UI
Diffstat (limited to 'src/test/compile-fail')
229 files changed, 0 insertions, 7745 deletions
diff --git a/src/test/compile-fail/arbitrary-self-types-not-object-safe.rs b/src/test/compile-fail/arbitrary-self-types-not-object-safe.rs deleted file mode 100644 index 6b10739bd8e..00000000000 --- a/src/test/compile-fail/arbitrary-self-types-not-object-safe.rs +++ /dev/null @@ -1,55 +0,0 @@ -// 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(arbitrary_self_types)] - -use std::rc::Rc; - -trait Foo { - fn foo(self: Rc<Self>) -> usize; -} - -trait Bar { - fn foo(self: Rc<Self>) -> usize where Self: Sized; - fn bar(self: Box<Self>) -> usize; -} - -impl Foo for usize { - fn foo(self: Rc<Self>) -> usize { - *self - } -} - -impl Bar for usize { - fn foo(self: Rc<Self>) -> usize { - *self - } - - fn bar(self: Box<Self>) -> usize { - *self - } -} - -fn make_foo() { - let x = Box::new(5usize) as Box<Foo>; - //~^ ERROR E0038 - //~| NOTE method `foo` has a non-standard `self` type - //~| NOTE the trait `Foo` cannot be made into an object - //~| ERROR E0038 - //~| NOTE method `foo` has a non-standard `self` type - //~| NOTE the trait `Foo` cannot be made into an object - //~| NOTE requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` -} - -fn make_bar() { - let x = Box::new(5usize) as Box<Bar>; - x.bar(); -} - -fn main() {} diff --git a/src/test/compile-fail/asm-out-assign-imm.rs b/src/test/compile-fail/asm-out-assign-imm.rs deleted file mode 100644 index f2629fa52ff..00000000000 --- a/src/test/compile-fail/asm-out-assign-imm.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012-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-s390x -// ignore-emscripten -// ignore-powerpc -// ignore-sparc - -#![feature(asm)] - -fn foo(x: isize) { println!("{}", x); } - -#[cfg(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64"))] -pub fn main() { - let x: isize; - x = 1; //~ NOTE first assignment - foo(x); - unsafe { - asm!("mov $1, $0" : "=r"(x) : "r"(5)); - //~^ ERROR cannot assign twice to immutable variable `x` - //~| NOTE cannot assign twice to immutable - } - foo(x); -} - -#[cfg(not(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64")))] -pub fn main() {} diff --git a/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs b/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs deleted file mode 100644 index 51681a4bb88..00000000000 --- a/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs +++ /dev/null @@ -1,26 +0,0 @@ -// 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 Foo { - const NAME: &'static str; -} - - -impl<'a> Foo for &'a () { -//~^ NOTE the lifetime 'a as defined - const NAME: &'a str = "unit"; - //~^ ERROR mismatched types [E0308] - //~| NOTE lifetime mismatch - //~| NOTE expected type `&'static str` - //~| NOTE ...does not necessarily outlive the static lifetime -} - -fn main() {} diff --git a/src/test/compile-fail/associated-const-impl-wrong-type.rs b/src/test/compile-fail/associated-const-impl-wrong-type.rs deleted file mode 100644 index e38851ccd6f..00000000000 --- a/src/test/compile-fail/associated-const-impl-wrong-type.rs +++ /dev/null @@ -1,24 +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. - - -trait Foo { - const BAR: u32; //~ NOTE type in trait -} - -struct SignedBar; - -impl Foo for SignedBar { - const BAR: i32 = -1; - //~^ ERROR implemented const `BAR` has an incompatible type for trait [E0326] - //~| NOTE expected u32, found i32 -} - -fn main() {} diff --git a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs b/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs deleted file mode 100644 index b33bbfd8425..00000000000 --- a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2014 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 equality constraints in a where clause where the type being -// equated appears in a supertrait. - -pub trait Vehicle { - type Color; - //~^ NOTE ambiguous `Color` from `Vehicle` - //~| NOTE ambiguous `Color` from `Vehicle` - //~| NOTE ambiguous `Color` from `Vehicle` - - fn go(&self) { } -} - -pub trait Box { - type Color; - //~^ NOTE ambiguous `Color` from `Box` - //~| NOTE ambiguous `Color` from `Box` - //~| NOTE ambiguous `Color` from `Box` - // - fn mail(&self) { } -} - -pub trait BoxCar : Box + Vehicle { -} - -fn dent<C:BoxCar>(c: C, color: C::Color) { - //~^ ERROR ambiguous associated type `Color` in bounds of `C` - //~| NOTE ambiguous associated type `Color` -} - -fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) { - //~^ ERROR ambiguous associated type - //~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified - //~| NOTE ambiguous associated type `Color` - //~| NOTE missing associated type `Color` value -} - -fn paint<C:BoxCar>(c: C, d: C::Color) { - //~^ ERROR ambiguous associated type `Color` in bounds of `C` - //~| NOTE ambiguous associated type `Color` -} - -pub fn main() { } diff --git a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs b/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs deleted file mode 100644 index 74a388e7269..00000000000 --- a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 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 we do not ICE when the self type is `ty::err`, but rather -// just propagate the error. - -#![crate_type = "lib"] -#![feature(lang_items)] -#![feature(no_core)] -#![no_core] - -#[lang="sized"] -pub trait Sized { - // Empty. -} - -#[lang = "add"] -trait Add<RHS=Self> { - type Output; - - fn add(self, _: RHS) -> Self::Output; -} - -fn ice<A>(a: A) { - let r = loop {}; - r = r + a; - //~^ ERROR the trait bound `(): Add<A>` is not satisfied - //~| NOTE the trait `Add<A>` is not implemented for `()` -} diff --git a/src/test/compile-fail/associated-types-in-ambiguous-context.rs b/src/test/compile-fail/associated-types-in-ambiguous-context.rs deleted file mode 100644 index ff886e63dc5..00000000000 --- a/src/test/compile-fail/associated-types-in-ambiguous-context.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 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 Get { - type Value; - fn get(&self) -> <Self as Get>::Value; -} - -fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {} -//~^ ERROR ambiguous associated type -//~| NOTE ambiguous associated type -//~| NOTE specify the type using the syntax `<Type as Get>::Value` - -trait Grab { - type Value; - fn grab(&self) -> Grab::Value; - //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `<Type as Grab>::Value` -} - -type X = std::ops::Deref::Target; -//~^ ERROR ambiguous associated type -//~| NOTE ambiguous associated type -//~| NOTE specify the type using the syntax `<Type as std::ops::Deref>::Target` - -fn main() { -} diff --git a/src/test/compile-fail/augmented-assignments.rs b/src/test/compile-fail/augmented-assignments.rs deleted file mode 100644 index 736aa465aa7..00000000000 --- a/src/test/compile-fail/augmented-assignments.rs +++ /dev/null @@ -1,35 +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. - -use std::ops::AddAssign; - -struct Int(i32); - -impl AddAssign for Int { - fn add_assign(&mut self, _: Int) { - unimplemented!() - } -} - -fn main() { - let mut x = Int(1); - x //~ error: use of moved value: `x` - //~^ value used here after move - //~| note: move occurs because `x` has type `Int` - += - x; //~ value moved here - - let y = Int(2); - //~^ consider changing this to `mut y` - y //~ error: cannot borrow immutable local variable `y` as mutable - //~| cannot borrow - += - Int(1); -} diff --git a/src/test/compile-fail/auxiliary/changing-crates-a1.rs b/src/test/compile-fail/auxiliary/changing-crates-a1.rs deleted file mode 100644 index 18162c5f756..00000000000 --- a/src/test/compile-fail/auxiliary/changing-crates-a1.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 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. - -#![crate_name = "a"] - -pub fn foo<T>() {} diff --git a/src/test/compile-fail/auxiliary/changing-crates-a2.rs b/src/test/compile-fail/auxiliary/changing-crates-a2.rs deleted file mode 100644 index 28eae023d68..00000000000 --- a/src/test/compile-fail/auxiliary/changing-crates-a2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 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. - -#![crate_name = "a"] - -pub fn foo<T>() { println!("hello!"); } diff --git a/src/test/compile-fail/auxiliary/changing-crates-b.rs b/src/test/compile-fail/auxiliary/changing-crates-b.rs deleted file mode 100644 index 7b1190fc085..00000000000 --- a/src/test/compile-fail/auxiliary/changing-crates-b.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 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. - -#![crate_name = "b"] - -extern crate a; - -pub fn foo() { a::foo::<isize>(); } diff --git a/src/test/compile-fail/auxiliary/issue-36708.rs b/src/test/compile-fail/auxiliary/issue-36708.rs deleted file mode 100644 index e64e63a2139..00000000000 --- a/src/test/compile-fail/auxiliary/issue-36708.rs +++ /dev/null @@ -1,15 +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. - -#![crate_type = "lib"] - -pub trait Foo { - fn foo(); -} diff --git a/src/test/compile-fail/auxiliary/svh-a-base.rs b/src/test/compile-fail/auxiliary/svh-a-base.rs deleted file mode 100644 index 31a97f695f0..00000000000 --- a/src/test/compile-fail/auxiliary/svh-a-base.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 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. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -pub fn foo<T:U>(_: isize) -> isize { - 3 -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/compile-fail/auxiliary/svh-a-change-lit.rs b/src/test/compile-fail/auxiliary/svh-a-change-lit.rs deleted file mode 100644 index 5339fc8295c..00000000000 --- a/src/test/compile-fail/auxiliary/svh-a-change-lit.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 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. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -pub fn foo<T:U>(_: isize) -> isize { - 0 -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/compile-fail/auxiliary/svh-a-change-significant-cfg.rs b/src/test/compile-fail/auxiliary/svh-a-change-significant-cfg.rs deleted file mode 100644 index 2a5d9446f87..00000000000 --- a/src/test/compile-fail/auxiliary/svh-a-change-significant-cfg.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 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. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -#[cfg(some_flag)] -pub fn foo<T:U>(_: isize) -> isize { - 3 -} - -#[cfg(not(some_flag))] -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/compile-fail/auxiliary/svh-a-change-trait-bound.rs b/src/test/compile-fail/auxiliary/svh-a-change-trait-bound.rs deleted file mode 100644 index 61f2f2803ab..00000000000 --- a/src/test/compile-fail/auxiliary/svh-a-change-trait-bound.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 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. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -pub fn foo<T:V>(_: isize) -> isize { - 3 -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/compile-fail/auxiliary/svh-a-change-type-arg.rs b/src/test/compile-fail/auxiliary/svh-a-change-type-arg.rs deleted file mode 100644 index 270ce95be2b..00000000000 --- a/src/test/compile-fail/auxiliary/svh-a-change-type-arg.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 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. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -pub fn foo<T:U>(_: i32) -> isize { - 3 -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/compile-fail/auxiliary/svh-a-change-type-ret.rs b/src/test/compile-fail/auxiliary/svh-a-change-type-ret.rs deleted file mode 100644 index de4cc85a7dc..00000000000 --- a/src/test/compile-fail/auxiliary/svh-a-change-type-ret.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 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. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : isize = 2; - -pub fn foo<T:U>(_: isize) -> i64 { - 3 -} - -pub fn an_unused_name() -> i32 { - 4 -} diff --git a/src/test/compile-fail/auxiliary/svh-a-change-type-static.rs b/src/test/compile-fail/auxiliary/svh-a-change-type-static.rs deleted file mode 100644 index 62f7986f1c3..00000000000 --- a/src/test/compile-fail/auxiliary/svh-a-change-type-static.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 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. - -//! The `svh-a-*.rs` files are all deviations from the base file -//! svh-a-base.rs with some difference (usually in `fn foo`) that -//! should not affect the strict version hash (SVH) computation -//! (#14132). - -#![crate_name = "a"] -#![feature(core)] - -macro_rules! three { - () => { 3 } -} - -pub trait U {} -pub trait V {} -impl U for () {} -impl V for () {} - -static A_CONSTANT : i32 = 2; - -pub fn foo<T:U>(_: isize) -> isize { - 3 -} - -pub fn an_unused_name() -> isize { - 4 -} diff --git a/src/test/compile-fail/auxiliary/svh-b.rs b/src/test/compile-fail/auxiliary/svh-b.rs deleted file mode 100644 index b8946fdc995..00000000000 --- a/src/test/compile-fail/auxiliary/svh-b.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 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. - -//! This is a client of the `a` crate defined in "svn-a-base.rs". The -//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use -//! it by swapping in a different object code library crate built from -//! some variant of "svn-a-base.rs", and then we are checking if the -//! compiler properly ignores or accepts the change, based on whether -//! the change could affect the downstream crate content or not -//! (#14132). - -#![crate_name = "b"] - -extern crate a; - -pub fn foo() { assert_eq!(a::foo::<()>(0), 3); } diff --git a/src/test/compile-fail/auxiliary/svh-uta-base.rs b/src/test/compile-fail/auxiliary/svh-uta-base.rs deleted file mode 100644 index 6bd3ddab06c..00000000000 --- a/src/test/compile-fail/auxiliary/svh-uta-base.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 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. - -//! "compile-fail/svh-uta-trait.rs" is checking that we detect a -//! change from `use foo::TraitB` to use `foo::TraitB` in the hash -//! (SVH) computation (#14132), since that will affect method -//! resolution. -//! -//! This is the upstream crate. - -#![crate_name = "uta"] - -mod traits { - pub trait TraitA { fn val(&self) -> isize { 2 } } - pub trait TraitB { fn val(&self) -> isize { 3 } } -} - -impl traits::TraitA for () {} -impl traits::TraitB for () {} - -pub fn foo<T>(_: isize) -> isize { - use traits::TraitA; - let v = (); - v.val() -} diff --git a/src/test/compile-fail/auxiliary/svh-uta-change-use-trait.rs b/src/test/compile-fail/auxiliary/svh-uta-change-use-trait.rs deleted file mode 100644 index e8634168177..00000000000 --- a/src/test/compile-fail/auxiliary/svh-uta-change-use-trait.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 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. - -//! "compile-fail/svh-uta-trait.rs" is checking that we detect a -//! change from `use foo::TraitB` to use `foo::TraitB` in the hash -//! (SVH) computation (#14132), since that will affect method -//! resolution. -//! -//! This is the upstream crate. - -#![crate_name = "uta"] - -mod traits { - pub trait TraitA { fn val(&self) -> isize { 2 } } - pub trait TraitB { fn val(&self) -> isize { 3 } } -} - -impl traits::TraitA for () {} -impl traits::TraitB for () {} - -pub fn foo<T>(_: isize) -> isize { - use traits::TraitB; - let v = (); - v.val() -} diff --git a/src/test/compile-fail/auxiliary/svh-utb.rs b/src/test/compile-fail/auxiliary/svh-utb.rs deleted file mode 100644 index eb3da985242..00000000000 --- a/src/test/compile-fail/auxiliary/svh-utb.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 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. - -//! "compile-fail/svh-uta-trait.rs" is checking that we detect a -//! change from `use foo::TraitB` to use `foo::TraitB` in the hash -//! (SVH) computation (#14132), since that will affect method -//! resolution. -//! -//! This is the downstream crate. - -#![crate_name = "utb"] - -extern crate uta; - -pub fn foo() { assert_eq!(uta::foo::<()>(0), 3); } diff --git a/src/test/compile-fail/binary-op-on-double-ref.rs b/src/test/compile-fail/binary-op-on-double-ref.rs deleted file mode 100644 index 23ca026f541..00000000000 --- a/src/test/compile-fail/binary-op-on-double-ref.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012-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 main() { - let v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9]; - let vr = v.iter().filter(|x| { - x % 2 == 0 - //~^ ERROR binary operation `%` cannot be applied to type `&&{integer}` - //~| NOTE this is a reference to a type that `%` can be applied to - //~| NOTE an implementation of `std::ops::Rem` might be missing for `&&{integer}` - }); - println!("{:?}", vr); -} diff --git a/src/test/compile-fail/blind-item-item-shadow.rs b/src/test/compile-fail/blind-item-item-shadow.rs deleted file mode 100644 index af3abe5e056..00000000000 --- a/src/test/compile-fail/blind-item-item-shadow.rs +++ /dev/null @@ -1,18 +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. - -mod foo { pub mod foo { } } //~ NOTE previous definition of the module `foo` here - -use foo::foo; -//~^ ERROR the name `foo` is defined multiple times -//~| `foo` reimported here -//~| NOTE `foo` must be defined only once in the type namespace of this module - -fn main() {} diff --git a/src/test/compile-fail/bogus-tag.rs b/src/test/compile-fail/bogus-tag.rs deleted file mode 100644 index a629f76d8b3..00000000000 --- a/src/test/compile-fail/bogus-tag.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 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 color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), } -//~^ NOTE variant `hsl` not found here - -fn main() { - let red: color = color::rgb(255, 0, 0); - match red { - color::rgb(r, g, b) => { println!("rgb"); } - color::hsl(h, s, l) => { println!("hsl"); } - //~^ ERROR no variant - //~| NOTE variant not found in `color` - } -} diff --git a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs b/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs deleted file mode 100644 index d09cb73d670..00000000000 --- a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright 2014 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(box_syntax)] - -struct A { - x: Box<isize>, - y: isize, -} - -struct B { - x: Box<isize>, - y: Box<isize>, -} - -struct C { - x: Box<A>, - y: isize, -} - -struct D { - x: Box<A>, - y: Box<isize>, -} - -fn copy_after_move() { - let a: Box<_> = box A { x: box 0, y: 1 }; - let _x = a.x; - //~^ value moved here - let _y = a.y; //~ ERROR use of moved - //~^ move occurs because `a.x` has type `std::boxed::Box<isize>` - //~| value used here after move -} - -fn move_after_move() { - let a: Box<_> = box B { x: box 0, y: box 1 }; - let _x = a.x; - //~^ value moved here - let _y = a.y; //~ ERROR use of moved - //~^ move occurs because `a.x` has type `std::boxed::Box<isize>` - //~| value used here after move -} - -fn borrow_after_move() { - let a: Box<_> = box A { x: box 0, y: 1 }; - let _x = a.x; - //~^ value moved here - let _y = &a.y; //~ ERROR use of moved - //~^ move occurs because `a.x` has type `std::boxed::Box<isize>` - //~| value used here after move -} - -fn move_after_borrow() { - let a: Box<_> = box B { x: box 0, y: box 1 }; - let _x = &a.x; - //~^ NOTE borrow of `a.x` occurs here - let _y = a.y; - //~^ ERROR cannot move - //~| move out of -} - -fn copy_after_mut_borrow() { - let mut a: Box<_> = box A { x: box 0, y: 1 }; - let _x = &mut a.x; - //~^ NOTE borrow of `a.x` occurs here - let _y = a.y; //~ ERROR cannot use - //~^ NOTE use of borrowed `a.x` -} - -fn move_after_mut_borrow() { - let mut a: Box<_> = box B { x: box 0, y: box 1 }; - let _x = &mut a.x; - //~^ NOTE borrow of `a.x` occurs here - let _y = a.y; - //~^ ERROR cannot move - //~| move out of -} - -fn borrow_after_mut_borrow() { - let mut a: Box<_> = box A { x: box 0, y: 1 }; - let _x = &mut a.x; - //~^ NOTE mutable borrow occurs here (via `a.x`) - let _y = &a.y; //~ ERROR cannot borrow - //~^ immutable borrow occurs here (via `a.y`) -} -//~^ NOTE mutable borrow ends here - -fn mut_borrow_after_borrow() { - let mut a: Box<_> = box A { x: box 0, y: 1 }; - let _x = &a.x; - //~^ NOTE immutable borrow occurs here (via `a.x`) - let _y = &mut a.y; //~ ERROR cannot borrow - //~^ mutable borrow occurs here (via `a.y`) -} -//~^ NOTE immutable borrow ends here - -fn copy_after_move_nested() { - let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; - let _x = a.x.x; - //~^ value moved here - let _y = a.y; //~ ERROR use of collaterally moved - //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box<isize>` - //~| value used here after move -} - -fn move_after_move_nested() { - let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; - let _x = a.x.x; - //~^ value moved here - let _y = a.y; //~ ERROR use of collaterally moved - //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box<isize>` - //~| value used here after move -} - -fn borrow_after_move_nested() { - let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; - let _x = a.x.x; - //~^ value moved here - let _y = &a.y; //~ ERROR use of collaterally moved - //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box<isize>` - //~| value used here after move -} - -fn move_after_borrow_nested() { - let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; - let _x = &a.x.x; - //~^ borrow of `a.x.x` occurs here - let _y = a.y; - //~^ ERROR cannot move - //~| move out of -} - -fn copy_after_mut_borrow_nested() { - let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; - let _x = &mut a.x.x; - //~^ NOTE borrow of `a.x.x` occurs here - let _y = a.y; //~ ERROR cannot use - //~^ NOTE use of borrowed `a.x.x` -} - -fn move_after_mut_borrow_nested() { - let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; - let _x = &mut a.x.x; - //~^ NOTE borrow of `a.x.x` occurs here - let _y = a.y; - //~^ ERROR cannot move - //~| move out of -} - -fn borrow_after_mut_borrow_nested() { - let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; - let _x = &mut a.x.x; - //~^ mutable borrow occurs here - let _y = &a.y; //~ ERROR cannot borrow - //~^ immutable borrow occurs here -} -//~^ NOTE mutable borrow ends here - -fn mut_borrow_after_borrow_nested() { - let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; - let _x = &a.x.x; - //~^ immutable borrow occurs here - let _y = &mut a.y; //~ ERROR cannot borrow - //~^ mutable borrow occurs here -} -//~^ NOTE immutable borrow ends here - -fn main() { - copy_after_move(); - move_after_move(); - borrow_after_move(); - - move_after_borrow(); - - copy_after_mut_borrow(); - move_after_mut_borrow(); - borrow_after_mut_borrow(); - mut_borrow_after_borrow(); - - copy_after_move_nested(); - move_after_move_nested(); - borrow_after_move_nested(); - - move_after_borrow_nested(); - - copy_after_mut_borrow_nested(); - move_after_mut_borrow_nested(); - borrow_after_mut_borrow_nested(); - mut_borrow_after_borrow_nested(); -} diff --git a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs b/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs deleted file mode 100644 index ec330247f23..00000000000 --- a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs +++ /dev/null @@ -1,27 +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. - -use std::thread::spawn; - -// Test that we give a custom error (E0373) for the case where a -// closure is escaping current frame, and offer a suggested code edit. -// I refrained from including the precise message here, but the -// original text as of the time of this writing is: -// -// closure may outlive the current function, but it borrows `books`, -// which is owned by the current function - -fn main() { - let mut books = vec![1,2,3]; - spawn(|| books.push(4)); - //~^ ERROR E0373 - //~| NOTE `books` is borrowed here - //~| NOTE may outlive borrowed value `books` -} diff --git a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs b/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs deleted file mode 100644 index 81685c32f2f..00000000000 --- a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs +++ /dev/null @@ -1,27 +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 we give a custom error (E0373) for the case where a -// closure is escaping current frame, and offer a suggested code edit. -// I refrained from including the precise message here, but the -// original text as of the time of this writing is: -// -// closure may outlive the current function, but it borrows `books`, -// which is owned by the current function - -fn foo<'a>(x: &'a i32) -> Box<FnMut()+'a> { - let mut books = vec![1,2,3]; - Box::new(|| books.push(4)) - //~^ ERROR E0373 - //~| NOTE `books` is borrowed here - //~| NOTE may outlive borrowed value `books` -} - -fn main() { } diff --git a/src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs b/src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs deleted file mode 100644 index 5d9c9d0bd46..00000000000 --- a/src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2014 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(box_syntax)] - -enum Foo { - Foo1(Box<u32>, Box<u32>), - Foo2(Box<u32>), - Foo3, -} - -fn blah() { - let f = &Foo::Foo1(box 1, box 2); - match *f { //~ ERROR cannot move out of - //~| cannot move out - Foo::Foo1(num1, //~ NOTE to prevent move - num2) => (), //~ NOTE and here - Foo::Foo2(num) => (), //~ NOTE and here - Foo::Foo3 => () - } -} - -struct S { - f: String, - g: String -} -impl Drop for S { - fn drop(&mut self) { println!("{}", self.f); } -} - -fn move_in_match() { - match (S {f: "foo".to_string(), g: "bar".to_string()}) { - S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait - //~| cannot move out of here - f: _s, //~ NOTE to prevent move - g: _t //~ NOTE and here - } => {} - } -} - -// from issue-8064 -struct A { - a: Box<isize>, -} - -fn free<T>(_: T) {} - -fn blah2() { - let a = &A { a: box 1 }; - match a.a { //~ ERROR cannot move out of - //~| cannot move out - n => { //~ NOTE to prevent move - free(n) - } - } - free(a) -} - -fn main() {} diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-vec-tail.rs b/src/test/compile-fail/borrowck/borrowck-move-out-of-vec-tail.rs deleted file mode 100644 index 311208f07b8..00000000000 --- a/src/test/compile-fail/borrowck/borrowck-move-out-of-vec-tail.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 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 we do not permit moves from &[] matched by a vec pattern. - -#![feature(slice_patterns)] - -#[derive(Clone, Debug)] -struct Foo { - string: String -} - -pub fn main() { - let x = vec![ - Foo { string: "foo".to_string() }, - Foo { string: "bar".to_string() }, - Foo { string: "baz".to_string() } - ]; - let x: &[Foo] = &x; - match *x { - [_, ref tail..] => { - match tail { - &[Foo { string: a }, - //~^ ERROR cannot move out of type `[Foo]` - //~| cannot move out - //~| to prevent move - Foo { string: b }] => { - //~^ NOTE and here - } - _ => { - unreachable!(); - } - } - let z = tail[0].clone(); - println!("{:?}", z); - } - _ => { - unreachable!(); - } - } -} diff --git a/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs b/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs deleted file mode 100644 index 3ca8cc431e0..00000000000 --- a/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 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(dead_code)] -fn main() { - // Original borrow ends at end of function - let mut x = 1; - let y = &mut x; - //~^ mutable borrow occurs here - let z = &x; //~ ERROR cannot borrow - //~^ immutable borrow occurs here -} -//~^ NOTE mutable borrow ends here - -fn foo() { - match true { - true => { - // Original borrow ends at end of match arm - let mut x = 1; - let y = &x; - //~^ immutable borrow occurs here - let z = &mut x; //~ ERROR cannot borrow - //~^ mutable borrow occurs here - } - //~^ NOTE immutable borrow ends here - false => () - } -} - -fn bar() { - // Original borrow ends at end of closure - || { - let mut x = 1; - let y = &mut x; - //~^ first mutable borrow occurs here - let z = &mut x; //~ ERROR cannot borrow - //~^ second mutable borrow occurs here - }; - //~^ NOTE first borrow ends here -} diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs deleted file mode 100644 index 98bb6b14b94..00000000000 --- a/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2014 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(advanced_slice_patterns)] -#![feature(box_patterns)] -#![feature(box_syntax)] -#![feature(slice_patterns)] - -fn a() { - let mut vec = [box 1, box 2, box 3]; - match vec { - [box ref _a, _, _] => { - //~^ borrow of `vec[..]` occurs here - vec[0] = box 4; //~ ERROR cannot assign - //~^ assignment to borrowed `vec[..]` occurs here - } - } -} - -fn b() { - let mut vec = vec![box 1, box 2, box 3]; - let vec: &mut [Box<isize>] = &mut vec; - match vec { - &mut [ref _b..] => { - //~^ borrow of `vec[..]` occurs here - vec[0] = box 4; //~ ERROR cannot assign - //~^ assignment to borrowed `vec[..]` occurs here - } - } -} - -fn c() { - let mut vec = vec![box 1, box 2, box 3]; - let vec: &mut [Box<isize>] = &mut vec; - match vec { - &mut [_a, //~ ERROR cannot move out - //~| cannot move out - //~| to prevent move - .. - ] => { - // Note: `_a` is *moved* here, but `b` is borrowing, - // hence illegal. - // - // See comment in middle/borrowck/gather_loans/mod.rs - // in the case covering these sorts of vectors. - } - _ => {} - } - let a = vec[0]; //~ ERROR cannot move out - //~| cannot move out of here -} - -fn d() { - let mut vec = vec![box 1, box 2, box 3]; - let vec: &mut [Box<isize>] = &mut vec; - match vec { - &mut [ //~ ERROR cannot move out - //~^ cannot move out - _b] => {} //~ NOTE to prevent move - _ => {} - } - let a = vec[0]; //~ ERROR cannot move out - //~| cannot move out of here -} - -fn e() { - let mut vec = vec![box 1, box 2, box 3]; - let vec: &mut [Box<isize>] = &mut vec; - match vec { - &mut [_a, _b, _c] => {} //~ ERROR cannot move out - //~| cannot move out - //~| NOTE to prevent move - //~| NOTE and here - //~| NOTE and here - _ => {} - } - let a = vec[0]; //~ ERROR cannot move out - //~| cannot move out of here -} - -fn main() {} diff --git a/src/test/compile-fail/cast-as-bool.rs b/src/test/compile-fail/cast-as-bool.rs deleted file mode 100644 index af42d5c275c..00000000000 --- a/src/test/compile-fail/cast-as-bool.rs +++ /dev/null @@ -1,15 +0,0 @@ -// 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() { - let u = 5 as bool; - //~^ ERROR cannot cast as `bool` - //~| HELP compare with zero instead -} diff --git a/src/test/compile-fail/cast-rfc0401-2.rs b/src/test/compile-fail/cast-rfc0401-2.rs deleted file mode 100644 index 1598a9aa1fc..00000000000 --- a/src/test/compile-fail/cast-rfc0401-2.rs +++ /dev/null @@ -1,19 +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. - -// RFC 401 test extracted into distinct file. This is because some the -// change to suppress "derived" errors wound up suppressing this error -// message, since the fallback for `3` doesn't occur. - -fn main() { - let _ = 3 as bool; - //~^ ERROR cannot cast as `bool` - //~| HELP compare with zero -} diff --git a/src/test/compile-fail/changing-crates.rs b/src/test/compile-fail/changing-crates.rs deleted file mode 100644 index 89310706b52..00000000000 --- a/src/test/compile-fail/changing-crates.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 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 FIXME #31306 - -// note that these aux-build directives must be in this order -// aux-build:changing-crates-a1.rs -// aux-build:changing-crates-b.rs -// aux-build:changing-crates-a2.rs - -extern crate a; -extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: the following crate versions were found -//~| NOTE: perhaps that crate needs to be recompiled - -fn main() {} diff --git a/src/test/compile-fail/coherence-error-suppression.rs b/src/test/compile-fail/coherence-error-suppression.rs deleted file mode 100644 index 56d2455ca21..00000000000 --- a/src/test/compile-fail/coherence-error-suppression.rs +++ /dev/null @@ -1,25 +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. - -// check that error types in coherence do not cause error cascades. - -trait Foo {} - -impl Foo for i8 {} -impl Foo for i16 {} -impl Foo for i32 {} -impl Foo for i64 {} -impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope -impl Foo for u8 {} -impl Foo for u16 {} -impl Foo for u32 {} -impl Foo for u64 {} - -fn main() {} diff --git a/src/test/compile-fail/coherence-impls-copy.rs b/src/test/compile-fail/coherence-impls-copy.rs deleted file mode 100644 index fe121a3bc48..00000000000 --- a/src/test/compile-fail/coherence-impls-copy.rs +++ /dev/null @@ -1,63 +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. - -#![feature(optin_builtin_traits)] - -use std::marker::Copy; - -enum TestE { - A -} - -struct MyType; - -struct NotSync; -impl !Sync for NotSync {} - -impl Copy for TestE {} -impl Clone for TestE { fn clone(&self) -> Self { *self } } - -impl Copy for MyType {} - -impl Copy for &'static mut MyType {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration -impl Clone for MyType { fn clone(&self) -> Self { *self } } - -impl Copy for (MyType, MyType) {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead - -impl Copy for &'static NotSync {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration - -impl Copy for [MyType] {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead -//~| NOTE impl doesn't use types inside crate - -impl Copy for &'static [NotSync] {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead - -fn main() { -} diff --git a/src/test/compile-fail/coherence-overlap-downstream-inherent.rs b/src/test/compile-fail/coherence-overlap-downstream-inherent.rs deleted file mode 100644 index 66068b53555..00000000000 --- a/src/test/compile-fail/coherence-overlap-downstream-inherent.rs +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even -// though no impls are found. - -struct Sweet<X>(X); -pub trait Sugar {} -pub trait Fruit {} -impl<T:Sugar> Sweet<T> { fn dummy(&self) { } } -//~^ ERROR E0592 -//~| NOTE duplicate definitions for `dummy` -impl<T:Fruit> Sweet<T> { fn dummy(&self) { } } -//~^ NOTE other definition for `dummy` - -trait Bar<X> {} -struct A<T, X>(T, X); -impl<X, T> A<T, X> where T: Bar<X> { fn f(&self) {} } -//~^ ERROR E0592 -//~| NOTE duplicate definitions for `f` -//~| NOTE downstream crates may implement trait `Bar<_>` for type `i32` -impl<X> A<i32, X> { fn f(&self) {} } -//~^ NOTE other definition for `f` - -fn main() {} diff --git a/src/test/compile-fail/coherence-overlap-downstream.rs b/src/test/compile-fail/coherence-overlap-downstream.rs deleted file mode 100644 index 1df02737dec..00000000000 --- a/src/test/compile-fail/coherence-overlap-downstream.rs +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -// Tests that we consider `T: Sugar + Fruit` to be ambiguous, even -// though no impls are found. - -pub trait Sugar {} -pub trait Fruit {} -pub trait Sweet {} -impl<T:Sugar> Sweet for T { } -//~^ NOTE first implementation here -impl<T:Fruit> Sweet for T { } -//~^ ERROR E0119 -//~| NOTE conflicting implementation - -pub trait Foo<X> {} -pub trait Bar<X> {} -impl<X, T> Foo<X> for T where T: Bar<X> {} -//~^ NOTE first implementation here -impl<X> Foo<X> for i32 {} -//~^ ERROR E0119 -//~| NOTE conflicting implementation for `i32` -//~| NOTE downstream crates may implement trait `Bar<_>` for type `i32` - -fn main() { } diff --git a/src/test/compile-fail/coherence-overlap-issue-23516-inherent.rs b/src/test/compile-fail/coherence-overlap-issue-23516-inherent.rs deleted file mode 100644 index 355af60710a..00000000000 --- a/src/test/compile-fail/coherence-overlap-issue-23516-inherent.rs +++ /dev/null @@ -1,26 +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. - -// Tests that we consider `Box<U>: !Sugar` to be ambiguous, even -// though we see no impl of `Sugar` for `Box`. Therefore, an overlap -// error is reported for the following pair of impls (#23516). - -pub trait Sugar {} - -struct Cake<X>(X); - -impl<T:Sugar> Cake<T> { fn dummy(&self) { } } -//~^ ERROR E0592 -//~| NOTE duplicate definitions for `dummy` -//~| NOTE downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` -impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } } -//~^ NOTE other definition for `dummy` - -fn main() { } diff --git a/src/test/compile-fail/coherence-overlap-issue-23516.rs b/src/test/compile-fail/coherence-overlap-issue-23516.rs deleted file mode 100644 index ffef5bf1087..00000000000 --- a/src/test/compile-fail/coherence-overlap-issue-23516.rs +++ /dev/null @@ -1,24 +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. - -// Tests that we consider `Box<U>: !Sugar` to be ambiguous, even -// though we see no impl of `Sugar` for `Box`. Therefore, an overlap -// error is reported for the following pair of impls (#23516). - -pub trait Sugar { fn dummy(&self) { } } -pub trait Sweet { fn dummy(&self) { } } -impl<T:Sugar> Sweet for T { } -//~^ NOTE first implementation here -impl<U:Sugar> Sweet for Box<U> { } -//~^ ERROR E0119 -//~| NOTE conflicting implementation for `std::boxed::Box<_>` -//~| NOTE downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` - -fn main() { } diff --git a/src/test/compile-fail/coherence-overlap-upstream-inherent.rs b/src/test/compile-fail/coherence-overlap-upstream-inherent.rs deleted file mode 100644 index 1d0c63110ce..00000000000 --- a/src/test/compile-fail/coherence-overlap-upstream-inherent.rs +++ /dev/null @@ -1,28 +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. - -// Tests that we consider `i16: Remote` to be ambiguous, even -// though the upstream crate doesn't implement it for now. - -// aux-build:coherence_lib.rs - -extern crate coherence_lib; - -use coherence_lib::Remote; - -struct A<X>(X); -impl<T> A<T> where T: Remote { fn dummy(&self) { } } -//~^ ERROR E0592 -//~| NOTE duplicate definitions for `dummy` -//~| NOTE upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` -impl A<i16> { fn dummy(&self) { } } -//~^ NOTE other definition for `dummy` - -fn main() {} diff --git a/src/test/compile-fail/coherence-overlap-upstream.rs b/src/test/compile-fail/coherence-overlap-upstream.rs deleted file mode 100644 index e978143a067..00000000000 --- a/src/test/compile-fail/coherence-overlap-upstream.rs +++ /dev/null @@ -1,28 +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. - -// Tests that we consider `i16: Remote` to be ambiguous, even -// though the upstream crate doesn't implement it for now. - -// aux-build:coherence_lib.rs - -extern crate coherence_lib; - -use coherence_lib::Remote; - -trait Foo {} -impl<T> Foo for T where T: Remote {} -//~^ NOTE first implementation here -impl Foo for i16 {} -//~^ ERROR E0119 -//~| NOTE conflicting implementation for `i16` -//~| NOTE upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` - -fn main() {} diff --git a/src/test/compile-fail/const-deref-ptr.rs b/src/test/compile-fail/const-deref-ptr.rs deleted file mode 100644 index c626801d48c..00000000000 --- a/src/test/compile-fail/const-deref-ptr.rs +++ /dev/null @@ -1,17 +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. - -// Check that you can't dereference raw pointers in constants. - -fn main() { - static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; //~ ERROR E0396 - //~| NOTE dereference of raw pointer in constant - println!("{}", C); -} diff --git a/src/test/compile-fail/const-eval-overflow-2.rs b/src/test/compile-fail/const-eval-overflow-2.rs deleted file mode 100644 index 0fd41a17b2c..00000000000 --- a/src/test/compile-fail/const-eval-overflow-2.rs +++ /dev/null @@ -1,30 +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. - -// Evaluation of constants in refutable patterns goes through -// different compiler control-flow paths. - -#![allow(unused_imports, warnings)] - -use std::fmt; -use std::{i8, i16, i32, i64, isize}; -use std::{u8, u16, u32, u64, usize}; - -const NEG_128: i8 = -128; -const NEG_NEG_128: i8 = -NEG_128; -//~^ ERROR constant evaluation error -//~| attempt to negate with overflow - -fn main() { - match -128i8 { - NEG_NEG_128 => println!("A"), //~ NOTE for pattern here - _ => println!("B"), - } -} diff --git a/src/test/compile-fail/const-eval-overflow-4.rs b/src/test/compile-fail/const-eval-overflow-4.rs deleted file mode 100644 index 2b1c1017b5b..00000000000 --- a/src/test/compile-fail/const-eval-overflow-4.rs +++ /dev/null @@ -1,37 +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. - -// Evaluation of constants in array-elem count goes through different -// compiler control-flow paths. -// -// This test is checking the count in an array type. - -#![allow(unused_imports)] - -use std::fmt; -use std::{i8, i16, i32, i64, isize}; -use std::{u8, u16, u32, u64, usize}; - -const A_I8_T - : [u32; (i8::MAX as i8 + 1i8) as usize] - //~^ ERROR constant evaluation error - //~^^ NOTE attempt to add with overflow - //~| WARNING constant evaluation error - //~| NOTE on by default - = [0; (i8::MAX as usize) + 1]; - -fn main() { - foo(&A_I8_T[..]); -} - -fn foo<T:fmt::Debug>(x: T) { - println!("{:?}", x); -} - diff --git a/src/test/compile-fail/const-eval-span.rs b/src/test/compile-fail/const-eval-span.rs deleted file mode 100644 index 16f89606b01..00000000000 --- a/src/test/compile-fail/const-eval-span.rs +++ /dev/null @@ -1,26 +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. - -// Check that error in constant evaluation of enum discriminant -// provides the context for what caused the evaluation. - -struct S(i32); - -const CONSTANT: S = S(0); - -enum E { - V = CONSTANT, - //~^ ERROR mismatched types - //~| expected isize, found struct `S` - //~| NOTE expected type `isize` - //~| found type `S` -} - -fn main() {} diff --git a/src/test/compile-fail/const-fn-error.rs b/src/test/compile-fail/const-fn-error.rs deleted file mode 100644 index baf836b4dad..00000000000 --- a/src/test/compile-fail/const-fn-error.rs +++ /dev/null @@ -1,30 +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. - -#![feature(const_fn)] - -const X : usize = 2; - -const fn f(x: usize) -> usize { - let mut sum = 0; //~ ERROR blocks in constant functions are limited - for i in 0..x { //~ ERROR calls in constant functions - //~| ERROR constant function contains unimplemented - sum += i; - } - sum //~ ERROR E0080 - //~| non-constant path in constant -} - -#[allow(unused_variables)] -fn main() { - let a : [i32; f(X)]; //~ NOTE for constant expression here - //~| WARNING constant evaluation error: non-constant path - //~| on by default -} diff --git a/src/test/compile-fail/const-fn-mismatch.rs b/src/test/compile-fail/const-fn-mismatch.rs deleted file mode 100644 index 7ea72e23779..00000000000 --- a/src/test/compile-fail/const-fn-mismatch.rs +++ /dev/null @@ -1,28 +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 we can't declare a const fn in an impl -- right now it's -// just not allowed at all, though eventually it'd make sense to allow -// it if the trait fn is const (but right now no trait fns can be -// const). - -#![feature(const_fn)] - -trait Foo { - fn f() -> u32; -} - -impl Foo for u32 { - const fn f() -> u32 { 22 } - //~^ ERROR trait fns cannot be declared const - //~| NOTE trait fns cannot be const -} - -fn main() { } diff --git a/src/test/compile-fail/const-fn-not-in-trait.rs b/src/test/compile-fail/const-fn-not-in-trait.rs deleted file mode 100644 index 257d4d5ee99..00000000000 --- a/src/test/compile-fail/const-fn-not-in-trait.rs +++ /dev/null @@ -1,25 +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 const fn is illegal in a trait declaration, whether or -// not a default is provided. - -#![feature(const_fn)] - -trait Foo { - const fn f() -> u32; - //~^ ERROR trait fns cannot be declared const - //~| NOTE trait fns cannot be const - const fn g() -> u32 { 0 } - //~^ ERROR trait fns cannot be declared const - //~| NOTE trait fns cannot be const -} - -fn main() { } diff --git a/src/test/compile-fail/const-len-underflow-separate-spans.rs b/src/test/compile-fail/const-len-underflow-separate-spans.rs deleted file mode 100644 index eaad9e7e92b..00000000000 --- a/src/test/compile-fail/const-len-underflow-separate-spans.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-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. - -// Check that a constant-evaluation underflow highlights the correct -// spot (where the underflow occurred), while also providing the -// overall context for what caused the evaluation. - -const ONE: usize = 1; -const TWO: usize = 2; -const LEN: usize = ONE - TWO; -//~^ ERROR E0080 -//~| attempt to subtract with overflow -//~| NOTE attempt to subtract with overflow -//~| NOTE on by default - -fn main() { - let a: [i8; LEN] = unimplemented!(); - //~^ NOTE for constant expression here -} diff --git a/src/test/compile-fail/const-pattern-not-const-evaluable.rs b/src/test/compile-fail/const-pattern-not-const-evaluable.rs deleted file mode 100644 index 71cac3edbc1..00000000000 --- a/src/test/compile-fail/const-pattern-not-const-evaluable.rs +++ /dev/null @@ -1,42 +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. - -#![feature(const_fn)] - -#[derive(PartialEq, Eq)] -enum Cake { - BlackForest, - Marmor, -} -use Cake::*; - -struct Pair<A, B>(A, B); - -const BOO: Pair<Cake, Cake> = Pair(Marmor, BlackForest); -//~^ ERROR: constant evaluation error [E0080] -//~| unimplemented constant expression: tuple struct constructors -const FOO: Cake = BOO.1; - -const fn foo() -> Cake { - Marmor -} - -const WORKS: Cake = Marmor; - -const GOO: Cake = foo(); - -fn main() { - match BlackForest { - FOO => println!("hi"), //~ NOTE: for pattern here - GOO => println!("meh"), - WORKS => println!("möp"), - _ => println!("bye"), - } -} diff --git a/src/test/compile-fail/const-unsized.rs b/src/test/compile-fail/const-unsized.rs deleted file mode 100644 index 4b212814ded..00000000000 --- a/src/test/compile-fail/const-unsized.rs +++ /dev/null @@ -1,35 +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. - -use std::fmt::Debug; - -const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); -//~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size - -const CONST_FOO: str = *"foo"; -//~^ ERROR `str: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size - -static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); -//~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size - -static STATIC_BAR: str = *"bar"; -//~^ ERROR `str: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size - -fn main() { - println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR); -} diff --git a/src/test/compile-fail/cycle-trait-supertrait-indirect.rs b/src/test/compile-fail/cycle-trait-supertrait-indirect.rs deleted file mode 100644 index 905d546e99a..00000000000 --- a/src/test/compile-fail/cycle-trait-supertrait-indirect.rs +++ /dev/null @@ -1,27 +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 a supertrait cycle where the first trait we find (`A`) is not -// a direct participant in the cycle. - -trait A: B { - //~^ NOTE the cycle begins when computing the supertraits of `B`... -} - -trait B: C { - //~^ NOTE ...which then requires computing the supertraits of `C`... -} - -trait C: B { } - //~^ ERROR unsupported cyclic reference - //~| cyclic reference - //~| NOTE ...which then again requires computing the supertraits of `B`, completing the cycle - -fn main() { } diff --git a/src/test/compile-fail/derived-errors/issue-31997-1.rs b/src/test/compile-fail/derived-errors/issue-31997-1.rs deleted file mode 100644 index 6a9d8db9654..00000000000 --- a/src/test/compile-fail/derived-errors/issue-31997-1.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2012 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. - -// Regression test for this example from #31997 -- main goal is to -// emit as minimal and precise an error set as possible. Ideally, we'd -// only emit the E0433 error below, but right now we emit two. - -use std::io::prelude::*; -// use std::collections::HashMap; -use std::io; - -#[derive(Debug)] -struct Instance { - name: String, - start: Option<String>, - end: Option<String>, -} - -fn main() { - let input = io::stdin(); - let mut input = input.lock(); - - let mut map = HashMap::new(); - //~^ ERROR E0433 - //~| NOTE Use of undeclared type or module `HashMap` - - for line in input.lines() { - let line = line.unwrap(); - println!("process: {}", line); - let mut parts = line.splitn(2, ":"); - let _logfile = parts.next().unwrap(); - let rest = parts.next().unwrap(); - let mut parts = line.split(" [-] "); - - let stamp = parts.next().unwrap(); - - let rest = parts.next().unwrap(); - let words = rest.split_whitespace().collect::<Vec<_>>(); - - let instance = words.iter().find(|a| a.starts_with("i-")).unwrap(); - let name = words[1].to_owned(); - let mut entry = map.entry(instance.to_owned()).or_insert(Instance { - name: name, - start: None, - end: None, - }); - - if rest.contains("terminating") { - assert!(entry.end.is_none()); - entry.end = Some(stamp.to_string()); - } - if rest.contains("waiting for") { - assert!(entry.start.is_none()); - entry.start = Some(stamp.to_string()); - } - - } - - println!("{:?}", map); -} diff --git a/src/test/compile-fail/discrim-overflow-2.rs b/src/test/compile-fail/discrim-overflow-2.rs deleted file mode 100644 index 213683b5808..00000000000 --- a/src/test/compile-fail/discrim-overflow-2.rs +++ /dev/null @@ -1,110 +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. - -// ignore-tidy-linelength - -// Issue 23030: Detect overflowing discriminant -// -// Check that we detect the overflow even if enum is not used. - -// See also run-pass/discrim-explicit-23030.rs where the suggested -// workaround is tested. - -use std::{i8,u8,i16,u16,i32,u32,i64, u64}; - -fn f_i8() { - #[repr(i8)] - enum A { - Ok = i8::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 127i8 - //~| NOTE explicitly set `OhNo = -128i8` if that is desired outcome - } -} - -fn f_u8() { - #[repr(u8)] - enum A { - Ok = u8::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 255u8 - //~| NOTE explicitly set `OhNo = 0u8` if that is desired outcome - } -} - -fn f_i16() { - #[repr(i16)] - enum A { - Ok = i16::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 32767i16 - //~| NOTE explicitly set `OhNo = -32768i16` if that is desired outcome - } -} - -fn f_u16() { - #[repr(u16)] - enum A { - Ok = u16::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 65535u16 - //~| NOTE explicitly set `OhNo = 0u16` if that is desired outcome - } -} - -fn f_i32() { - #[repr(i32)] - enum A { - Ok = i32::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 2147483647i32 - //~| NOTE explicitly set `OhNo = -2147483648i32` if that is desired outcome - } -} - -fn f_u32() { - #[repr(u32)] - enum A { - Ok = u32::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 4294967295u32 - //~| NOTE explicitly set `OhNo = 0u32` if that is desired outcome - } -} - -fn f_i64() { - #[repr(i64)] - enum A { - Ok = i64::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 9223372036854775807i64 - //~| NOTE explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome - } -} - -fn f_u64() { - #[repr(u64)] - enum A { - Ok = u64::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 18446744073709551615u64 - //~| NOTE explicitly set `OhNo = 0u64` if that is desired outcome - } -} - -fn main() { } diff --git a/src/test/compile-fail/discrim-overflow.rs b/src/test/compile-fail/discrim-overflow.rs deleted file mode 100644 index a3039b8d957..00000000000 --- a/src/test/compile-fail/discrim-overflow.rs +++ /dev/null @@ -1,124 +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. - -// ignore-tidy-linelength - -// Issue 23030: Detect overflowing discriminant - -// See also run-pass/discrim-explicit-23030.rs where the suggested -// workaround is tested. - -use std::{i8,u8,i16,u16,i32,u32,i64, u64}; - -fn f_i8() { - #[repr(i8)] - enum A { - Ok = i8::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 127i8 - //~| NOTE explicitly set `OhNo = -128i8` if that is desired outcome - } - - let x = A::Ok; -} - -fn f_u8() { - #[repr(u8)] - enum A { - Ok = u8::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 255u8 - //~| NOTE explicitly set `OhNo = 0u8` if that is desired outcome - } - - let x = A::Ok; -} - -fn f_i16() { - #[repr(i16)] - enum A { - Ok = i16::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 32767i16 - //~| NOTE explicitly set `OhNo = -32768i16` if that is desired outcome - } - - let x = A::Ok; -} - -fn f_u16() { - #[repr(u16)] - enum A { - Ok = u16::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 65535u16 - //~| NOTE explicitly set `OhNo = 0u16` if that is desired outcome - } - - let x = A::Ok; -} - -fn f_i32() { - #[repr(i32)] - enum A { - Ok = i32::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 2147483647i32 - //~| NOTE explicitly set `OhNo = -2147483648i32` if that is desired outcome - } - - let x = A::Ok; -} - -fn f_u32() { - #[repr(u32)] - enum A { - Ok = u32::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 4294967295u32 - //~| NOTE explicitly set `OhNo = 0u32` if that is desired outcome - } - - let x = A::Ok; -} - -fn f_i64() { - #[repr(i64)] - enum A { - Ok = i64::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 9223372036854775807i64 - //~| NOTE explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome - } - - let x = A::Ok; -} - -fn f_u64() { - #[repr(u64)] - enum A { - Ok = u64::MAX - 1, - Ok2, - OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| overflowed on value after 18446744073709551615u64 - //~| NOTE explicitly set `OhNo = 0u64` if that is desired outcome - } - - let x = A::Ok; -} - -fn main() { } diff --git a/src/test/compile-fail/double-import.rs b/src/test/compile-fail/double-import.rs deleted file mode 100644 index 21b8ded6d93..00000000000 --- a/src/test/compile-fail/double-import.rs +++ /dev/null @@ -1,27 +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. - -// This tests that conflicting imports shows both `use` lines -// when reporting the error. - -mod sub1 { - pub fn foo() {} // implementation 1 -} - -mod sub2 { - pub fn foo() {} // implementation 2 -} - -use sub1::foo; //~ NOTE previous import of the value `foo` here -use sub2::foo; //~ ERROR the name `foo` is defined multiple times - //~| NOTE `foo` reimported here - //~| NOTE `foo` must be defined only once in the value namespace of this module - -fn main() {} diff --git a/src/test/compile-fail/duplicate-check-macro-exports.rs b/src/test/compile-fail/duplicate-check-macro-exports.rs deleted file mode 100644 index 53d7e54ee5b..00000000000 --- a/src/test/compile-fail/duplicate-check-macro-exports.rs +++ /dev/null @@ -1,19 +0,0 @@ -// 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() {} diff --git a/src/test/compile-fail/empty-struct-unit-expr.rs b/src/test/compile-fail/empty-struct-unit-expr.rs deleted file mode 100644 index 9655007604d..00000000000 --- a/src/test/compile-fail/empty-struct-unit-expr.rs +++ /dev/null @@ -1,33 +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. - -// Can't use unit struct as constructor function - -// aux-build:empty-struct.rs - -extern crate empty_struct; -use empty_struct::*; - -struct Empty2; - -enum E { - Empty4 -} - -fn main() { - let e2 = Empty2(); //~ ERROR expected function, found `Empty2` - let e4 = E::Empty4(); - //~^ ERROR expected function, found `E::Empty4` [E0618] - //~| HELP did you mean to write `E::Empty4`? - let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct::XEmpty2` - let xe4 = XE::XEmpty4(); - //~^ ERROR expected function, found `XE::XEmpty4` [E0618] - //~| HELP did you mean to write `XE::XEmpty4`? -} diff --git a/src/test/compile-fail/enum-and-module-in-same-scope.rs b/src/test/compile-fail/enum-and-module-in-same-scope.rs deleted file mode 100644 index 59b4d715c2d..00000000000 --- a/src/test/compile-fail/enum-and-module-in-same-scope.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 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 Foo { //~ NOTE previous definition of the type `Foo` here - X -} - -mod Foo { //~ ERROR the name `Foo` is defined multiple times - //~| NOTE `Foo` redefined here - //~| NOTE `Foo` must be defined only once in the type namespace of this module - pub static X: isize = 42; - fn f() { f() } // Check that this does not result in a resolution error -} - -fn main() {} diff --git a/src/test/compile-fail/fat-ptr-cast.rs b/src/test/compile-fail/fat-ptr-cast.rs deleted file mode 100644 index bc2dc1cc5d4..00000000000 --- a/src/test/compile-fail/fat-ptr-cast.rs +++ /dev/null @@ -1,36 +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. - -trait Trait {} - -// Make sure casts between thin-pointer <-> fat pointer obey RFC401 -fn main() { - let a: &[i32] = &[1, 2, 3]; - let b: Box<[i32]> = Box::new([1, 2, 3]); - let p = a as *const [i32]; - let q = a.as_ptr(); - - a as usize; //~ ERROR casting - //~^ HELP cast through a raw pointer first - a as isize; //~ ERROR casting - a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid - a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid - b as usize; //~ ERROR non-primitive cast - p as usize; - //~^ ERROR casting - //~^^ HELP cast through a thin pointer - - // #22955 - q as *const [i32]; //~ ERROR cannot cast - - // #21397 - let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting - let mut fail: *const str = 0 as *const str; //~ ERROR casting -} diff --git a/src/test/compile-fail/generic-type-less-params-with-defaults.rs b/src/test/compile-fail/generic-type-less-params-with-defaults.rs deleted file mode 100644 index 9b19e09eeae..00000000000 --- a/src/test/compile-fail/generic-type-less-params-with-defaults.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 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. - -use std::marker; - -struct Heap; - -struct Vec<T, A = Heap>( - marker::PhantomData<(T,A)>); - -fn main() { - let _: Vec; - //~^ ERROR wrong number of type arguments: expected at least 1, found 0 [E0243] - //~| NOTE expected at least 1 type argument -} diff --git a/src/test/compile-fail/generic-type-more-params-with-defaults.rs b/src/test/compile-fail/generic-type-more-params-with-defaults.rs deleted file mode 100644 index b5764ef89ab..00000000000 --- a/src/test/compile-fail/generic-type-more-params-with-defaults.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 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. - -use std::marker; - -struct Heap; - -struct Vec<T, A = Heap>( - marker::PhantomData<(T,A)>); - -fn main() { - let _: Vec<isize, Heap, bool>; - //~^ ERROR wrong number of type arguments: expected at most 2, found 3 [E0244] - //~| NOTE expected at most 2 type arguments -} diff --git a/src/test/compile-fail/if-let-arm-types.rs b/src/test/compile-fail/if-let-arm-types.rs deleted file mode 100644 index 40013a7ee43..00000000000 --- a/src/test/compile-fail/if-let-arm-types.rs +++ /dev/null @@ -1,20 +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. - -fn main() { - if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types - //~^ expected (), found integral variable - //~| expected type `()` - //~| found type `{integer}` - () - } else { //~ NOTE: `if let` arm with an incompatible type - 1 - }; -} diff --git a/src/test/compile-fail/impl-duplicate-methods.rs b/src/test/compile-fail/impl-duplicate-methods.rs deleted file mode 100644 index f6e9ab2d614..00000000000 --- a/src/test/compile-fail/impl-duplicate-methods.rs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -struct Foo; - -impl Foo { - fn orange(&self) {} //~ NOTE previous definition of `orange` here - fn orange(&self) {} - //~^ ERROR duplicate definition - //~| NOTE duplicate definition -} - -fn main() {} diff --git a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs b/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs deleted file mode 100644 index d48433ee928..00000000000 --- a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs +++ /dev/null @@ -1,29 +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 lifetime parameters must be constrained if they appear in -// an associated type def'n. Issue #22077. - -trait Fun { - type Output; - fn call<'x>(&'x self) -> Self::Output; -} - -struct Holder { x: String } - -impl<'a> Fun for Holder { //~ ERROR E0207 - //~| NOTE unconstrained lifetime parameter - type Output = &'a str; - fn call<'b>(&'b self) -> &'b str { - &self.x[..] - } -} - -fn main() { } diff --git a/src/test/compile-fail/imports/auxiliary/two_macros.rs b/src/test/compile-fail/imports/auxiliary/two_macros.rs deleted file mode 100644 index 2ac8e3ef983..00000000000 --- a/src/test/compile-fail/imports/auxiliary/two_macros.rs +++ /dev/null @@ -1,15 +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. - -#[macro_export] -macro_rules! m { ($($t:tt)*) => { $($t)* } } - -#[macro_export] -macro_rules! n { ($($t:tt)*) => { $($t)* } } diff --git a/src/test/compile-fail/imports/duplicate.rs b/src/test/compile-fail/imports/duplicate.rs deleted file mode 100644 index 4b2a64155e5..00000000000 --- a/src/test/compile-fail/imports/duplicate.rs +++ /dev/null @@ -1,69 +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. - -mod a { - pub fn foo() {} -} - -mod b { - pub fn foo() {} -} - -mod c { - pub use a::foo; -} - -mod d { - use a::foo; //~ NOTE previous import of the value `foo` here - use a::foo; //~ ERROR the name `foo` is defined multiple times - //~| NOTE `foo` reimported here - //~| NOTE `foo` must be defined only once in the value namespace of this module -} - -mod e { - pub use a::*; - pub use c::*; // ok -} - -mod f { - pub use a::*; //~ NOTE `foo` could refer to the name imported here - pub use b::*; //~ NOTE `foo` could also refer to the name imported here -} - -mod g { - pub use a::*; //~ NOTE `foo` could refer to the name imported here - pub use f::*; //~ NOTE `foo` could also refer to the name imported here -} - -fn main() { - e::foo(); - f::foo(); //~ ERROR `foo` is ambiguous - //~| NOTE consider adding an explicit import of `foo` to disambiguate - g::foo(); //~ ERROR `foo` is ambiguous - //~| NOTE consider adding an explicit import of `foo` to disambiguate -} - -mod ambiguous_module_errors { - pub mod m1 { pub use super::m1 as foo; } - pub mod m2 { pub use super::m2 as foo; } - - use self::m1::*; //~ NOTE - //~| NOTE - use self::m2::*; //~ NOTE - //~| NOTE - - use self::foo::bar; //~ ERROR `foo` is ambiguous - //~| NOTE - - fn f() { - foo::bar(); //~ ERROR `foo` is ambiguous - //~| NOTE - } -} diff --git a/src/test/compile-fail/imports/macro-paths.rs b/src/test/compile-fail/imports/macro-paths.rs deleted file mode 100644 index 7c19917acc4..00000000000 --- a/src/test/compile-fail/imports/macro-paths.rs +++ /dev/null @@ -1,40 +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. - -// aux-build:two_macros.rs - -#![feature(use_extern_macros)] - -extern crate two_macros; - -mod foo { - pub mod bar { - pub use two_macros::m; - } -} - -fn f() { - use foo::*; //~ NOTE could also refer to the name imported here - 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 - } -} - -pub mod baz { //~ NOTE could also refer to the name defined here - pub use two_macros::m; -} - -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 - } -} diff --git a/src/test/compile-fail/imports/macros.rs b/src/test/compile-fail/imports/macros.rs deleted file mode 100644 index 06b0964a3b1..00000000000 --- a/src/test/compile-fail/imports/macros.rs +++ /dev/null @@ -1,53 +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. - -// aux-build:two_macros.rs - -#![feature(item_like_imports, use_extern_macros)] - -extern crate two_macros; // two identity macros `m` and `n` - -mod foo { - pub use two_macros::n as m; -} - -mod m1 { - m!(use two_macros::*;); - use foo::m; // This shadows the glob import -} - -mod m2 { - use two_macros::*; //~ NOTE could also refer - m! { //~ ERROR ambiguous - //~| NOTE macro-expanded macro imports do not shadow - use foo::m; //~ NOTE could refer to the name imported here - } -} - -mod m3 { - use two_macros::m; //~ NOTE could also refer - fn f() { - use two_macros::n as m; // This shadows the above import - m!(); - } - - fn g() { - 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 - } - } -} - -mod m4 { - macro_rules! m { () => {} } //~ NOTE could refer to the macro defined here - use two_macros::m; //~ NOTE could also refer to the macro imported here - m!(); //~ ERROR ambiguous -} diff --git a/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs b/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs deleted file mode 100644 index 95bdf5e9b15..00000000000 --- a/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs +++ /dev/null @@ -1,29 +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. - -#![allow(unused)] - -pub struct Foo; - -mod bar { - struct Foo; - - mod baz { - use *; //~ NOTE `Foo` could refer to the name imported here - use bar::*; //~ NOTE `Foo` could also refer to the name imported here - fn f(_: Foo) {} - //~^ ERROR `Foo` is ambiguous - //~| WARN hard error in a future release - //~| NOTE see issue #38260 - //~| NOTE #[deny(legacy_imports)] on by default - } -} - -fn main() {} diff --git a/src/test/compile-fail/imports/shadow_builtin_macros.rs b/src/test/compile-fail/imports/shadow_builtin_macros.rs deleted file mode 100644 index a7f1cf3c9d3..00000000000 --- a/src/test/compile-fail/imports/shadow_builtin_macros.rs +++ /dev/null @@ -1,71 +0,0 @@ -// 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() {} diff --git a/src/test/compile-fail/impossible_range.rs b/src/test/compile-fail/impossible_range.rs deleted file mode 100644 index e4465e9f6b6..00000000000 --- a/src/test/compile-fail/impossible_range.rs +++ /dev/null @@ -1,29 +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. - -// Make sure that invalid ranges generate an error during HIR lowering, not an ICE - -#![feature(inclusive_range_syntax)] - -pub fn main() { - ..; - 0..; - ..1; - 0..1; - - ..=; //~ERROR inclusive range with no end - //~^HELP bounded at the end - 0..=; //~ERROR inclusive range with no end - //~^HELP bounded at the end - ..=1; - 0..=1; -} - - diff --git a/src/test/compile-fail/index-help.rs b/src/test/compile-fail/index-help.rs deleted file mode 100644 index 2d37fc79250..00000000000 --- a/src/test/compile-fail/index-help.rs +++ /dev/null @@ -1,15 +0,0 @@ -// 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() { - let x = vec![1]; - x[0i32]; //~ ERROR E0277 - //~| NOTE vector indices are of type `usize` or ranges of `usize` -} diff --git a/src/test/compile-fail/invalid-path-in-const.rs b/src/test/compile-fail/invalid-path-in-const.rs deleted file mode 100644 index ab839e7630d..00000000000 --- a/src/test/compile-fail/invalid-path-in-const.rs +++ /dev/null @@ -1,14 +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. - -fn main() { - fn f(a: [u8; u32::DOESNOTEXIST]) {} - //~^ ERROR no associated item named `DOESNOTEXIST` found for type `u32` -} diff --git a/src/test/compile-fail/issue-10969.rs b/src/test/compile-fail/issue-10969.rs deleted file mode 100644 index 0851020b1f1..00000000000 --- a/src/test/compile-fail/issue-10969.rs +++ /dev/null @@ -1,17 +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. - -fn func(i: i32) { //~NOTE defined here - i(); //~ERROR expected function, found `i32` -} -fn main() { - let i = 0i32; //~NOTE defined here - i(); //~ERROR expected function, found `i32` -} diff --git a/src/test/compile-fail/issue-11004.rs b/src/test/compile-fail/issue-11004.rs deleted file mode 100644 index 06988342422..00000000000 --- a/src/test/compile-fail/issue-11004.rs +++ /dev/null @@ -1,39 +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. - -use std::mem; - -struct A { x: i32, y: f64 } - -#[cfg(not(works))] -unsafe fn access(n:*mut A) -> (i32, f64) { - let x : i32 = n.x; //~ no field `x` on type `*mut A` - //~| NOTE `n` is a native pointer; perhaps you need to deref with `(*n).x` - let y : f64 = n.y; //~ no field `y` on type `*mut A` - //~| NOTE `n` is a native pointer; perhaps you need to deref with `(*n).y` - (x, y) -} - -#[cfg(works)] -unsafe fn access(n:*mut A) -> (i32, f64) { - let x : i32 = (*n).x; - let y : f64 = (*n).y; - (x, y) -} - -fn main() { - let a : A = A { x: 3, y: 3.14 }; - let p : &A = &a; - let (x,y) = unsafe { - let n : *mut A = mem::transmute(p); - access(n) - }; - println!("x: {}, y: {}", x, y); -} diff --git a/src/test/compile-fail/issue-11319.rs b/src/test/compile-fail/issue-11319.rs deleted file mode 100644 index 8242fa1c2e9..00000000000 --- a/src/test/compile-fail/issue-11319.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 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() { - match Some(10) { - //~^ ERROR match arms have incompatible types - //~| expected type `bool` - //~| found type `()` - //~| expected bool, found () - Some(5) => false, - Some(2) => true, - None => (), //~ NOTE match arm with an incompatible type - _ => true - } -} diff --git a/src/test/compile-fail/issue-12187-1.rs b/src/test/compile-fail/issue-12187-1.rs deleted file mode 100644 index a79021d3cd5..00000000000 --- a/src/test/compile-fail/issue-12187-1.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014-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. - -fn new<T>() -> &'static T { - panic!() -} - -fn main() { - let &v = new(); - //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `_` - //~| NOTE consider giving the pattern a type -} diff --git a/src/test/compile-fail/issue-12187-2.rs b/src/test/compile-fail/issue-12187-2.rs deleted file mode 100644 index 38b3c5d4e9a..00000000000 --- a/src/test/compile-fail/issue-12187-2.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014-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. - -fn new<'r, T>() -> &'r T { - panic!() -} - -fn main() { - let &v = new(); - //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `_` - //~| NOTE consider giving the pattern a type -} diff --git a/src/test/compile-fail/issue-12511.rs b/src/test/compile-fail/issue-12511.rs deleted file mode 100644 index 0c3073a7701..00000000000 --- a/src/test/compile-fail/issue-12511.rs +++ /dev/null @@ -1,22 +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. - -trait t1 : t2 { -//~^ NOTE the cycle begins when computing the supertraits of `t1`... -//~| NOTE ...which then requires computing the supertraits of `t2`... -} - -trait t2 : t1 { -//~^ ERROR unsupported cyclic reference between types/traits detected -//~| cyclic reference -//~| NOTE ...which then again requires computing the supertraits of `t1`, completing the cycle -} - -fn main() { } diff --git a/src/test/compile-fail/issue-13058.rs b/src/test/compile-fail/issue-13058.rs deleted file mode 100644 index 27b23f08321..00000000000 --- a/src/test/compile-fail/issue-13058.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 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. - -use std::ops::Range; - -trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; } - -impl<'r> Itble<'r, usize, Range<usize>> for (usize, usize) { - fn iter(&'r self) -> Range<usize> { - let &(min, max) = self; - min..max - } -} - -fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool -{ - let cont_iter = cont.iter(); -//~^ ERROR 24:26: 24:30: explicit lifetime required in the type of `cont` [E0621] - let result = cont_iter.fold(Some(0), |state, val| { - state.map_or(None, |mask| { - let bit = 1 << val; - if mask & bit == 0 {Some(mask|bit)} else {None} - }) - }); - result.is_some() -} - -fn main() { - check((3, 5)); -//~^ ERROR mismatched types -//~| HELP consider borrowing here -} diff --git a/src/test/compile-fail/issue-14092.rs b/src/test/compile-fail/issue-14092.rs deleted file mode 100644 index 85dd88e614f..00000000000 --- a/src/test/compile-fail/issue-14092.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 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 fn1(0: Box) {} - //~^ ERROR wrong number of type arguments: expected 1, found 0 [E0243] - //~| NOTE expected 1 type argument - -fn main() {} diff --git a/src/test/compile-fail/issue-15260.rs b/src/test/compile-fail/issue-15260.rs deleted file mode 100644 index 5f816d34c84..00000000000 --- a/src/test/compile-fail/issue-15260.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014 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. - -struct Foo { - a: usize, -} - -fn main() { - let Foo { - a: _, //~ NOTE first use of `a` - a: _ - //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern - } = Foo { a: 29 }; - - let Foo { - a, //~ NOTE first use of `a` - a: _ - //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern - } = Foo { a: 29 }; - - let Foo { - a, - //~^ NOTE first use of `a` - //~| NOTE first use of `a` - a: _, - //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern - a: x - //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern - } = Foo { a: 29 }; -} diff --git a/src/test/compile-fail/issue-15524.rs b/src/test/compile-fail/issue-15524.rs deleted file mode 100644 index 658a0c1546b..00000000000 --- a/src/test/compile-fail/issue-15524.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 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 N: isize = 1; - -enum Foo { - A = 1, - //~^ NOTE first use of `1isize` - //~| NOTE first use of `1isize` - //~| NOTE first use of `1isize` - B = 1, - //~^ ERROR discriminant value `1isize` already exists - //~| NOTE enum already has `1isize` - C = 0, - D, - //~^ ERROR discriminant value `1isize` already exists - //~| NOTE enum already has `1isize` - - E = N, - //~^ ERROR discriminant value `1isize` already exists - //~| NOTE enum already has `1isize` - -} - -fn main() {} diff --git a/src/test/compile-fail/issue-17263.rs b/src/test/compile-fail/issue-17263.rs deleted file mode 100644 index 063afe285fa..00000000000 --- a/src/test/compile-fail/issue-17263.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 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(box_syntax)] - -struct Foo { a: isize, b: isize } - -fn main() { - let mut x: Box<_> = box Foo { a: 1, b: 2 }; - let (a, b) = (&mut x.a, &mut x.b); - //~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time - //~| NOTE first mutable borrow occurs here (via `x.a`) - //~| NOTE second mutable borrow occurs here (via `x.b`) - - let mut foo: Box<_> = box Foo { a: 1, b: 2 }; - let (c, d) = (&mut foo.a, &foo.b); - //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable - //~| NOTE mutable borrow occurs here (via `foo.a`) - //~| NOTE immutable borrow occurs here (via `foo.b`) -} -//~^ NOTE first borrow ends here -//~^^ NOTE mutable borrow ends here diff --git a/src/test/compile-fail/issue-17441.rs b/src/test/compile-fail/issue-17441.rs deleted file mode 100644 index bddc9c13815..00000000000 --- a/src/test/compile-fail/issue-17441.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 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() { - let _foo = &[1_usize, 2] as [usize]; - //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` - //~^^ HELP consider using an implicit coercion to `&[usize]` instead - - let _bar = Box::new(1_usize) as std::fmt::Debug; - //~^ ERROR cast to unsized type: `std::boxed::Box<usize>` as `std::fmt::Debug` - //~^^ HELP try casting to a `Box` instead - - let _baz = 1_usize as std::fmt::Debug; - //~^ ERROR cast to unsized type: `usize` as `std::fmt::Debug` - //~^^ HELP consider using a box or reference as appropriate - - let _quux = [1_usize, 2] as [usize]; - //~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]` - //~^^ HELP consider using a box or reference as appropriate -} diff --git a/src/test/compile-fail/issue-17954.rs b/src/test/compile-fail/issue-17954.rs deleted file mode 100644 index 4211057610b..00000000000 --- a/src/test/compile-fail/issue-17954.rs +++ /dev/null @@ -1,33 +0,0 @@ -// 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. - -// revisions: ast mir -//[mir]compile-flags: -Z borrowck=mir - -#![feature(thread_local)] - -#[thread_local] -static FOO: u8 = 3; - -fn main() { - let a = &FOO; - //[mir]~^ ERROR `FOO` does not live long enough [E0597] - //[mir]~| does not live long enough - //[mir]~| NOTE borrowed value must be valid for the static lifetime - //[ast]~^^^^ ERROR borrowed value does not live long enough - //[ast]~| does not live long enough - //[ast]~| NOTE borrowed value must be valid for the static lifetime - - std::thread::spawn(move || { - println!("{}", a); - }); -} -//[mir]~^ borrowed value only lives until here -//[ast]~^^ temporary value only lives until here diff --git a/src/test/compile-fail/issue-18183.rs b/src/test/compile-fail/issue-18183.rs deleted file mode 100644 index feab04531b7..00000000000 --- a/src/test/compile-fail/issue-18183.rs +++ /dev/null @@ -1,14 +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. - -pub struct Foo<Bar=Bar>(Bar); //~ ERROR E0128 - //~| NOTE defaulted type parameters cannot be forward declared -pub struct Baz(Foo); -fn main() {} diff --git a/src/test/compile-fail/issue-18819.rs b/src/test/compile-fail/issue-18819.rs deleted file mode 100644 index 148eea31ec6..00000000000 --- a/src/test/compile-fail/issue-18819.rs +++ /dev/null @@ -1,30 +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. - -trait Foo { - type Item; -} - -struct X; - -impl Foo for X { - type Item = bool; -} - -fn print_x(_: &Foo<Item=bool>, extra: &str) { - //~^ NOTE defined here - println!("{}", extra); -} - -fn main() { - print_x(X); - //~^ ERROR E0061 - //~| NOTE expected 2 parameters -} diff --git a/src/test/compile-fail/issue-19498.rs b/src/test/compile-fail/issue-19498.rs deleted file mode 100644 index 7de16e5ecfe..00000000000 --- a/src/test/compile-fail/issue-19498.rs +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -use self::A; //~ NOTE previous import of the module `A` here -use self::B; //~ NOTE previous import of the module `B` here -mod A {} //~ ERROR the name `A` is defined multiple times -//~| `A` redefined here -//~| NOTE `A` must be defined only once in the type namespace of this module -pub mod B {} //~ ERROR the name `B` is defined multiple times -//~| `B` redefined here -//~| NOTE `B` must be defined only once in the type namespace of this module -mod C { - use C::D; //~ NOTE previous import of the module `D` here - mod D {} //~ ERROR the name `D` is defined multiple times - //~| `D` redefined here - //~| NOTE `D` must be defined only once in the type namespace of this module -} - -fn main() {} diff --git a/src/test/compile-fail/issue-1962.rs b/src/test/compile-fail/issue-1962.rs deleted file mode 100644 index 9de3040bb61..00000000000 --- a/src/test/compile-fail/issue-1962.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 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. - -// compile-flags: -D while-true -fn main() { - let mut i = 0; - while true { //~ ERROR denote infinite loops with `loop - i += 1; - if i == 5 { break; } - } -} diff --git a/src/test/compile-fail/issue-19707.rs b/src/test/compile-fail/issue-19707.rs deleted file mode 100644 index beeb7da6d38..00000000000 --- a/src/test/compile-fail/issue-19707.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 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(dead_code)] - -type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier -//~^ HELP the signature does not say whether it is borrowed from argument 1 or argument 2 - -fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {} //~ ERROR missing lifetime specifier -//~^ HELP the signature does not say whether it is borrowed from argument 1 or argument 2 - -fn main() {} diff --git a/src/test/compile-fail/issue-19922.rs b/src/test/compile-fail/issue-19922.rs deleted file mode 100644 index 938ccb343d4..00000000000 --- a/src/test/compile-fail/issue-19922.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 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 Homura { - Akemi { madoka: () } -} - -fn main() { - let homura = Homura::Akemi { kaname: () }; - //~^ ERROR variant `Homura::Akemi` has no field named `kaname` - //~| NOTE `Homura::Akemi` does not have this field - //~| NOTE available fields are: `madoka` -} diff --git a/src/test/compile-fail/issue-20692.rs b/src/test/compile-fail/issue-20692.rs deleted file mode 100644 index 3e440538755..00000000000 --- a/src/test/compile-fail/issue-20692.rs +++ /dev/null @@ -1,26 +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. - -trait Array: Sized {} - -fn f<T: Array>(x: &T) { - let _ = x - //~^ ERROR `Array` cannot be made into an object - //~| NOTE the trait cannot require that `Self : Sized` - //~| NOTE requirements on the impl of `std::ops::CoerceUnsized<&Array>` - //~| NOTE the trait `Array` cannot be made into an object - as - &Array; - //~^ ERROR `Array` cannot be made into an object - //~| NOTE the trait cannot require that `Self : Sized` - //~| NOTE the trait `Array` cannot be made into an object -} - -fn main() {} diff --git a/src/test/compile-fail/issue-21546.rs b/src/test/compile-fail/issue-21546.rs deleted file mode 100644 index b7dbc7c7210..00000000000 --- a/src/test/compile-fail/issue-21546.rs +++ /dev/null @@ -1,77 +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. - -// Also works as a test for #14564 - -#[allow(non_snake_case)] -mod Foo { } -//~^ NOTE previous definition of the module `Foo` here - -#[allow(dead_code)] -struct Foo; -//~^ ERROR the name `Foo` is defined multiple times -//~| NOTE `Foo` redefined here -//~| NOTE `Foo` must be defined only once in the type namespace of this module - -#[allow(non_snake_case)] -mod Bar { } -//~^ NOTE previous definition of the module `Bar` here - -#[allow(dead_code)] -struct Bar(i32); -//~^ ERROR the name `Bar` is defined multiple times -//~| NOTE `Bar` redefined here -//~| NOTE `Bar` must be defined only once in the type namespace of this module - - -#[allow(dead_code)] -struct Baz(i32); -//~^ NOTE previous definition of the type `Baz` here - -#[allow(non_snake_case)] -mod Baz { } -//~^ ERROR the name `Baz` is defined multiple times -//~| NOTE `Baz` redefined here -//~| NOTE `Baz` must be defined only once in the type namespace of this module - - -#[allow(dead_code)] -struct Qux { x: bool } -//~^ NOTE previous definition of the type `Qux` here - -#[allow(non_snake_case)] -mod Qux { } -//~^ ERROR the name `Qux` is defined multiple times -//~| NOTE `Qux` redefined here -//~| NOTE `Qux` must be defined only once in the type namespace of this module - - -#[allow(dead_code)] -struct Quux; -//~^ NOTE previous definition of the type `Quux` here - -#[allow(non_snake_case)] -mod Quux { } -//~^ ERROR the name `Quux` is defined multiple times -//~| NOTE `Quux` redefined here -//~| NOTE `Quux` must be defined only once in the type namespace of this module - - -#[allow(dead_code)] -enum Corge { A, B } -//~^ NOTE previous definition of the type `Corge` here - -#[allow(non_snake_case)] -mod Corge { } -//~^ ERROR the name `Corge` is defined multiple times -//~| NOTE `Corge` redefined here -//~| NOTE `Corge` must be defined only once in the type namespace of this module - -fn main() { } diff --git a/src/test/compile-fail/issue-21600.rs b/src/test/compile-fail/issue-21600.rs deleted file mode 100644 index 1d0473ec4b6..00000000000 --- a/src/test/compile-fail/issue-21600.rs +++ /dev/null @@ -1,28 +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. - -fn call_it<F>(f: F) where F: Fn() { f(); } - -struct A; - -impl A { - fn gen(&self) {} - fn gen_mut(&mut self) {} -} - -fn main() { - let mut x = A; - call_it(|| { //~ HELP consider changing this to accept closures that implement `FnMut` - call_it(|| x.gen()); - call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer - //~^ ERROR cannot borrow data mutably in a captured outer - //~| HELP consider changing this closure to take self by mutable reference - }); -} diff --git a/src/test/compile-fail/issue-21950.rs b/src/test/compile-fail/issue-21950.rs deleted file mode 100644 index 935f3480db2..00000000000 --- a/src/test/compile-fail/issue-21950.rs +++ /dev/null @@ -1,23 +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. - -// ignore-tidy-linelength - -use std::ops::Add; - -fn main() { - let x = &10 as - &Add; - //~^ ERROR E0393 - //~| NOTE missing reference to `RHS` - //~| NOTE because of the default `Self` reference, type parameters must be specified on object types - //~| ERROR E0191 - //~| NOTE missing associated type `Output` value -} diff --git a/src/test/compile-fail/issue-22370.rs b/src/test/compile-fail/issue-22370.rs deleted file mode 100644 index 51f342e3f0a..00000000000 --- a/src/test/compile-fail/issue-22370.rs +++ /dev/null @@ -1,20 +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. - -// ignore-tidy-linelength - -trait A<T=Self> {} - -fn f(a: &A) {} -//~^ ERROR E0393 -//~| NOTE missing reference to `T` -//~| NOTE because of the default `Self` reference, type parameters must be specified on object types - -fn main() {} diff --git a/src/test/compile-fail/issue-22560.rs b/src/test/compile-fail/issue-22560.rs deleted file mode 100644 index 914a3bd79d4..00000000000 --- a/src/test/compile-fail/issue-22560.rs +++ /dev/null @@ -1,28 +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. - -// ignore-tidy-linelength - -use std::ops::{Add, Sub}; - -type Test = Add + - //~^ ERROR E0393 - //~| NOTE missing reference to `RHS` - //~| NOTE because of the default `Self` reference, type parameters must be specified on object types - //~| ERROR E0191 - //~| NOTE missing associated type `Output` value - Sub; - //~^ ERROR E0393 - //~| NOTE missing reference to `RHS` - //~| NOTE because of the default `Self` reference, type parameters must be specified on object types - //~| ERROR E0225 - //~| NOTE non-auto additional trait - -fn main() { } diff --git a/src/test/compile-fail/issue-22886.rs b/src/test/compile-fail/issue-22886.rs deleted file mode 100644 index d258a4a8b33..00000000000 --- a/src/test/compile-fail/issue-22886.rs +++ /dev/null @@ -1,32 +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. - -// Regression test for #22886. - -fn crash_please() { - let mut iter = Newtype(Some(Box::new(0))); - let saved = iter.next().unwrap(); - println!("{}", saved); - iter.0 = None; - println!("{}", saved); -} - -struct Newtype(Option<Box<usize>>); - -impl<'a> Iterator for Newtype { //~ ERROR E0207 - //~| NOTE unconstrained lifetime parameter - type Item = &'a Box<usize>; - - fn next(&mut self) -> Option<&Box<usize>> { - self.0.as_ref() - } -} - -fn main() { } diff --git a/src/test/compile-fail/issue-22933-2.rs b/src/test/compile-fail/issue-22933-2.rs deleted file mode 100644 index 583f2ace4ba..00000000000 --- a/src/test/compile-fail/issue-22933-2.rs +++ /dev/null @@ -1,19 +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. - -enum Delicious { //~ NOTE variant `PIE` not found here - Pie = 0x1, - Apple = 0x2, - ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, - //~^ ERROR no variant named `PIE` found for type `Delicious` - //~| NOTE variant not found in `Delicious` -} - -fn main() {} diff --git a/src/test/compile-fail/issue-23041.rs b/src/test/compile-fail/issue-23041.rs deleted file mode 100644 index 4dfad4ee3c3..00000000000 --- a/src/test/compile-fail/issue-23041.rs +++ /dev/null @@ -1,18 +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. - -use std::any::Any; -fn main() -{ - fn bar(x:i32) ->i32 { 3*x }; - let b:Box<Any> = Box::new(bar as fn(_)->_); - b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282 - //~| NOTE cannot infer type for `_` -} diff --git a/src/test/compile-fail/issue-23173.rs b/src/test/compile-fail/issue-23173.rs deleted file mode 100644 index c0983eb0e52..00000000000 --- a/src/test/compile-fail/issue-23173.rs +++ /dev/null @@ -1,35 +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. - -enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } -//~^ NOTE variant `Homura` not found here -struct Struct { - //~^ NOTE function or associated item `method` not found for this - //~| NOTE function or associated item `method` not found for this - //~| NOTE associated item `Assoc` not found for this - a: usize, -} - -fn use_token(token: &Token) { unimplemented!() } - -fn main() { - use_token(&Token::Homura); - //~^ ERROR no variant named `Homura` - //~| NOTE variant not found in `Token` - Struct::method(); - //~^ ERROR no function or associated item named `method` found for type - //~| NOTE function or associated item not found in `Struct` - Struct::method; - //~^ ERROR no function or associated item named `method` found for type - //~| NOTE function or associated item not found in `Struct` - Struct::Assoc; - //~^ ERROR no associated item named `Assoc` found for type `Struct` in - //~| NOTE associated item not found in `Struct` -} diff --git a/src/test/compile-fail/issue-23217.rs b/src/test/compile-fail/issue-23217.rs deleted file mode 100644 index cce0b99c04d..00000000000 --- a/src/test/compile-fail/issue-23217.rs +++ /dev/null @@ -1,17 +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. - -pub enum SomeEnum { //~ NOTE variant `A` not found here - B = SomeEnum::A, - //~^ ERROR no variant named `A` found for type `SomeEnum` - //~| NOTE variant not found in `SomeEnum` -} - -fn main() {} diff --git a/src/test/compile-fail/issue-23302.rs b/src/test/compile-fail/issue-23302.rs deleted file mode 100644 index 35f32d16a9a..00000000000 --- a/src/test/compile-fail/issue-23302.rs +++ /dev/null @@ -1,32 +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. - -// Check that an enum with recursion in the discriminant throws -// the appropriate error (rather than, say, blowing the stack). -enum X { - A = X::A as isize, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant -} - -// Since `Y::B` here defaults to `Y::A+1`, this is also a -// recursive definition. -enum Y { - A = Y::B as isize, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant - B, -} - -const A: i32 = B; //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant - -const B: i32 = A; //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant - -fn main() { } diff --git a/src/test/compile-fail/issue-23543.rs b/src/test/compile-fail/issue-23543.rs deleted file mode 100644 index e1acc8eb475..00000000000 --- a/src/test/compile-fail/issue-23543.rs +++ /dev/null @@ -1,22 +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. - -pub trait A: Copy {} - -struct Foo; - -pub trait D { - fn f<T>(self) - where T<Bogus = Foo>: A; - //~^ ERROR associated type bindings are not allowed here [E0229] - //~| NOTE associated type not allowed here -} - -fn main() {} diff --git a/src/test/compile-fail/issue-23544.rs b/src/test/compile-fail/issue-23544.rs deleted file mode 100644 index 3cd6f9ebc71..00000000000 --- a/src/test/compile-fail/issue-23544.rs +++ /dev/null @@ -1,20 +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. - -pub trait A: Copy {} - -pub trait D { - fn f<T>(self) - where T<Bogus = Self::AlsoBogus>: A; - //~^ ERROR associated type bindings are not allowed here [E0229] - //~| NOTE associated type not allowed here -} - -fn main() {} diff --git a/src/test/compile-fail/issue-23716.rs b/src/test/compile-fail/issue-23716.rs deleted file mode 100644 index 5cf80dd172a..00000000000 --- a/src/test/compile-fail/issue-23716.rs +++ /dev/null @@ -1,29 +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. - -static foo: i32 = 0; -//~^ NOTE a static `foo` is defined here - -fn bar(foo: i32) {} -//~^ ERROR function parameters cannot shadow statics -//~| cannot be named the same as a static - -mod submod { - pub static answer: i32 = 42; -} - -use self::submod::answer; -//~^ NOTE a static `answer` is imported here - -fn question(answer: i32) {} -//~^ ERROR function parameters cannot shadow statics -//~| cannot be named the same as a static -fn main() { -} diff --git a/src/test/compile-fail/issue-24036.rs b/src/test/compile-fail/issue-24036.rs deleted file mode 100644 index ac7e0f2e9a8..00000000000 --- a/src/test/compile-fail/issue-24036.rs +++ /dev/null @@ -1,37 +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. - -fn closure_to_loc() { - let mut x = |c| c + 1; - x = |c| c + 1; - //~^ ERROR mismatched types - //~| NOTE no two closures, even if identical, have the same type - //~| HELP consider boxing your closure and/or using it as a trait object - //~| expected closure, found a different closure - //~| expected type `[closure - //~| found type `[closure -} - -fn closure_from_match() { - let x = match 1usize { - 1 => |c| c + 1, - 2 => |c| c - 1, - //~^ NOTE match arm with an incompatible type - _ => |c| c - 1 - }; - //~^^^^^^ ERROR match arms have incompatible types - //~| NOTE no two closures, even if identical, have the same type - //~| HELP consider boxing your closure and/or using it as a trait object - //~| expected closure, found a different closure - //~| expected type `[closure - //~| found type `[closure -} - -fn main() { } diff --git a/src/test/compile-fail/issue-24081.rs b/src/test/compile-fail/issue-24081.rs deleted file mode 100644 index dc8fc01bbfc..00000000000 --- a/src/test/compile-fail/issue-24081.rs +++ /dev/null @@ -1,33 +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. - -use std::ops::Add; //~ NOTE previous import of the trait `Add` here -use std::ops::Sub; //~ NOTE previous import of the trait `Sub` here -use std::ops::Mul; //~ NOTE previous import of the trait `Mul` here -use std::ops::Div; //~ NOTE previous import of the trait `Div` here -use std::ops::Rem; //~ NOTE previous import of the trait `Rem` here - -type Add = bool; //~ ERROR the name `Add` is defined multiple times -//~| `Add` redefined here -//~| NOTE `Add` must be defined only once in the type namespace of this module -struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times -//~| `Sub` redefined here -//~| NOTE `Sub` must be defined only once in the type namespace of this module -enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times -//~| `Mul` redefined here -//~| NOTE `Mul` must be defined only once in the type namespace of this module -mod Div { } //~ ERROR the name `Div` is defined multiple times -//~| `Div` redefined here -//~| NOTE `Div` must be defined only once in the type namespace of this module -trait Rem { } //~ ERROR the name `Rem` is defined multiple times -//~| `Rem` redefined here -//~| NOTE `Rem` must be defined only once in the type namespace of this module - -fn main() {} diff --git a/src/test/compile-fail/issue-24424.rs b/src/test/compile-fail/issue-24424.rs deleted file mode 100644 index 8d4ea66f081..00000000000 --- a/src/test/compile-fail/issue-24424.rs +++ /dev/null @@ -1,18 +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. - -trait Trait1<'l0, T0> {} -trait Trait0<'l0> {} - -impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} -//~^ ERROR type annotations required: cannot resolve `T0: Trait0<'l0>` -//~^^ NOTE required by `Trait0` - -fn main() {} diff --git a/src/test/compile-fail/issue-25385.rs b/src/test/compile-fail/issue-25385.rs deleted file mode 100644 index 4aacb6840e9..00000000000 --- a/src/test/compile-fail/issue-25385.rs +++ /dev/null @@ -1,24 +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. - - -macro_rules! foo { - ($e:expr) => { $e.foo() } - //~^ ERROR no method named `foo` found for type `i32` in the current scope -} - -fn main() { - let a = 1i32; - foo!(a); - //~^ NOTE in this expansion of foo! - - foo!(1i32.foo()); - //~^ ERROR no method named `foo` found for type `i32` in the current scope -} diff --git a/src/test/compile-fail/issue-25793.rs b/src/test/compile-fail/issue-25793.rs deleted file mode 100644 index ceefd583a5c..00000000000 --- a/src/test/compile-fail/issue-25793.rs +++ /dev/null @@ -1,35 +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. - -macro_rules! width( - ($this:expr) => { - $this.width.unwrap() - //~^ ERROR cannot use `self.width` because it was mutably borrowed - //~| NOTE use of borrowed `*self` - } -); - -struct HasInfo { - width: Option<usize> -} - -impl HasInfo { - fn get_size(&mut self, n: usize) -> usize { - n - } - - fn get_other(&mut self) -> usize { - self.get_size(width!(self)) - //~^ NOTE in this expansion of width! - //~| NOTE borrow of `*self` occurs here - } -} - -fn main() {} diff --git a/src/test/compile-fail/issue-25826.rs b/src/test/compile-fail/issue-25826.rs deleted file mode 100644 index 468282fa7cc..00000000000 --- a/src/test/compile-fail/issue-25826.rs +++ /dev/null @@ -1,17 +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. - -fn id<T>(t: T) -> T { t } -fn main() { - const A: bool = id::<u8> as *const () < id::<u16> as *const (); - //~^ ERROR raw pointers cannot be compared in constants [E0395] - //~^^ NOTE comparing raw pointers in static - println!("{}", A); -} diff --git a/src/test/compile-fail/issue-26056.rs b/src/test/compile-fail/issue-26056.rs deleted file mode 100644 index ded685152d4..00000000000 --- a/src/test/compile-fail/issue-26056.rs +++ /dev/null @@ -1,34 +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. - -trait MapLookup<Q> { - type MapValue; -} - -impl<K> MapLookup<K> for K { - type MapValue = K; -} - -trait Map: MapLookup<<Self as Map>::Key> { - type Key; -} - -impl<K> Map for K { - type Key = K; -} - - -fn main() { - let _ = &() - as &Map<Key=u32,MapValue=u32>; - //~^ ERROR E0038 - //~| NOTE the trait cannot use `Self` as a type parameter - //~| NOTE the trait `Map` cannot be made into an object -} diff --git a/src/test/compile-fail/issue-26093.rs b/src/test/compile-fail/issue-26093.rs deleted file mode 100644 index 39a53648ccf..00000000000 --- a/src/test/compile-fail/issue-26093.rs +++ /dev/null @@ -1,22 +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. - -macro_rules! not_an_lvalue { - ($thing:expr) => { - $thing = 42; - //~^ ERROR invalid left-hand side expression - //~^^ NOTE left-hand of expression not valid - } -} - -fn main() { - not_an_lvalue!(99); - //~^ NOTE in this expansion of not_an_lvalue! -} diff --git a/src/test/compile-fail/issue-26472.rs b/src/test/compile-fail/issue-26472.rs deleted file mode 100644 index 0d59a897ef1..00000000000 --- a/src/test/compile-fail/issue-26472.rs +++ /dev/null @@ -1,24 +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. - -mod sub { - pub struct S { len: usize } - impl S { - pub fn new() -> S { S { len: 0 } } - pub fn len(&self) -> usize { self.len } - } -} - -fn main() { - let s = sub::S::new(); - let v = s.len; - //~^ ERROR field `len` of struct `sub::S` is private - //~| NOTE a method `len` also exists, perhaps you wish to call it -} diff --git a/src/test/compile-fail/issue-26638.rs b/src/test/compile-fail/issue-26638.rs deleted file mode 100644 index 9b8c7b25076..00000000000 --- a/src/test/compile-fail/issue-26638.rs +++ /dev/null @@ -1,25 +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. - -fn parse_type(iter: Box<Iterator<Item=&str>+'static>) -> &str { iter.next() } -//~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP 2 lifetimes - -fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } -//~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP lifetime cannot be derived -//~^^^ HELP consider giving it an explicit bounded or 'static lifetime - -fn parse_type_3() -> &str { unimplemented!() } -//~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP no value for it to be borrowed from -//~^^^ HELP consider giving it a 'static lifetime - -fn main() {} diff --git a/src/test/compile-fail/issue-26886.rs b/src/test/compile-fail/issue-26886.rs deleted file mode 100644 index 9b195060196..00000000000 --- a/src/test/compile-fail/issue-26886.rs +++ /dev/null @@ -1,21 +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. - -use std::sync::{self, Arc}; //~ NOTE previous import of the type `Arc` here - //~^ NOTE previous import of the module `sync` here -use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times - //~| NOTE `Arc` reimported here - //~| `Arc` must be defined only once in the type namespace of this module -use std::sync; //~ ERROR the name `sync` is defined multiple times - //~| NOTE `sync` reimported here - //~| `sync` must be defined only once in the type namespace of this module - -fn main() { -} diff --git a/src/test/compile-fail/issue-27842.rs b/src/test/compile-fail/issue-27842.rs deleted file mode 100644 index eb28e36dc07..00000000000 --- a/src/test/compile-fail/issue-27842.rs +++ /dev/null @@ -1,24 +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. - -fn main() { - let tup = (0, 1, 2); - // the case where we show a suggestion - let _ = tup[0]; - //~^ ERROR cannot index into a value of type - //~| HELP to access tuple elements, use - //~| SUGGESTION tup.0 - - // the case where we show just a general hint - let i = 0_usize; - let _ = tup[i]; - //~^ ERROR cannot index into a value of type - //~| HELP to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`) -} diff --git a/src/test/compile-fail/issue-27942.rs b/src/test/compile-fail/issue-27942.rs deleted file mode 100644 index 0fa4184606e..00000000000 --- a/src/test/compile-fail/issue-27942.rs +++ /dev/null @@ -1,30 +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. - -pub trait Resources<'a> {} - -pub trait Buffer<'a, R: Resources<'a>> { - //~^ NOTE the lifetime 'a as defined on the trait at 13:1... - //~| NOTE ...does not necessarily outlive the lifetime 'a as defined on the trait - - fn select(&self) -> BufferViewHandle<R>; - //~^ ERROR mismatched types - //~| lifetime mismatch - //~| NOTE expected type `Resources<'_>` - //~| NOTE ...does not necessarily outlive the anonymous lifetime #1 defined on the method body - //~| ERROR mismatched types - //~| lifetime mismatch - //~| NOTE expected type `Resources<'_>` - //~| NOTE the anonymous lifetime #1 defined on the method body at 17:5... -} - -pub struct BufferViewHandle<'a, R: 'a+Resources<'a>>(&'a R); - -fn main() {} diff --git a/src/test/compile-fail/issue-2848.rs b/src/test/compile-fail/issue-2848.rs deleted file mode 100644 index 38bd7adefd9..00000000000 --- a/src/test/compile-fail/issue-2848.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 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. - -mod bar { - pub enum foo { - alpha, - beta, - charlie - } -} - -fn main() { - use bar::foo::{alpha, charlie}; - match alpha { - alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns - charlie => {} //~| NOTE pattern doesn't bind `beta` - //~| NOTE variable not in all patterns - } -} diff --git a/src/test/compile-fail/issue-28568.rs b/src/test/compile-fail/issue-28568.rs deleted file mode 100644 index f03daafc637..00000000000 --- a/src/test/compile-fail/issue-28568.rs +++ /dev/null @@ -1,24 +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. - -struct MyStruct; - -impl Drop for MyStruct { -//~^ NOTE first implementation here - fn drop(&mut self) { } -} - -impl Drop for MyStruct { -//~^ ERROR conflicting implementations of trait -//~| NOTE conflicting implementation for `MyStruct` - fn drop(&mut self) { } -} - -fn main() {} diff --git a/src/test/compile-fail/issue-28776.rs b/src/test/compile-fail/issue-28776.rs deleted file mode 100644 index 4a36bc88fa7..00000000000 --- a/src/test/compile-fail/issue-28776.rs +++ /dev/null @@ -1,17 +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. - -use std::ptr; - -fn main() { - (&ptr::write)(1 as *mut _, 42); - //~^ ERROR E0133 - //~| NOTE call to unsafe function -} diff --git a/src/test/compile-fail/issue-28837.rs b/src/test/compile-fail/issue-28837.rs deleted file mode 100644 index c7cf63bf2c4..00000000000 --- a/src/test/compile-fail/issue-28837.rs +++ /dev/null @@ -1,60 +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. - -struct A; - -fn main() { - let a = A; - - a + a; //~ ERROR binary operation `+` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Add` might be missing for `A` - - a - a; //~ ERROR binary operation `-` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Sub` might be missing for `A` - - a * a; //~ ERROR binary operation `*` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Mul` might be missing for `A` - - a / a; //~ ERROR binary operation `/` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Div` might be missing for `A` - - a % a; //~ ERROR binary operation `%` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Rem` might be missing for `A` - - a & a; //~ ERROR binary operation `&` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::BitAnd` might be missing for `A` - - a | a; //~ ERROR binary operation `|` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::BitOr` might be missing for `A` - - a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Shl` might be missing for `A` - - a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Shr` might be missing for `A` - - a == a; //~ ERROR binary operation `==` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialEq` might be missing for `A` - - a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialEq` might be missing for `A` - - a < a; //~ ERROR binary operation `<` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` - - a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` - - a > a; //~ ERROR binary operation `>` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` - - a >= a; //~ ERROR binary operation `>=` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` -} diff --git a/src/test/compile-fail/issue-28971.rs b/src/test/compile-fail/issue-28971.rs deleted file mode 100644 index 10be4d6210d..00000000000 --- a/src/test/compile-fail/issue-28971.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012-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. - -// This should not cause an ICE - -enum Foo { //~ NOTE variant `Baz` not found here - Bar(u8) -} -fn main(){ - foo(|| { - match Foo::Bar(1) { - Foo::Baz(..) => (), - //~^ ERROR no variant named `Baz` found for type `Foo` - //~| NOTE variant not found in `Foo` - _ => (), - } - }); -} - -fn foo<F>(f: F) where F: FnMut() { - f(); -} diff --git a/src/test/compile-fail/issue-29124.rs b/src/test/compile-fail/issue-29124.rs deleted file mode 100644 index a72dac0d5dd..00000000000 --- a/src/test/compile-fail/issue-29124.rs +++ /dev/null @@ -1,31 +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. - -struct ret; -struct obj; - -impl obj { - fn func() -> ret { - ret - } -} - -fn func() -> ret { - ret -} - -fn main() { - obj::func.x(); - //~^ ERROR no method named `x` found for type `fn() -> ret {obj::func}` in the current scope - //~^^ NOTE obj::func is a function, perhaps you wish to call it - func.x(); - //~^ ERROR no method named `x` found for type `fn() -> ret {func}` in the current scope - //~^^ NOTE func is a function, perhaps you wish to call it -} diff --git a/src/test/compile-fail/issue-30007.rs b/src/test/compile-fail/issue-30007.rs deleted file mode 100644 index fa0b75da999..00000000000 --- a/src/test/compile-fail/issue-30007.rs +++ /dev/null @@ -1,17 +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. - -macro_rules! t { - () => ( String ; ); //~ ERROR macro expansion ignores token `;` -} - -fn main() { - let i: Vec<t!()>; //~ NOTE caused by the macro expansion here -} diff --git a/src/test/compile-fail/issue-3008-1.rs b/src/test/compile-fail/issue-3008-1.rs deleted file mode 100644 index 7ca6d9301a6..00000000000 --- a/src/test/compile-fail/issue-3008-1.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 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 Foo { - Foo_(Bar) -} - -enum Bar { - //~^ ERROR recursive type `Bar` has infinite size - //~| NOTE recursive type has infinite size - BarNone, - BarSome(Bar) //~ NOTE recursive without indirection -} - -fn main() { -} diff --git a/src/test/compile-fail/issue-3008-2.rs b/src/test/compile-fail/issue-3008-2.rs deleted file mode 100644 index 061d1facda0..00000000000 --- a/src/test/compile-fail/issue-3008-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 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 foo { foo_(bar) } -struct bar { x: bar } -//~^ ERROR E0072 -//~| NOTE recursive type has infinite size -//~| NOTE recursive without indirection - -fn main() { -} diff --git a/src/test/compile-fail/issue-30255.rs b/src/test/compile-fail/issue-30255.rs deleted file mode 100644 index e3f55ae51e8..00000000000 --- a/src/test/compile-fail/issue-30255.rs +++ /dev/null @@ -1,35 +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. -// -// Test that lifetime elision error messages correctly omit parameters -// with no elided lifetimes - -struct S<'a> { - field: &'a i32, -} - -fn f(a: &S, b: i32) -> &i32 { -//~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP does not say which one of `a`'s 2 lifetimes it is borrowed from - panic!(); -} - -fn g(a: &S, b: bool, c: &i32) -> &i32 { -//~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP does not say whether it is borrowed from one of `a`'s 2 lifetimes or `c` - panic!(); -} - -fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { -//~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP does not say whether it is borrowed from `a`, one of `c`'s 2 lifetimes, or `d` - panic!(); -} - diff --git a/src/test/compile-fail/issue-30302.rs b/src/test/compile-fail/issue-30302.rs deleted file mode 100644 index 01150ff1374..00000000000 --- a/src/test/compile-fail/issue-30302.rs +++ /dev/null @@ -1,31 +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. - -#![allow(dead_code)] -#![allow(unused_variables)] -#![allow(non_snake_case)] -#![deny(unreachable_patterns)] - -enum Stack<T> { - Nil, - Cons(T, Box<Stack<T>>) -} - -fn is_empty<T>(s: Stack<T>) -> bool { - match s { - Nil => true, -//~^ WARN pattern binding `Nil` is named the same as one of the variants of the type `Stack` -//~| HELP consider making the path in the pattern qualified: `Stack::Nil` - _ => false -//~^ ERROR unreachable pattern - } -} - -fn main() {} diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/compile-fail/issue-3044.rs deleted file mode 100644 index 4c63f7761a6..00000000000 --- a/src/test/compile-fail/issue-3044.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 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() { - let needlesArr: Vec<char> = vec!['a', 'f']; - needlesArr.iter().fold(|x, y| { - }); - //~^^ ERROR this function takes 2 parameters but 1 parameter was supplied - //~| NOTE expected 2 parameters -} diff --git a/src/test/compile-fail/issue-30730.rs b/src/test/compile-fail/issue-30730.rs deleted file mode 100644 index d1af39a6c18..00000000000 --- a/src/test/compile-fail/issue-30730.rs +++ /dev/null @@ -1,16 +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. - -#![warn(unused)] -#![deny(warnings)] //~ NOTE: lint level defined here -use std::thread; -//~^ ERROR: unused import -//~| NOTE: #[deny(unused_imports)] implied by #[deny(warnings)] -fn main() {} diff --git a/src/test/compile-fail/issue-31221.rs b/src/test/compile-fail/issue-31221.rs deleted file mode 100644 index 8701ca0178f..00000000000 --- a/src/test/compile-fail/issue-31221.rs +++ /dev/null @@ -1,51 +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. - -#![allow(dead_code)] -#![allow(unused_variables)] -#![allow(non_snake_case)] -#![deny(unreachable_patterns)] -//~^ NOTE lint level defined here - -#[derive(Clone, Copy)] -enum Enum { - Var1, - Var2, -} - -fn main() { - use Enum::*; - let s = Var1; - match s { - Var1 => (), - Var3 => (), - //~^ NOTE this pattern matches any value - Var2 => (), - //~^ ERROR unreachable pattern - //~^^ NOTE this is an unreachable pattern - }; - match &s { - &Var1 => (), - &Var3 => (), - //~^ NOTE this pattern matches any value - &Var2 => (), - //~^ ERROR unreachable pattern - //~^^ NOTE this is an unreachable pattern - }; - let t = (Var1, Var1); - match t { - (Var1, b) => (), - (c, d) => (), - //~^ NOTE this pattern matches any value - anything => () - //~^ ERROR unreachable pattern - //~^^ NOTE this is an unreachable pattern - }; -} diff --git a/src/test/compile-fail/issue-32326.rs b/src/test/compile-fail/issue-32326.rs deleted file mode 100644 index 70a7cd8b970..00000000000 --- a/src/test/compile-fail/issue-32326.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 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. - -// Regression test for #32326. We ran out of memory because we -// attempted to expand this case up to the recursion limit, and 2^N is -// too big. - -enum Expr { //~ ERROR E0072 - //~| NOTE recursive type has infinite size - Plus(Expr, Expr), - //~^ NOTE recursive without indirection - //~| NOTE recursive without indirection - Literal(i64), -} - -fn main() { } diff --git a/src/test/compile-fail/issue-32950.rs b/src/test/compile-fail/issue-32950.rs deleted file mode 100644 index 20e5b1d72d3..00000000000 --- a/src/test/compile-fail/issue-32950.rs +++ /dev/null @@ -1,18 +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. - -#![feature(concat_idents)] - -#[derive(Debug)] //~ NOTE in this expansion -struct Baz<T>( - concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros -); - -fn main() {} diff --git a/src/test/compile-fail/issue-34047.rs b/src/test/compile-fail/issue-34047.rs deleted file mode 100644 index 630694d9156..00000000000 --- a/src/test/compile-fail/issue-34047.rs +++ /dev/null @@ -1,19 +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. - -const C: u8 = 0; //~ NOTE a constant `C` is defined here - -fn main() { - match 1u8 { - mut C => {} //~ ERROR match bindings cannot shadow constants - //~^ NOTE cannot be named the same as a constant - _ => {} - } -} diff --git a/src/test/compile-fail/issue-34209.rs b/src/test/compile-fail/issue-34209.rs deleted file mode 100644 index 5e3b777cc0b..00000000000 --- a/src/test/compile-fail/issue-34209.rs +++ /dev/null @@ -1,24 +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. - -enum S { - A, -} - -fn bug(l: S) { - match l { - S::B{ } => { }, - //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `<S as Trait>::B` - } -} - -fn main () {} diff --git a/src/test/compile-fail/issue-35139.rs b/src/test/compile-fail/issue-35139.rs deleted file mode 100644 index 5c4f161a500..00000000000 --- a/src/test/compile-fail/issue-35139.rs +++ /dev/null @@ -1,37 +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. - -use std::fmt; - -pub trait MethodType { - type GetProp: ?Sized; -} - -pub struct MTFn; - -impl<'a> MethodType for MTFn { //~ ERROR E0207 - //~| NOTE unconstrained lifetime parameter - type GetProp = fmt::Debug + 'a; -} - -fn bad(a: Box<<MTFn as MethodType>::GetProp>) -> Box<fmt::Debug+'static> { - a -} - -fn dangling(a: &str) -> Box<fmt::Debug> { - bad(Box::new(a)) -} - -fn main() { - let mut s = "hello".to_string(); - let x = dangling(&s); - s = String::new(); - println!("{:?}", x); -} diff --git a/src/test/compile-fail/issue-35869.rs b/src/test/compile-fail/issue-35869.rs deleted file mode 100644 index 1942fd38d11..00000000000 --- a/src/test/compile-fail/issue-35869.rs +++ /dev/null @@ -1,41 +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. - -#![feature(conservative_impl_trait)] - -trait Foo { - fn foo(_: fn(u8) -> ()); //~ NOTE type in trait - fn bar(_: Option<u8>); //~ NOTE type in trait - fn baz(_: (u8, u16)); //~ NOTE type in trait - fn qux() -> u8; //~ NOTE type in trait -} - -struct Bar; - -impl Foo for Bar { - fn foo(_: fn(u16) -> ()) {} - //~^ ERROR method `foo` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn(fn(u8))` - fn bar(_: Option<u16>) {} - //~^ ERROR method `bar` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn(std::option::Option<u8>)` - fn baz(_: (u16, u16)) {} - //~^ ERROR method `baz` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn((u8, u16))` - fn qux() -> u16 { 5u16 } - //~^ ERROR method `qux` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn() -> u8` -} - -fn main() {} diff --git a/src/test/compile-fail/issue-36163.rs b/src/test/compile-fail/issue-36163.rs deleted file mode 100644 index 9dad6ede776..00000000000 --- a/src/test/compile-fail/issue-36163.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 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 A: i32 = Foo::B; //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant - -enum Foo { - B = A, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant -} - -enum Bar { - C = Bar::C, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant -} - -const D: i32 = A; - -fn main() {} diff --git a/src/test/compile-fail/issue-36708.rs b/src/test/compile-fail/issue-36708.rs deleted file mode 100644 index 6146258fa8d..00000000000 --- a/src/test/compile-fail/issue-36708.rs +++ /dev/null @@ -1,23 +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. - -// aux-build:issue-36708.rs - -extern crate issue_36708 as lib; - -struct Bar; - -impl lib::Foo for Bar { - fn foo<T>() {} - //~^ ERROR E0049 - //~| NOTE found 1 type parameter, expected 0 -} - -fn main() {} diff --git a/src/test/compile-fail/issue-3779.rs b/src/test/compile-fail/issue-3779.rs deleted file mode 100644 index 10f73dc0862..00000000000 --- a/src/test/compile-fail/issue-3779.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 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. - -struct S { - //~^ ERROR E0072 - //~| NOTE recursive type has infinite size - element: Option<S> - //~^ NOTE recursive without indirection -} - -fn main() { - let x = S { element: None }; -} diff --git a/src/test/compile-fail/issue-37884.rs b/src/test/compile-fail/issue-37884.rs deleted file mode 100644 index 6313293bf2b..00000000000 --- a/src/test/compile-fail/issue-37884.rs +++ /dev/null @@ -1,27 +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. - -struct RepeatMut<'a, T>(T, &'a ()); - -impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { - //~^ NOTE ...does not necessarily outlive the lifetime 'a as defined on the impl - - type Item = &'a mut T; - fn next(&'a mut self) -> Option<Self::Item> - //~^ ERROR method not compatible with trait - //~| lifetime mismatch - //~| NOTE expected type `fn(&mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` - //~| NOTE the anonymous lifetime #1 defined on the method body - { - Some(&mut self.0) - } -} - -fn main() {} diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/compile-fail/issue-4335.rs deleted file mode 100644 index c5aae894c3e..00000000000 --- a/src/test/compile-fail/issue-4335.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012-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. - -#![feature(fn_traits)] - -fn id<T>(t: T) -> T { t } - -fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> { - id(Box::new(|| *v)) - //~^ ERROR E0373 - //~| NOTE `v` is borrowed here - //~| NOTE may outlive borrowed value `v` - //~| ERROR E0507 - //~| NOTE cannot move out of borrowed content -} - -fn main() { - let v = &5; - println!("{}", f(v).call_mut(())); -} diff --git a/src/test/compile-fail/issue-4935.rs b/src/test/compile-fail/issue-4935.rs deleted file mode 100644 index e9f8367378a..00000000000 --- a/src/test/compile-fail/issue-4935.rs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -// Regression test for issue #4935 - -fn foo(a: usize) {} -//~^ defined here -fn main() { foo(5, 6) } -//~^ ERROR this function takes 1 parameter but 2 parameters were supplied -//~| NOTE expected 1 parameter diff --git a/src/test/compile-fail/issue-5239-1.rs b/src/test/compile-fail/issue-5239-1.rs deleted file mode 100644 index a77b27150d7..00000000000 --- a/src/test/compile-fail/issue-5239-1.rs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -// Regression test for issue #5239 - -fn main() { - let x = |ref x: isize| { x += 1; }; - //~^ ERROR E0368 - //~| NOTE cannot use `+=` on type `&isize` -} diff --git a/src/test/compile-fail/issue-6458-3.rs b/src/test/compile-fail/issue-6458-3.rs deleted file mode 100644 index 1503da2baa7..00000000000 --- a/src/test/compile-fail/issue-6458-3.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013-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. - -use std::mem; - -fn main() { - mem::transmute(0); - //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `U` -} diff --git a/src/test/compile-fail/issue-6458-4.rs b/src/test/compile-fail/issue-6458-4.rs deleted file mode 100644 index a078cdea4ac..00000000000 --- a/src/test/compile-fail/issue-6458-4.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013-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. - -fn foo(b: bool) -> Result<bool,String> { //~ ERROR mismatched types - Err("bar".to_string()); //~ HELP consider removing this semicolon -} - -fn main() { - foo(false); -} diff --git a/src/test/compile-fail/issue-6458.rs b/src/test/compile-fail/issue-6458.rs deleted file mode 100644 index db4d4e76c11..00000000000 --- a/src/test/compile-fail/issue-6458.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013-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. - -use std::marker; - -pub struct TypeWithState<State>(marker::PhantomData<State>); -pub struct MyState; - -pub fn foo<State>(_: TypeWithState<State>) {} - -pub fn bar() { - foo(TypeWithState(marker::PhantomData)); - //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `State` -} - -fn main() { -} diff --git a/src/test/compile-fail/issue-7813.rs b/src/test/compile-fail/issue-7813.rs deleted file mode 100644 index a5f001b785c..00000000000 --- a/src/test/compile-fail/issue-7813.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014-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. - -fn main() { - let v = &[]; //~ ERROR type annotations needed - //~| NOTE consider giving `v` a type - //~| NOTE cannot infer type for `_` - let it = v.iter(); -} diff --git a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs deleted file mode 100644 index 2d9de57a265..00000000000 --- a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 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. - -// Lifetime annotation needed because we have no arguments. -fn f() -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP there is no value for it to be borrowed from -//~| HELP consider giving it a 'static lifetime - panic!() -} - -// Lifetime annotation needed because we have two by-reference parameters. -fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP the signature does not say whether it is borrowed from `_x` or `_y` - panic!() -} - -struct Foo<'a> { - x: &'a isize, -} - -// Lifetime annotation needed because we have two lifetimes: one as a parameter -// and one on the reference. -fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from - panic!() -} - -fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP this function's return type contains a borrowed value -//~| HELP consider giving it an explicit bounded or 'static lifetime - panic!() -} - -// Cases which used to work but now don't. - -type StaticStr = &'static str; // hides 'static -trait WithLifetime<'a> { - type Output; // can hide 'a -} - -// This worked because the type of the first argument contains -// 'static, although StaticStr doesn't even have parameters. -fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP this function's return type contains a borrowed value -//~| HELP consider giving it an explicit bounded or 'static lifetime - panic!() -} - -// This worked because the compiler resolved the argument type -// to <T as WithLifetime<'a>>::Output which has the hidden 'a. -fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { -//~^ ERROR missing lifetime specifier -//~| HELP this function's return type contains a borrowed value -//~| HELP consider giving it an explicit bounded or 'static lifetime - panic!() -} - -fn main() {} diff --git a/src/test/compile-fail/lint-forbid-attr.rs b/src/test/compile-fail/lint-forbid-attr.rs deleted file mode 100644 index a23083b5c8c..00000000000 --- a/src/test/compile-fail/lint-forbid-attr.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 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. - -#![forbid(deprecated)] -//~^ NOTE `forbid` level set here - -#[allow(deprecated)] -//~^ ERROR allow(deprecated) overruled by outer forbid(deprecated) -//~| NOTE overruled by previous forbid -fn main() { -} diff --git a/src/test/compile-fail/lint-output-format-2.rs b/src/test/compile-fail/lint-output-format-2.rs deleted file mode 100644 index 29d7c6caec4..00000000000 --- a/src/test/compile-fail/lint-output-format-2.rs +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -// aux-build:lint_output_format.rs - -// FIXME(#44232) we should warn that this isn't used. -#![feature(foo)] - -#![feature(test_feature)] -#![feature(rustc_attrs)] - -extern crate lint_output_format; -use lint_output_format::{foo, bar}; -//~^ WARNING use of deprecated item 'lint_output_format::foo': text -//~| NOTE #[warn(deprecated)] on by default - -#[rustc_error] -fn main() { //~ ERROR: compilation successful - let _x = foo(); - //~^ WARNING use of deprecated item 'lint_output_format::foo': text - let _y = bar(); -} diff --git a/src/test/compile-fail/lint-unconditional-recursion.rs b/src/test/compile-fail/lint-unconditional-recursion.rs deleted file mode 100644 index bee5a2c45be..00000000000 --- a/src/test/compile-fail/lint-unconditional-recursion.rs +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2014 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. - -#![deny(unconditional_recursion)] -//~^ NOTE lint level defined here - -#![allow(dead_code)] -fn foo() { //~ ERROR function cannot return without recurring - foo(); //~ NOTE recursive call site -} - -fn bar() { - if true { - bar() - } -} - -fn baz() { //~ ERROR function cannot return without recurring - if true { - baz() //~ NOTE recursive call site - } else { - baz() //~ NOTE recursive call site - } -} - -fn qux() { - loop {} -} - -fn quz() -> bool { //~ ERROR function cannot return without recurring - if true { - while quz() {} //~ NOTE recursive call site - true - } else { - loop { quz(); } //~ NOTE recursive call site - } -} - -// Trait method calls. -trait Foo { - fn bar(&self) { //~ ERROR function cannot return without recurring - self.bar() //~ NOTE recursive call site - } -} - -impl Foo for Box<Foo+'static> { - fn bar(&self) { //~ ERROR function cannot return without recurring - loop { - self.bar() //~ NOTE recursive call site - } - } -} - -// Trait method call with integer fallback after method resolution. -impl Foo for i32 { - fn bar(&self) { //~ ERROR function cannot return without recurring - 0.bar() //~ NOTE recursive call site - } -} - -impl Foo for u32 { - fn bar(&self) { - 0.bar() - } -} - -// Trait method calls via paths. -trait Foo2 { - fn bar(&self) { //~ ERROR function cannot return without recurring - Foo2::bar(self) //~ NOTE recursive call site - } -} - -impl Foo2 for Box<Foo2+'static> { - fn bar(&self) { //~ ERROR function cannot return without recurring - loop { - Foo2::bar(self) //~ NOTE recursive call site - } - } -} - -struct Baz; -impl Baz { - // Inherent method call. - fn qux(&self) { //~ ERROR function cannot return without recurring - self.qux(); //~ NOTE recursive call site - } - - // Inherent method call via path. - fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring - Baz::as_ref(self) //~ NOTE recursive call site - } -} - -// Trait method calls to impls via paths. -impl Default for Baz { - fn default() -> Baz { //~ ERROR function cannot return without recurring - let x = Default::default(); //~ NOTE recursive call site - x - } -} - -// Overloaded operators. -impl std::ops::Deref for Baz { - type Target = (); - fn deref(&self) -> &() { //~ ERROR function cannot return without recurring - &**self //~ NOTE recursive call site - } -} - -impl std::ops::Index<usize> for Baz { - type Output = Baz; - fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring - &self[x] //~ NOTE recursive call site - } -} - -// Overloaded autoderef. -struct Quux; -impl std::ops::Deref for Quux { - type Target = Baz; - fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring - self.as_ref() //~ NOTE recursive call site - } -} - -fn all_fine() { - let _f = all_fine; -} - -// issue 26333 -trait Bar { - fn method<T: Bar>(&self, x: &T) { - x.method(x) - } -} - -fn main() {} diff --git a/src/test/compile-fail/liveness-return-last-stmt-semi.rs b/src/test/compile-fail/liveness-return-last-stmt-semi.rs deleted file mode 100644 index ada91c38d48..00000000000 --- a/src/test/compile-fail/liveness-return-last-stmt-semi.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 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. -// -// regression test for #8005 - -macro_rules! test { () => { fn foo() -> i32 { 1; } } } - //~^ ERROR mismatched types - //~| HELP consider removing this semicolon - -fn no_return() -> i32 {} //~ ERROR mismatched types - -fn bar(x: u32) -> u32 { //~ ERROR mismatched types - x * 2; //~ HELP consider removing this semicolon -} - -fn baz(x: u64) -> u32 { //~ ERROR mismatched types - x * 2; -} - -fn main() { - test!(); -} diff --git a/src/test/compile-fail/loops-reject-duplicate-labels-2.rs b/src/test/compile-fail/loops-reject-duplicate-labels-2.rs deleted file mode 100644 index ca18ca3796a..00000000000 --- a/src/test/compile-fail/loops-reject-duplicate-labels-2.rs +++ /dev/null @@ -1,52 +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. - -#![feature(rustc_attrs)] - -// ignore-tidy-linelength - -// Issue #21633: reject duplicate loop labels in function bodies. -// -// This is testing the generalization (to the whole function body) -// discussed here: -// https://internals.rust-lang.org/t/psa-rejecting-duplicate-loop-labels/1833 - -pub fn foo() { - { 'fl: for _ in 0..10 { break; } } //~ NOTE first declared here - { 'fl: loop { break; } } //~ WARN label name `'fl` shadows a label name that is already in scope - //~^ NOTE lifetime 'fl already in scope - { 'lf: loop { break; } } //~ NOTE first declared here - { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows a label name that is already in scope - //~^ NOTE lifetime 'lf already in scope - { 'wl: while 2 > 1 { break; } } //~ NOTE first declared here - { 'wl: loop { break; } } //~ WARN label name `'wl` shadows a label name that is already in scope - //~^ NOTE lifetime 'wl already in scope - { 'lw: loop { break; } } //~ NOTE first declared here - { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows a label name that is already in scope - //~^ NOTE lifetime 'lw already in scope - { 'fw: for _ in 0..10 { break; } } //~ NOTE first declared here - { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows a label name that is already in scope - //~^ NOTE lifetime 'fw already in scope - { 'wf: while 2 > 1 { break; } } //~ NOTE first declared here - { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows a label name that is already in scope - //~^ NOTE lifetime 'wf already in scope - { 'tl: while let Some(_) = None::<i32> { break; } } //~ NOTE first declared here - { 'tl: loop { break; } } //~ WARN label name `'tl` shadows a label name that is already in scope - //~^ NOTE lifetime 'tl already in scope - { 'lt: loop { break; } } //~ NOTE first declared here - { 'lt: while let Some(_) = None::<i32> { break; } } - //~^ WARN label name `'lt` shadows a label name that is already in scope - //~| NOTE lifetime 'lt already in scope -} - -#[rustc_error] -pub fn main() { //~ ERROR compilation successful - foo(); -} diff --git a/src/test/compile-fail/loops-reject-duplicate-labels.rs b/src/test/compile-fail/loops-reject-duplicate-labels.rs deleted file mode 100644 index 31f89493896..00000000000 --- a/src/test/compile-fail/loops-reject-duplicate-labels.rs +++ /dev/null @@ -1,62 +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. - -#![feature(rustc_attrs)] - -// ignore-tidy-linelength - -// Issue #21633: reject duplicate loop labels in function bodies. -// This is testing the exact cases that are in the issue description. - -fn foo() { - 'fl: for _ in 0..10 { break; } //~ NOTE first declared here - 'fl: loop { break; } //~ WARN label name `'fl` shadows a label name that is already in scope - //~^ NOTE lifetime 'fl already in scope - - 'lf: loop { break; } //~ NOTE first declared here - 'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a label name that is already in scope - //~^ NOTE lifetime 'lf already in scope - 'wl: while 2 > 1 { break; } //~ NOTE first declared here - 'wl: loop { break; } //~ WARN label name `'wl` shadows a label name that is already in scope - //~^ NOTE lifetime 'wl already in scope - 'lw: loop { break; } //~ NOTE first declared here - 'lw: while 2 > 1 { break; } //~ WARN label name `'lw` shadows a label name that is already in scope - //~^ NOTE lifetime 'lw already in scope - 'fw: for _ in 0..10 { break; } //~ NOTE first declared here - 'fw: while 2 > 1 { break; } //~ WARN label name `'fw` shadows a label name that is already in scope - //~^ NOTE lifetime 'fw already in scope - 'wf: while 2 > 1 { break; } //~ NOTE first declared here - 'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a label name that is already in scope - //~^ NOTE lifetime 'wf already in scope - 'tl: while let Some(_) = None::<i32> { break; } //~ NOTE first declared here - 'tl: loop { break; } //~ WARN label name `'tl` shadows a label name that is already in scope - //~^ NOTE lifetime 'tl already in scope - 'lt: loop { break; } //~ NOTE first declared here - 'lt: while let Some(_) = None::<i32> { break; } - //~^ WARN label name `'lt` shadows a label name that is already in scope - //~| NOTE lifetime 'lt already in scope -} - -// Note however that it is okay for the same label to be reused in -// different methods of one impl, as illustrated here. - -struct S; -impl S { - fn m1(&self) { 'okay: loop { break 'okay; } } - fn m2(&self) { 'okay: loop { break 'okay; } } -} - -#[rustc_error] -pub fn main() { //~ ERROR compilation successful - let s = S; - s.m1(); - s.m2(); - foo(); -} diff --git a/src/test/compile-fail/loops-reject-labels-shadowing-lifetimes.rs b/src/test/compile-fail/loops-reject-labels-shadowing-lifetimes.rs deleted file mode 100644 index 9a735f9c97c..00000000000 --- a/src/test/compile-fail/loops-reject-labels-shadowing-lifetimes.rs +++ /dev/null @@ -1,132 +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. - -// Issue #21633: reject duplicate loop labels in function bodies. -// This is testing interaction between lifetime-params and labels. - -#![feature(rustc_attrs)] - -#![allow(dead_code, unused_variables)] - -fn foo() { - fn foo<'a>() { //~ NOTE first declared here - 'a: loop { break 'a; } - //~^ WARN label name `'a` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'a already in scope - } - - struct Struct<'b, 'c> { _f: &'b i8, _g: &'c i8 } - enum Enum<'d, 'e> { A(&'d i8), B(&'e i8) } - - impl<'d, 'e> Struct<'d, 'e> { - fn meth_okay() { - 'a: loop { break 'a; } - 'b: loop { break 'b; } - 'c: loop { break 'c; } - } - } - - impl <'d, 'e> Enum<'d, 'e> { - fn meth_okay() { - 'a: loop { break 'a; } - 'b: loop { break 'b; } - 'c: loop { break 'c; } - } - } - - impl<'bad, 'c> Struct<'bad, 'c> { //~ NOTE first declared here - fn meth_bad(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - } - - impl<'b, 'bad> Struct<'b, 'bad> { //~ NOTE first declared here - fn meth_bad2(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - } - - impl<'b, 'c> Struct<'b, 'c> { - fn meth_bad3<'bad>(x: &'bad i8) { //~ NOTE first declared here - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - - fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) { - //~^ NOTE first declared here - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - } - - impl <'bad, 'e> Enum<'bad, 'e> { //~ NOTE first declared here - fn meth_bad(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - } - impl <'d, 'bad> Enum<'d, 'bad> { //~ NOTE first declared here - fn meth_bad2(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - } - impl <'d, 'e> Enum<'d, 'e> { - fn meth_bad3<'bad>(x: &'bad i8) { //~ NOTE first declared here - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - - fn meth_bad4<'a,'bad>(x: &'bad i8) { //~ NOTE first declared here - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - } - - trait HasDefaultMethod1<'bad> { //~ NOTE first declared here - fn meth_okay() { - 'c: loop { break 'c; } - } - fn meth_bad(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - } - trait HasDefaultMethod2<'a,'bad> { //~ NOTE first declared here - fn meth_bad(&self) { - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - } - trait HasDefaultMethod3<'a,'b> { - fn meth_bad<'bad>(&self) { //~ NOTE first declared here - 'bad: loop { break 'bad; } - //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope - } - } -} - -#[rustc_error] -pub fn main() { //~ ERROR compilation successful - foo(); -} diff --git a/src/test/compile-fail/loops-reject-lifetime-shadowing-label.rs b/src/test/compile-fail/loops-reject-lifetime-shadowing-label.rs deleted file mode 100644 index 0a90917d975..00000000000 --- a/src/test/compile-fail/loops-reject-lifetime-shadowing-label.rs +++ /dev/null @@ -1,42 +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. - -#![feature(rustc_attrs)] - -#![allow(dead_code, unused_variables)] - -// Issue #21633: reject duplicate loop labels in function bodies. -// -// Test rejection of lifetimes in *expressions* that shadow loop labels. - -fn foo() { - // Reusing lifetime `'a` in function item is okay. - fn foo<'a>(x: &'a i8) -> i8 { *x } - - // So is reusing `'a` in struct item - struct S1<'a> { x: &'a i8 } impl<'a> S1<'a> { fn m(&self) {} } - // and a method item - struct S2; impl S2 { fn m<'a>(&self) {} } - - let z = 3_i8; - - 'a: loop { //~ NOTE first declared here - let b = Box::new(|x: &i8| *x) as Box<for <'a> Fn(&'a i8) -> i8>; - //~^ WARN lifetime name `'a` shadows a label name that is already in scope - //~| NOTE lifetime 'a already in scope - assert_eq!((*b)(&z), z); - break 'a; - } -} - -#[rustc_error] -pub fn main() { //~ ERROR compilation successful - foo(); -} diff --git a/src/test/compile-fail/macro-context.rs b/src/test/compile-fail/macro-context.rs deleted file mode 100644 index cc714a6e431..00000000000 --- a/src/test/compile-fail/macro-context.rs +++ /dev/null @@ -1,27 +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. - -// (typeof used because it's surprisingly hard to find an unparsed token after a stmt) -macro_rules! m { - () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` - //~| ERROR macro expansion ignores token `typeof` - //~| ERROR macro expansion ignores token `;` - //~| ERROR macro expansion ignores token `;` -} - -fn main() { - let a: m!(); //~ NOTE the usage of `m!` is likely invalid in type context - let i = m!(); //~ NOTE the usage of `m!` is likely invalid in expression context - match 0 { - m!() => {} //~ NOTE the usage of `m!` is likely invalid in pattern context - } - - m!(); //~ NOTE in this expansion -} diff --git a/src/test/compile-fail/macro-invalid-fragment-spec.rs b/src/test/compile-fail/macro-invalid-fragment-spec.rs deleted file mode 100644 index ca6cd664e73..00000000000 --- a/src/test/compile-fail/macro-invalid-fragment-spec.rs +++ /dev/null @@ -1,19 +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. - -macro_rules! foo( - ($x:foo) => () - //~^ ERROR invalid fragment specifier - //~| HELP valid fragment specifiers are -); - -fn main() { - foo!(foo); -} diff --git a/src/test/compile-fail/macro-shadowing.rs b/src/test/compile-fail/macro-shadowing.rs deleted file mode 100644 index f5e7305e4ea..00000000000 --- a/src/test/compile-fail/macro-shadowing.rs +++ /dev/null @@ -1,41 +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. - -// aux-build:two_macros.rs - -#![allow(unused_macros)] - -macro_rules! foo { () => {} } -macro_rules! macro_one { () => {} } -#[macro_use(macro_two)] extern crate two_macros; - -macro_rules! m1 { () => { - macro_rules! foo { () => {} } //~ ERROR `foo` is already in scope - //~^ NOTE macro-expanded `macro_rules!`s may not shadow existing macros - - #[macro_use] //~ ERROR `macro_two` is already in scope - //~^ NOTE macro-expanded `#[macro_use]`s may not shadow existing macros - extern crate two_macros as __; -}} -m1!(); //~ NOTE in this expansion - //~| NOTE in this expansion - //~| NOTE in this expansion - //~| NOTE in this expansion - -foo!(); - -macro_rules! m2 { () => { - macro_rules! foo { () => {} } - foo!(); -}} -m2!(); -//^ Since `foo` is not used outside this expansion, it is not a shadowing error. - -fn main() {} diff --git a/src/test/compile-fail/main-wrong-location.rs b/src/test/compile-fail/main-wrong-location.rs deleted file mode 100644 index ef3f8140c68..00000000000 --- a/src/test/compile-fail/main-wrong-location.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 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. - -mod m { - // An inferred main entry point (that doesn't use #[main]) - // must appear at the top of the crate - fn main() { } //~ NOTE here is a function named 'main' -} diff --git a/src/test/compile-fail/maybe-bounds.rs b/src/test/compile-fail/maybe-bounds.rs deleted file mode 100644 index b0b412bbf89..00000000000 --- a/src/test/compile-fail/maybe-bounds.rs +++ /dev/null @@ -1,17 +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. - -trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits - //~^ NOTE traits are `?Sized` by default - -type A1 = Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types -type A2 = for<'a> Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types - -fn main() {} diff --git a/src/test/compile-fail/method-missing-call.rs b/src/test/compile-fail/method-missing-call.rs deleted file mode 100644 index b13d4250ee9..00000000000 --- a/src/test/compile-fail/method-missing-call.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 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. - -// Tests to make sure that parens are needed for method calls without arguments. -// outputs text to make sure either an anonymous function is provided or -// open-close '()' parens are given - - -struct Point { - x: isize, - y: isize -} -impl Point { - fn new() -> Point { - Point{x:0, y:0} - } - fn get_x(&self) -> isize { - self.x - } -} - -fn main() { - let point: Point = Point::new(); - let px: isize = point - .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` - //~^ HELP maybe a `()` to call it is missing - - // Ensure the span is useful - let ys = &[1,2,3,4,5,6,7]; - let a = ys.iter() - .map(|x| x) - .filter(|&&x| x == 1) - .filter_map; //~ ERROR attempted to take value of method `filter_map` on type - //~^ HELP maybe a `()` to call it is missing -} diff --git a/src/test/compile-fail/missing-block-hint.rs b/src/test/compile-fail/missing-block-hint.rs deleted file mode 100644 index 6a140e6f21c..00000000000 --- a/src/test/compile-fail/missing-block-hint.rs +++ /dev/null @@ -1,21 +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. - -fn main() { - { - if (foo) => {} //~ ERROR expected `{`, found `=>` - } - { - if (foo) - bar; //~ ERROR expected `{`, found `bar` - //~^ HELP try placing this code inside a block - //~| SUGGESTION { bar; } - } -} diff --git a/src/test/compile-fail/moves-based-on-type-block-bad.rs b/src/test/compile-fail/moves-based-on-type-block-bad.rs deleted file mode 100644 index deaff3c3521..00000000000 --- a/src/test/compile-fail/moves-based-on-type-block-bad.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 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 - -#![feature(box_patterns)] -#![feature(box_syntax)] - -struct S { - x: Box<E> -} - -enum E { - Foo(Box<S>), - Bar(Box<isize>), - Baz -} - -fn f<G>(s: &S, g: G) where G: FnOnce(&S) { - g(s) -} - -fn main() { - let s = S { x: box E::Bar(box 42) }; - loop { - f(&s, |hellothere| { - match hellothere.x { //~ ERROR cannot move out - //~| cannot move out of borrowed content - box E::Foo(_) => {} - box E::Bar(x) => println!("{}", x.to_string()), - //~^ NOTE to prevent move - box E::Baz => {} - } - }) - } -} diff --git a/src/test/compile-fail/moves-based-on-type-match-bindings.rs b/src/test/compile-fail/moves-based-on-type-match-bindings.rs deleted file mode 100644 index bcbb8dbfad1..00000000000 --- a/src/test/compile-fail/moves-based-on-type-match-bindings.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 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. - -// Tests that bindings to move-by-default values trigger moves of the -// discriminant. Also tests that the compiler explains the move in -// terms of the binding, not the discriminant. - -struct Foo<A> { f: A } -fn guard(_s: String) -> bool {panic!()} -fn touch<A>(_a: &A) {} - -fn f10() { - let x = Foo {f: "hi".to_string()}; - - let y = match x { - Foo {f} => {} //~ NOTE moved here - }; - - touch(&x); //~ ERROR use of partially moved value: `x` - //~^ value used here after move - //~| move occurs because `x.f` has type `std::string::String` -} - -fn main() {} diff --git a/src/test/compile-fail/no-patterns-in-args.rs b/src/test/compile-fail/no-patterns-in-args.rs deleted file mode 100644 index 081d6caaa13..00000000000 --- a/src/test/compile-fail/no-patterns-in-args.rs +++ /dev/null @@ -1,29 +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. - -extern { - fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations - //~^ NOTE pattern not allowed in foreign function - fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations - //~^ NOTE pattern not allowed in foreign function - fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations - //~^ NOTE pattern not allowed in foreign function - fn g1(arg: u8); // OK - fn g2(_: u8); // OK - // fn g3(u8); // Not yet -} - -type A1 = fn(mut arg: u8); //~ ERROR patterns aren't allowed in function pointer types -type A2 = fn(&arg: u8); //~ ERROR patterns aren't allowed in function pointer types -type B1 = fn(arg: u8); // OK -type B2 = fn(_: u8); // OK -type B3 = fn(u8); // OK - -fn main() {} diff --git a/src/test/compile-fail/non-constant-expr-for-arr-len.rs b/src/test/compile-fail/non-constant-expr-for-arr-len.rs deleted file mode 100644 index 17df7ae2347..00000000000 --- a/src/test/compile-fail/non-constant-expr-for-arr-len.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-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. - -// Check that non constant exprs fail for array repeat syntax - -fn main() { - fn bar(n: usize) { - let _x = [0; n]; - //~^ ERROR attempt to use a non-constant value in a constant [E0435] - //~| NOTE non-constant value - } -} diff --git a/src/test/compile-fail/non-exhaustive-pattern-witness.rs b/src/test/compile-fail/non-exhaustive-pattern-witness.rs deleted file mode 100644 index eba61ede8cb..00000000000 --- a/src/test/compile-fail/non-exhaustive-pattern-witness.rs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2014 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(advanced_slice_patterns)] -#![feature(slice_patterns)] - -struct Foo { - first: bool, - second: Option<[usize; 4]> -} - -fn struct_with_a_nested_enum_and_vector() { - match (Foo { first: true, second: None }) { -//~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered -//~| NOTE pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered - Foo { first: true, second: None } => (), - Foo { first: true, second: Some(_) } => (), - Foo { first: false, second: None } => (), - Foo { first: false, second: Some([1, 2, 3, 4]) } => () - } -} - -enum Color { - Red, - Green, - CustomRGBA { a: bool, r: u8, g: u8, b: u8 } -} - -fn enum_with_single_missing_variant() { - match Color::Red { - //~^ ERROR non-exhaustive patterns: `Red` not covered - //~| NOTE pattern `Red` not covered - Color::CustomRGBA { .. } => (), - Color::Green => () - } -} - -enum Direction { - North, East, South, West -} - -fn enum_with_multiple_missing_variants() { - match Direction::North { - //~^ ERROR non-exhaustive patterns: `East`, `South` and `West` not covered - //~| NOTE patterns `East`, `South` and `West` not covered - Direction::North => () - } -} - -enum ExcessiveEnum { - First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth -} - -fn enum_with_excessive_missing_variants() { - match ExcessiveEnum::First { - //~^ ERROR `Second`, `Third`, `Fourth` and 8 more not covered - //~| NOTE patterns `Second`, `Third`, `Fourth` and 8 more not covered - - ExcessiveEnum::First => () - } -} - -fn enum_struct_variant() { - match Color::Red { - //~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered - //~| NOTE pattern `CustomRGBA { a: true, .. }` not covered - Color::Red => (), - Color::Green => (), - Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (), - Color::CustomRGBA { a: false, r: _, g: _, b: _ } => () - } -} - -enum Enum { - First, - Second(bool) -} - -fn vectors_with_nested_enums() { - let x: &'static [Enum] = &[Enum::First, Enum::Second(false)]; - match *x { - //~^ ERROR non-exhaustive patterns: `[Second(true), Second(false)]` not covered - //~| NOTE pattern `[Second(true), Second(false)]` not covered - [] => (), - [_] => (), - [Enum::First, _] => (), - [Enum::Second(true), Enum::First] => (), - [Enum::Second(true), Enum::Second(true)] => (), - [Enum::Second(false), _] => (), - [_, _, ref tail.., _] => () - } -} - -fn missing_nil() { - match ((), false) { - //~^ ERROR non-exhaustive patterns: `((), false)` not covered - //~| NOTE pattern `((), false)` not covered - ((), true) => () - } -} - -fn main() {} diff --git a/src/test/compile-fail/not-enough-arguments.rs b/src/test/compile-fail/not-enough-arguments.rs deleted file mode 100644 index e13008df0d9..00000000000 --- a/src/test/compile-fail/not-enough-arguments.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 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. - -// Check that the only error msg we report is the -// mismatch between the # of params, and not other -// unrelated errors. - -fn foo(a: isize, b: isize, c: isize, d:isize) { - //~^ NOTE defined here - panic!(); -} - -fn main() { - foo(1, 2, 3); - //~^ ERROR this function takes 4 parameters but 3 - //~| NOTE expected 4 parameters -} diff --git a/src/test/compile-fail/numeric-fields.rs b/src/test/compile-fail/numeric-fields.rs deleted file mode 100644 index d6e091a1472..00000000000 --- a/src/test/compile-fail/numeric-fields.rs +++ /dev/null @@ -1,23 +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. - -struct S(u8, u16); - -fn main() { - let s = S{0b1: 10, 0: 11}; - //~^ ERROR struct `S` has no field named `0b1` - //~| NOTE `S` does not have this field - //~| NOTE available fields are: `0`, `1` - match s { - S{0: a, 0x1: b, ..} => {} - //~^ ERROR does not have a field named `0x1` - //~| NOTE struct `S` does not have field `0x1` - } -} diff --git a/src/test/compile-fail/object-safety-associated-consts.rs b/src/test/compile-fail/object-safety-associated-consts.rs deleted file mode 100644 index ebb52face06..00000000000 --- a/src/test/compile-fail/object-safety-associated-consts.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 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. - -// Check that we correctly prevent users from making trait objects -// from traits with associated consts. - - -trait Bar { - const X: usize; -} - -fn make_bar<T:Bar>(t: &T) -> &Bar { - //~^ ERROR E0038 - //~| NOTE the trait cannot contain associated consts like `X` - //~| NOTE the trait `Bar` cannot be made into an object - t -} - -fn main() { -} diff --git a/src/test/compile-fail/object-safety-generics.rs b/src/test/compile-fail/object-safety-generics.rs deleted file mode 100644 index 6174d45b898..00000000000 --- a/src/test/compile-fail/object-safety-generics.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 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. - -// Check that we correctly prevent users from making trait objects -// from traits with generic methods, unless `where Self : Sized` is -// present. - -trait Bar { - fn bar<T>(&self, t: T); -} - -trait Quux { - fn bar<T>(&self, t: T) - where Self : Sized; -} - -fn make_bar<T:Bar>(t: &T) -> &Bar { - //~^ ERROR E0038 - //~| NOTE method `bar` has generic type parameters - //~| NOTE the trait `Bar` cannot be made into an object - t -} - -fn make_bar_explicit<T:Bar>(t: &T) -> &Bar { - //~^ ERROR E0038 - //~| NOTE method `bar` has generic type parameters - //~| NOTE the trait `Bar` cannot be made into an object - t as &Bar -} - -fn make_quux<T:Quux>(t: &T) -> &Quux { - t -} - -fn make_quux_explicit<T:Quux>(t: &T) -> &Quux { - t as &Quux -} - -fn main() { -} diff --git a/src/test/compile-fail/object-safety-mentions-Self.rs b/src/test/compile-fail/object-safety-mentions-Self.rs deleted file mode 100644 index d85614fa5b5..00000000000 --- a/src/test/compile-fail/object-safety-mentions-Self.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 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. - -// Check that we correctly prevent users from making trait objects -// form traits that make use of `Self` in an argument or return -// position, unless `where Self : Sized` is present.. - -trait Bar { - fn bar(&self, x: &Self); -} - -trait Baz { - fn bar(&self) -> Self; -} - -trait Quux { - fn get(&self, s: &Self) -> Self where Self : Sized; -} - -fn make_bar<T:Bar>(t: &T) -> &Bar { - //~^ ERROR E0038 - //~| NOTE method `bar` references the `Self` type in its arguments or return type - //~| NOTE the trait `Bar` cannot be made into an object - loop { } -} - -fn make_baz<T:Baz>(t: &T) -> &Baz { - //~^ ERROR E0038 - //~| NOTE method `bar` references the `Self` type in its arguments or return type - //~| NOTE the trait `Baz` cannot be made into an object - t -} - -fn make_quux<T:Quux>(t: &T) -> &Quux { - t -} - -fn make_quux_explicit<T:Quux>(t: &T) -> &Quux { - t as &Quux -} - -fn main() { -} diff --git a/src/test/compile-fail/object-safety-sized.rs b/src/test/compile-fail/object-safety-sized.rs deleted file mode 100644 index accd7fa87ac..00000000000 --- a/src/test/compile-fail/object-safety-sized.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 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. - -// Check that we correctly prevent users from making trait objects -// from traits where `Self : Sized`. - -trait Bar : Sized { - fn bar<T>(&self, t: T); -} - -fn make_bar<T:Bar>(t: &T) -> &Bar { - //~^ ERROR E0038 - //~| NOTE the trait cannot require that `Self : Sized` - //~| NOTE the trait `Bar` cannot be made into an object - t -} - -fn main() { -} diff --git a/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs b/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs deleted file mode 100644 index a93c056c410..00000000000 --- a/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 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. - -// Check that we correctly prevent users from making trait objects -// form traits that make use of `Self` in an argument or return position. - -trait Bar<T> { - fn bar(&self, x: &T); -} - -trait Baz : Bar<Self> { -} - -fn make_bar<T:Bar<u32>>(t: &T) -> &Bar<u32> { - t -} - -fn make_baz<T:Baz>(t: &T) -> &Baz { - //~^ ERROR E0038 - //~| 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 -} - -fn main() { -} diff --git a/src/test/compile-fail/partialeq_help.rs b/src/test/compile-fail/partialeq_help.rs deleted file mode 100644 index 52c24473bd3..00000000000 --- a/src/test/compile-fail/partialeq_help.rs +++ /dev/null @@ -1,20 +0,0 @@ -// 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 foo<T: PartialEq>(a: &T, b: T) { - a == b; //~ ERROR E0277 - //~| NOTE can't compare `&T` with `T` - //~| HELP the trait `std::cmp::PartialEq<T>` is not implemented for `&T` - //~| HELP consider adding a `where &T: std::cmp::PartialEq<T>` bound -} - -fn main() { - foo(&1, 1); -} diff --git a/src/test/compile-fail/pat-slice-old-style.rs b/src/test/compile-fail/pat-slice-old-style.rs deleted file mode 100644 index d49ce56ccf6..00000000000 --- a/src/test/compile-fail/pat-slice-old-style.rs +++ /dev/null @@ -1,29 +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. - -#![feature(slice_patterns)] - -// NB: this test was introduced in #23121 and will have to change when default match binding modes -// stabilizes. - -fn slice_pat(x: &[u8]) { - // OLD! - match x { - [a, b..] => {}, - //~^ ERROR non-reference pattern used to match a reference - //~| HELP add #![feature(match_default_bindings)] to the crate attributes to enable - //~| HELP consider using - _ => panic!(), - } -} - -fn main() { - slice_pat("foo".as_bytes()); -} diff --git a/src/test/compile-fail/qualified-path-params-2.rs b/src/test/compile-fail/qualified-path-params-2.rs deleted file mode 100644 index e685ebc2720..00000000000 --- a/src/test/compile-fail/qualified-path-params-2.rs +++ /dev/null @@ -1,35 +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. - -// Check that qualified paths with type parameters -// fail during type checking and not during parsing - -struct S; - -trait Tr { - type A; -} - -impl Tr for S { - type A = S; -} - -impl S { - fn f<T>() {} -} - -type A = <S as Tr>::A::f<u8>; -//~^ ERROR type parameters are not allowed on this type -//~| NOTE type parameter not allowed -//~| ERROR ambiguous associated type -//~| NOTE ambiguous associated type -//~| NOTE specify the type using the syntax `<<S as Tr>::A as Trait>::f` - -fn main() {} diff --git a/src/test/compile-fail/region-borrow-params-issue-29793-small.rs b/src/test/compile-fail/region-borrow-params-issue-29793-small.rs deleted file mode 100644 index 18206a68515..00000000000 --- a/src/test/compile-fail/region-borrow-params-issue-29793-small.rs +++ /dev/null @@ -1,271 +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. - -// Issue #29793, small regression tests: do not let borrows of -// parameters to ever be returned (expanded with exploration of -// variations). - -// CLOSURES - -fn escaping_borrow_of_closure_params_1() { - let g = |x: usize, y:usize| { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR `x` does not live long enough - //~| ERROR `y` does not live long enough - //~| NOTE capture occurs here - //~| NOTE capture occurs here - //~| NOTE does not live long enough - //~| NOTE does not live long enough - //~| NOTE values in a scope are dropped in the opposite order they are created - //~| NOTE values in a scope are dropped in the opposite order they are created - return f; - }; - //~^ NOTE borrowed value dropped before borrower - //~| NOTE borrowed value dropped before borrower - - // We delberately do not call `g`; this small version of the test, - // after adding such a call, was (properly) rejected even when the - // system still suffered from issue #29793. - - // g(10, 20)(true); -} - -fn escaping_borrow_of_closure_params_2() { - let g = |x: usize, y:usize| { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR `x` does not live long enough - //~| ERROR `y` does not live long enough - //~| NOTE capture occurs here - //~| NOTE capture occurs here - //~| NOTE does not live long enough - //~| NOTE does not live long enough - //~| NOTE values in a scope are dropped in the opposite order they are created - //~| NOTE values in a scope are dropped in the opposite order they are created - f - }; - //~^ NOTE borrowed value dropped before borrower - //~| NOTE borrowed value dropped before borrower - - // (we don't call `g`; see above) -} - -fn move_of_closure_params() { - let g = |x: usize, y:usize| { - let f = move |t: bool| if t { x } else { y }; - f; - }; - // (this code is fine, so lets go ahead and ensure rustc accepts call of `g`) - (g(1,2)); -} - -fn ok_borrow_of_fn_params(a: usize, b:usize) { - let g = |x: usize, y:usize| { - let f = |t: bool| if t { a } else { b }; - return f; - }; - // (this code is fine, so lets go ahead and ensure rustc accepts call of `g`) - (g(1,2))(true); -} - -// TOP-LEVEL FN'S - -fn escaping_borrow_of_fn_params_1() { - fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` - //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` - return Box::new(f); - }; - - // (we don't call `g`; see above) -} - -fn escaping_borrow_of_fn_params_2() { - fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` - //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` - Box::new(f) - }; - - // (we don't call `g`; see above) -} - -fn move_of_fn_params() { - fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = move |t: bool| if t { x } else { y }; - return Box::new(f); - }; - // (this code is fine, so lets go ahead and ensure rustc accepts call of `g`) - (g(1,2))(true); -} - -// INHERENT METHODS - -fn escaping_borrow_of_method_params_1() { - struct S; - impl S { - fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` - //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` - return Box::new(f); - } - } - - // (we don't call `g`; see above) -} - -fn escaping_borrow_of_method_params_2() { - struct S; - impl S { - fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` - //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` - Box::new(f) - } - } - // (we don't call `g`; see above) -} - -fn move_of_method_params() { - struct S; - impl S { - fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = move |t: bool| if t { x } else { y }; - return Box::new(f); - } - } - // (this code is fine, so lets go ahead and ensure rustc accepts call of `g`) - (S.g(1,2))(true); -} - -// TRAIT IMPL METHODS - -fn escaping_borrow_of_trait_impl_params_1() { - trait T { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a>; } - struct S; - impl T for S { - fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` - //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` - return Box::new(f); - } - } - - // (we don't call `g`; see above) -} - -fn escaping_borrow_of_trait_impl_params_2() { - trait T { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a>; } - struct S; - impl T for S { - fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` - //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` - Box::new(f) - } - } - // (we don't call `g`; see above) -} - -fn move_of_trait_impl_params() { - trait T { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a>; } - struct S; - impl T for S { - fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = move |t: bool| if t { x } else { y }; - return Box::new(f); - } - } - // (this code is fine, so lets go ahead and ensure rustc accepts call of `g`) - (S.g(1,2))(true); -} - -// TRAIT DEFAULT METHODS - -fn escaping_borrow_of_trait_default_params_1() { - struct S; - trait T { - fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` - //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` - return Box::new(f); - } - } - impl T for S {} - // (we don't call `g`; see above) -} - -fn escaping_borrow_of_trait_default_params_2() { - struct S; - trait T { - fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) - //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` - //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` - Box::new(f) - } - } - impl T for S {} - // (we don't call `g`; see above) -} - -fn move_of_trait_default_params() { - struct S; - trait T { - fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { - let f = move |t: bool| if t { x } else { y }; - return Box::new(f); - } - } - impl T for S {} - // (this code is fine, so lets go ahead and ensure rustc accepts call of `g`) - (S.g(1,2))(true); -} - -fn main() { } - diff --git a/src/test/compile-fail/regions-nested-fns-2.rs b/src/test/compile-fail/regions-nested-fns-2.rs deleted file mode 100644 index 40ba34b26ed..00000000000 --- a/src/test/compile-fail/regions-nested-fns-2.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 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 ignore<F>(_f: F) where F: for<'z> FnOnce(&'z isize) -> &'z isize {} - -fn nested() { - let y = 3; - ignore( - |z| { - //~^ ERROR E0373 - //~| NOTE may outlive borrowed value `y` - if false { &y } else { z } - //~^ NOTE `y` is borrowed here - }); -} - -fn main() {} diff --git a/src/test/compile-fail/resolve-conflict-item-vs-import.rs b/src/test/compile-fail/resolve-conflict-item-vs-import.rs deleted file mode 100644 index c91657bb463..00000000000 --- a/src/test/compile-fail/resolve-conflict-item-vs-import.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 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. - -use std::mem::transmute; -//~^ NOTE previous import of the value `transmute` here - -fn transmute() {} -//~^ ERROR the name `transmute` is defined multiple times -//~| `transmute` redefined here -//~| `transmute` must be defined only once in the value namespace of this module -fn main() { -} diff --git a/src/test/compile-fail/resolve-inconsistent-names.rs b/src/test/compile-fail/resolve-inconsistent-names.rs deleted file mode 100644 index 7fee5aedb06..00000000000 --- a/src/test/compile-fail/resolve-inconsistent-names.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 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() { - let y = 1; - match y { - a | b => {} //~ ERROR variable `a` is not bound in all patterns - //~^ ERROR variable `b` is not bound in all patterns - //~| NOTE pattern doesn't bind `a` - //~| NOTE pattern doesn't bind `b` - //~| NOTE variable not in all patterns - //~| NOTE variable not in all patterns - } -} diff --git a/src/test/compile-fail/self-impl.rs b/src/test/compile-fail/self-impl.rs deleted file mode 100644 index 860e69fcaec..00000000000 --- a/src/test/compile-fail/self-impl.rs +++ /dev/null @@ -1,44 +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 unsupported uses of `Self` in impls don't crash - -struct Bar; - -trait Foo { - type Baz; -} - -trait SuperFoo { - type SuperBaz; -} - -impl Foo for Bar { - type Baz = bool; -} - -impl SuperFoo for Bar { - type SuperBaz = bool; -} - -impl Bar { - fn f() { - let _: <Self>::Baz = true; - //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `<Bar as Trait>::Baz` - let _: Self::Baz = true; - //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `<Bar as Trait>::Baz` - } -} - -fn main() {} diff --git a/src/test/compile-fail/shadowed-lifetime.rs b/src/test/compile-fail/shadowed-lifetime.rs deleted file mode 100644 index 31283623a3c..00000000000 --- a/src/test/compile-fail/shadowed-lifetime.rs +++ /dev/null @@ -1,38 +0,0 @@ -// 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. - -// Test that shadowed lifetimes generate an error. - -struct Foo<'a>(&'a isize); - -impl<'a> Foo<'a> { - //~^ NOTE first declared here - fn shadow_in_method<'a>(&'a self) -> &'a isize { - //~^ ERROR lifetime name `'a` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'a already in scope - self.0 - } - - fn shadow_in_type<'b>(&'b self) -> &'b isize { - //~^ NOTE first declared here - let x: for<'b> fn(&'b isize) = panic!(); - //~^ ERROR lifetime name `'b` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'b already in scope - self.0 - } - - fn not_shadow_in_item<'b>(&'b self) { - struct Bar<'a, 'b>(&'a isize, &'b isize); // not a shadow, separate item - fn foo<'a, 'b>(x: &'a isize, y: &'b isize) { } // same - } -} - -fn main() { -} diff --git a/src/test/compile-fail/str-concat-on-double-ref.rs b/src/test/compile-fail/str-concat-on-double-ref.rs deleted file mode 100644 index f85422f76d4..00000000000 --- a/src/test/compile-fail/str-concat-on-double-ref.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012-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 main() { - let a: &String = &"1".to_owned(); - let b: &str = &"2"; - let c = a + b; - //~^ ERROR binary operation `+` cannot be applied to type `&std::string::String` - //~| NOTE an implementation of `std::ops::Add` might be missing for `&std::string::String` - println!("{:?}", c); -} diff --git a/src/test/compile-fail/struct-fields-decl-dupe.rs b/src/test/compile-fail/struct-fields-decl-dupe.rs deleted file mode 100644 index dd9d7d29468..00000000000 --- a/src/test/compile-fail/struct-fields-decl-dupe.rs +++ /dev/null @@ -1,19 +0,0 @@ -// 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. - -struct BuildData { - foo: isize, //~ NOTE `foo` first declared here - foo: isize, - //~^ ERROR field `foo` is already declared [E0124] - //~| NOTE field already declared -} - -fn main() { -} diff --git a/src/test/compile-fail/struct-fields-hints-no-dupe.rs b/src/test/compile-fail/struct-fields-hints-no-dupe.rs deleted file mode 100644 index de78503d904..00000000000 --- a/src/test/compile-fail/struct-fields-hints-no-dupe.rs +++ /dev/null @@ -1,25 +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. - -struct A { - foo : i32, - car : i32, - barr : i32 -} - -fn main() { - let a = A { - foo : 5, - bar : 42, - //~^ ERROR struct `A` has no field named `bar` - //~| NOTE field does not exist - did you mean `barr`? - car : 9, - }; -} diff --git a/src/test/compile-fail/struct-fields-hints.rs b/src/test/compile-fail/struct-fields-hints.rs deleted file mode 100644 index 628f03f3272..00000000000 --- a/src/test/compile-fail/struct-fields-hints.rs +++ /dev/null @@ -1,24 +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. - -struct A { - foo : i32, - car : i32, - barr : i32 -} - -fn main() { - let a = A { - foo : 5, - bar : 42, - //~^ ERROR struct `A` has no field named `bar` - //~| NOTE field does not exist - did you mean `car`? - }; -} diff --git a/src/test/compile-fail/struct-fields-too-many.rs b/src/test/compile-fail/struct-fields-too-many.rs deleted file mode 100644 index b1af142ad0f..00000000000 --- a/src/test/compile-fail/struct-fields-too-many.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 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. - -struct BuildData { - foo: isize, -} - -fn main() { - let foo = BuildData { - foo: 0, - bar: 0 - //~^ ERROR struct `BuildData` has no field named `bar` - //~| NOTE `BuildData` does not have this field - //~| NOTE available fields are: `foo` - }; -} diff --git a/src/test/compile-fail/struct-path-self-type-mismatch.rs b/src/test/compile-fail/struct-path-self-type-mismatch.rs deleted file mode 100644 index ad568b41fcb..00000000000 --- a/src/test/compile-fail/struct-path-self-type-mismatch.rs +++ /dev/null @@ -1,36 +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. - -struct Foo<A> { inner: A } - -trait Bar { fn bar(); } - -impl Bar for Foo<i32> { - fn bar() { - Self { inner: 1.5f32 }; //~ ERROR mismatched types - //~^ NOTE expected i32, found f32 - } -} - -impl<T> Foo<T> { - fn new<U>(u: U) -> Foo<U> { //~ NOTE expected `Foo<U>` because of return type - Self { - //~^ ERROR mismatched types - //~| NOTE expected type parameter, found a different type parameter - //~| NOTE expected type `Foo<U>` - inner: u - //~^ ERROR mismatched types - //~| NOTE expected type parameter, found a different type parameter - //~| NOTE expected type `T` - } - } -} - -fn main() {} diff --git a/src/test/compile-fail/suggest-private-fields.rs b/src/test/compile-fail/suggest-private-fields.rs deleted file mode 100644 index d0752b5f02f..00000000000 --- a/src/test/compile-fail/suggest-private-fields.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 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:struct_field_privacy.rs - -extern crate struct_field_privacy as xc; - -use xc::B; - -struct A { - pub a: u32, - b: u32, -} - -fn main () { - // external crate struct - let k = B { - aa: 20, - //~^ ERROR struct `xc::B` has no field named `aa` - //~| NOTE field does not exist - did you mean `a`? - bb: 20, - //~^ ERROR struct `xc::B` has no field named `bb` - //~| NOTE `xc::B` does not have this field - //~| NOTE available fields are: `a` - }; - // local crate struct - let l = A { - aa: 20, - //~^ ERROR struct `A` has no field named `aa` - //~| NOTE field does not exist - did you mean `a`? - bb: 20, - //~^ ERROR struct `A` has no field named `bb` - //~| NOTE field does not exist - did you mean `b`? - }; -} diff --git a/src/test/compile-fail/svh-change-lit.rs b/src/test/compile-fail/svh-change-lit.rs deleted file mode 100644 index f24a3905cc3..00000000000 --- a/src/test/compile-fail/svh-change-lit.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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 FIXME #31306 - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-change-lit.rs - -extern crate a; -extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: - -fn main() { - b::foo() -} diff --git a/src/test/compile-fail/svh-change-significant-cfg.rs b/src/test/compile-fail/svh-change-significant-cfg.rs deleted file mode 100644 index 7a197fc6ae9..00000000000 --- a/src/test/compile-fail/svh-change-significant-cfg.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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 FIXME #31306 - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-change-significant-cfg.rs - -extern crate a; -extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: - -fn main() { - b::foo() -} diff --git a/src/test/compile-fail/svh-change-trait-bound.rs b/src/test/compile-fail/svh-change-trait-bound.rs deleted file mode 100644 index 560feb960f6..00000000000 --- a/src/test/compile-fail/svh-change-trait-bound.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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 FIXME #31306 - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-change-trait-bound.rs - -extern crate a; -extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: - -fn main() { - b::foo() -} diff --git a/src/test/compile-fail/svh-change-type-arg.rs b/src/test/compile-fail/svh-change-type-arg.rs deleted file mode 100644 index b8928c09562..00000000000 --- a/src/test/compile-fail/svh-change-type-arg.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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 FIXME #31306 - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-change-type-arg.rs - -extern crate a; -extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: - -fn main() { - b::foo() -} diff --git a/src/test/compile-fail/svh-change-type-ret.rs b/src/test/compile-fail/svh-change-type-ret.rs deleted file mode 100644 index 14973baafbd..00000000000 --- a/src/test/compile-fail/svh-change-type-ret.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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 FIXME #31306 - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-change-type-ret.rs - -extern crate a; -extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: - -fn main() { - b::foo() -} diff --git a/src/test/compile-fail/svh-change-type-static.rs b/src/test/compile-fail/svh-change-type-static.rs deleted file mode 100644 index cac95b4df8c..00000000000 --- a/src/test/compile-fail/svh-change-type-static.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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 FIXME #31306 - -// note that these aux-build directives must be in this order -// aux-build:svh-a-base.rs -// aux-build:svh-b.rs -// aux-build:svh-a-change-type-static.rs - -extern crate a; -extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: - -fn main() { - b::foo() -} diff --git a/src/test/compile-fail/svh-use-trait.rs b/src/test/compile-fail/svh-use-trait.rs deleted file mode 100644 index c875fa8a0b2..00000000000 --- a/src/test/compile-fail/svh-use-trait.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 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 FIXME #31306 - -// note that these aux-build directives must be in this order -// aux-build:svh-uta-base.rs -// aux-build:svh-utb.rs -// aux-build:svh-uta-change-use-trait.rs - -//! "compile-fail/svh-uta-trait.rs" is checking that we detect a -//! change from `use foo::TraitB` to use `foo::TraitB` in the hash -//! (SVH) computation (#14132), since that will affect method -//! resolution. - -extern crate uta; -extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends -//~| NOTE: perhaps that crate needs to be recompiled? -//~| NOTE: the following crate versions were found: - -fn main() { - utb::foo() -} diff --git a/src/test/compile-fail/trait-duplicate-methods.rs b/src/test/compile-fail/trait-duplicate-methods.rs deleted file mode 100644 index b8e628dd47a..00000000000 --- a/src/test/compile-fail/trait-duplicate-methods.rs +++ /dev/null @@ -1,18 +0,0 @@ -// 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. - -trait Foo { - fn orange(&self); //~ NOTE previous definition of the value `orange` here - fn orange(&self); //~ ERROR the name `orange` is defined multiple times - //~| NOTE `orange` redefined here -//~| NOTE `orange` must be defined only once in the value namespace of this trait -} - -fn main() {} diff --git a/src/test/compile-fail/trait-safety-fn-body.rs b/src/test/compile-fail/trait-safety-fn-body.rs deleted file mode 100644 index 65732a8ff69..00000000000 --- a/src/test/compile-fail/trait-safety-fn-body.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 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. - -// Check that an unsafe impl does not imply that unsafe actions are -// legal in the methods. - -unsafe trait UnsafeTrait : Sized { - fn foo(self) { } -} - -unsafe impl UnsafeTrait for *mut isize { - fn foo(self) { - // Unsafe actions are not made legal by taking place in an unsafe trait: - *self += 1; - //~^ ERROR E0133 - //~| NOTE dereference of raw pointer - } -} - -fn main() { } diff --git a/src/test/compile-fail/trait-suggest-where-clause.rs b/src/test/compile-fail/trait-suggest-where-clause.rs deleted file mode 100644 index 2c38d8d2e28..00000000000 --- a/src/test/compile-fail/trait-suggest-where-clause.rs +++ /dev/null @@ -1,69 +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. - -use std::mem; - -struct Misc<T:?Sized>(T); - -fn check<T: Iterator, U: ?Sized>() { - // suggest a where-clause, if needed - mem::size_of::<U>(); - //~^ ERROR `U: std::marker::Sized` is not satisfied - //~| HELP consider adding a `where U: std::marker::Sized` bound - //~| NOTE required by `std::mem::size_of` - //~| NOTE `U` does not have a constant size known at compile-time - //~| HELP the trait `std::marker::Sized` is not implemented for `U` - - mem::size_of::<Misc<U>>(); - //~^ ERROR `U: std::marker::Sized` is not satisfied - //~| HELP consider adding a `where U: std::marker::Sized` bound - //~| NOTE required because it appears within the type `Misc<U>` - //~| NOTE required by `std::mem::size_of` - //~| NOTE `U` does not have a constant size known at compile-time - //~| HELP within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U` - - // ... even if T occurs as a type parameter - - <u64 as From<T>>::from; - //~^ ERROR `u64: std::convert::From<T>` is not satisfied - //~| HELP consider adding a `where u64: std::convert::From<T>` bound - //~| NOTE required by `std::convert::From::from` - //~| NOTE the trait `std::convert::From<T>` is not implemented for `u64` - - <u64 as From<<T as Iterator>::Item>>::from; - //~^ ERROR `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied - //~| HELP consider adding a `where u64: - //~| NOTE required by `std::convert::From::from` - //~| NOTE the trait `std::convert::From<<T as std::iter::Iterator>::Item>` is not implemented - - // ... but not if there are inference variables - - <Misc<_> as From<T>>::from; - //~^ ERROR `Misc<_>: std::convert::From<T>` is not satisfied - //~| NOTE required by `std::convert::From::from` - //~| NOTE the trait `std::convert::From<T>` is not implemented for `Misc<_>` - - // ... and also not if the error is not related to the type - - mem::size_of::<[T]>(); - //~^ ERROR `[T]: std::marker::Sized` is not satisfied - //~| NOTE `[T]` does not have a constant size - //~| NOTE required by `std::mem::size_of` - //~| HELP the trait `std::marker::Sized` is not implemented for `[T]` - - mem::size_of::<[&U]>(); - //~^ ERROR `[&U]: std::marker::Sized` is not satisfied - //~| NOTE `[&U]` does not have a constant size - //~| NOTE required by `std::mem::size_of` - //~| HELP the trait `std::marker::Sized` is not implemented for `[&U]` -} - -fn main() { -} diff --git a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs b/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs deleted file mode 100644 index 2e115431c92..00000000000 --- a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014-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. - -// Check that we get an error in a multidisptach scenario where the -// set of impls is ambiguous. - -trait Convert<Target> { - fn convert(&self) -> Target; -} - -impl Convert<i8> for i32 { - fn convert(&self) -> i8 { - *self as i8 - } -} - -impl Convert<i16> for i32 { - fn convert(&self) -> i16 { - *self as i16 - } -} - -fn test<T,U>(_: T, _: U) -where T : Convert<U> -{ -} - -fn a() { - test(22, std::default::Default::default()); - //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `U` -} - -fn main() {} diff --git a/src/test/compile-fail/type-recursive.rs b/src/test/compile-fail/type-recursive.rs deleted file mode 100644 index 5dd76ce32c7..00000000000 --- a/src/test/compile-fail/type-recursive.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 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. - -struct t1 { //~ ERROR E0072 - //~| NOTE recursive type has infinite size - foo: isize, - foolish: t1 //~ NOTE recursive without indirection -} - -fn main() { } diff --git a/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs b/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs deleted file mode 100644 index 0d98e044ab0..00000000000 --- a/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs +++ /dev/null @@ -1,35 +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. - -fn foo1<T:Copy<U>, U>(x: T) {} -//~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments - -trait Trait: Copy<Send> {} -//~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments - -struct MyStruct1<T: Copy<T>>; -//~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments - -struct MyStruct2<'a, T: Copy<'a>>; -//~^ ERROR: wrong number of lifetime parameters: expected 0, found 1 -//~| NOTE unexpected lifetime parameter - - -fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} -//~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments -//~| ERROR: wrong number of lifetime parameters: expected 0, found 1 -//~| NOTE unexpected lifetime parameter - -fn main() { -} diff --git a/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs b/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs deleted file mode 100644 index da3e926d6fc..00000000000 --- a/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs +++ /dev/null @@ -1,16 +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. - -#![feature(optin_builtin_traits)] - -#[allow(auto_impl)] -impl Copy for .. {} //~ ERROR E0318 - //~^ NOTE `Copy` trait not defined in this crate -fn main() {} diff --git a/src/test/compile-fail/typeck_type_placeholder_item.rs b/src/test/compile-fail/typeck_type_placeholder_item.rs deleted file mode 100644 index 42db3b47a04..00000000000 --- a/src/test/compile-fail/typeck_type_placeholder_item.rs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2014 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. - -// This test checks that it is not possible to enable global type -// inference by using the `_` type placeholder. - -fn test() -> _ { 5 } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures - -fn test2() -> (_, _) { (5, 5) } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures -//~| NOTE not allowed in type signatures - -static TEST3: _ = "test"; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures - -static TEST4: _ = 145; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures - -static TEST5: (_, _) = (1, 2); -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures -//~| NOTE not allowed in type signatures - -fn test6(_: _) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures - -fn test7(x: _) { let _x: usize = x; } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures - -fn test8(_f: fn() -> _) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures - -struct Test9; - -impl Test9 { - fn test9(&self) -> _ { () } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - fn test10(&self, _x : _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures -} - -impl Clone for Test9 { - fn clone(&self) -> _ { Test9 } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - fn clone_from(&mut self, other: _) { *self = Test9; } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures -} - -struct Test10 { - a: _, - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - b: (_, _), - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures -} - -pub fn main() { - fn fn_test() -> _ { 5 } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - fn fn_test2() -> (_, _) { (5, 5) } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures - - static FN_TEST3: _ = "test"; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - static FN_TEST4: _ = 145; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - static FN_TEST5: (_, _) = (1, 2); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures - - fn fn_test6(_: _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - fn fn_test7(x: _) { let _x: usize = x; } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - fn fn_test8(_f: fn() -> _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - struct FnTest9; - - impl FnTest9 { - fn fn_test9(&self) -> _ { () } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - fn fn_test10(&self, _x : _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - } - - impl Clone for FnTest9 { - fn clone(&self) -> _ { FnTest9 } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - - fn clone_from(&mut self, other: _) { *self = FnTest9; } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - } - - struct FnTest10 { - a: _, - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - b: (_, _), - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures - } - -} diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs b/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs deleted file mode 100644 index ad57752b6f7..00000000000 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 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. - -// This test checks that the `_` type placeholder does not react -// badly if put as a lifetime parameter. - -struct Foo<'a, T:'a> { - r: &'a T -} - -pub fn main() { - let c: Foo<_, _> = Foo { r: &5 }; - //~^ ERROR wrong number of type arguments: expected 1, found 2 [E0244] - //~| NOTE expected 1 type argument -} diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs b/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs deleted file mode 100644 index f1ecad0056e..00000000000 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 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. - -// This test checks that the `_` type placeholder does not react -// badly if put as a lifetime parameter. - -struct Foo<'a, T:'a> { - r: &'a T -} - -pub fn main() { - let c: Foo<_, usize> = Foo { r: &5 }; - //~^ ERROR wrong number of type arguments: expected 1, found 2 [E0244] - //~| NOTE expected 1 type argument -} diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs deleted file mode 100644 index 95d78c07501..00000000000 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 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(unboxed_closures)] - -trait Trait {} - -fn f<F:Trait(isize) -> isize>(x: F) {} -//~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments -//~| ERROR E0220 -//~| NOTE associated type `Output` not found - -fn main() {} diff --git a/src/test/compile-fail/unconstrained-none.rs b/src/test/compile-fail/unconstrained-none.rs deleted file mode 100644 index 52ca91e62f8..00000000000 --- a/src/test/compile-fail/unconstrained-none.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013-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. - -// Issue #5062 - -fn main() { - None; //~ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `T` -} diff --git a/src/test/compile-fail/unconstrained-ref.rs b/src/test/compile-fail/unconstrained-ref.rs deleted file mode 100644 index 6aaed789716..00000000000 --- a/src/test/compile-fail/unconstrained-ref.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012-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. - -struct S<'a, T:'a> { - o: &'a Option<T> -} - -fn main() { - S { o: &None }; //~ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `T` -} diff --git a/src/test/compile-fail/union/union-const-eval.rs b/src/test/compile-fail/union/union-const-eval.rs deleted file mode 100644 index 73b7743fc45..00000000000 --- a/src/test/compile-fail/union/union-const-eval.rs +++ /dev/null @@ -1,26 +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. - -union U { - a: usize, - b: usize, -} - -const C: U = U { a: 10 }; - -fn main() { - unsafe { - let a: [u8; C.a]; // OK - let b: [u8; C.b]; //~ ERROR constant evaluation error - //~^ NOTE nonexistent struct field - //~| WARNING constant evaluation error - //~| NOTE on by default - } -} diff --git a/src/test/compile-fail/union/union-derive-eq.rs b/src/test/compile-fail/union/union-derive-eq.rs deleted file mode 100644 index 9dfec288c15..00000000000 --- a/src/test/compile-fail/union/union-derive-eq.rs +++ /dev/null @@ -1,30 +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. - -#![feature(untagged_unions)] - -#[derive(Eq)] // OK -union U1 { - a: u8, -} - -impl PartialEq for U1 { fn eq(&self, rhs: &Self) -> bool { true } } - -#[derive(PartialEq)] -struct PartialEqNotEq; - -#[derive(Eq)] -union U2 { - a: PartialEqNotEq, //~ ERROR the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied -} - -impl PartialEq for U2 { fn eq(&self, rhs: &Self) -> bool { true } } - -fn main() {} diff --git a/src/test/compile-fail/union/union-fields.rs b/src/test/compile-fail/union/union-fields.rs deleted file mode 100644 index 124b16f99b1..00000000000 --- a/src/test/compile-fail/union/union-fields.rs +++ /dev/null @@ -1,36 +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. - -union U { - a: u8, - b: u16, -} - -fn main() { - let u = U {}; //~ ERROR union expressions should have exactly one field - let u = U { a: 0 }; // OK - let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field - let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field - //~^ ERROR union `U` has no field named `c` - //~| NOTE `U` does not have this field - //~| NOTE available fields are: `a`, `b` - let u = U { ..u }; //~ ERROR union expressions should have exactly one field - //~^ ERROR functional record update syntax requires a struct - - let U {} = u; //~ ERROR union patterns should have exactly one field - let U { a } = u; // OK - let U { a, b } = u; //~ ERROR union patterns should have exactly one field - let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field - //~^ ERROR union `U` does not have a field named `c` - //~| NOTE union `U` does not have field `c` - let U { .. } = u; //~ ERROR union patterns should have exactly one field - //~^ ERROR `..` cannot be used in union patterns - let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns -} diff --git a/src/test/compile-fail/union/union-suggest-field.rs b/src/test/compile-fail/union/union-suggest-field.rs deleted file mode 100644 index 65c7c980b8a..00000000000 --- a/src/test/compile-fail/union/union-suggest-field.rs +++ /dev/null @@ -1,28 +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. - -union U { - principal: u8, -} - -impl U { - fn calculate(&self) {} -} - -fn main() { - let u = U { principle: 0 }; - //~^ ERROR union `U` has no field named `principle` - //~| NOTE field does not exist - did you mean `principal`? - let w = u.principial; //~ ERROR no field `principial` on type `U` - //~^ did you mean `principal`? - - let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` - //~^ HELP maybe a `()` to call it is missing? -} diff --git a/src/test/compile-fail/unsafe-const-fn.rs b/src/test/compile-fail/unsafe-const-fn.rs deleted file mode 100644 index 91e16592be4..00000000000 --- a/src/test/compile-fail/unsafe-const-fn.rs +++ /dev/null @@ -1,26 +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. - -// A quick test of 'unsafe const fn' functionality - -#![feature(const_fn)] - -const unsafe fn dummy(v: u32) -> u32 { - !v -} - -const VAL: u32 = dummy(0xFFFF); -//~^ ERROR E0133 -//~| NOTE call to unsafe function - -fn main() { - assert_eq!(VAL, 0xFFFF0000); -} - diff --git a/src/test/compile-fail/unsized-enum2.rs b/src/test/compile-fail/unsized-enum2.rs deleted file mode 100644 index 95fc3243fbe..00000000000 --- a/src/test/compile-fail/unsized-enum2.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 206 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. - -use std::ops::Deref; - -// Due to aggressive error message deduplication, we require 20 *different* -// unsized types (even Path and [u8] are considered the "same"). - -trait Foo {} -trait Bar {} -trait FooBar {} -trait BarFoo {} - -trait PathHelper1 {} -trait PathHelper2 {} -trait PathHelper3 {} -trait PathHelper4 {} - -struct Path1(PathHelper1); -struct Path2(PathHelper2); -struct Path3(PathHelper3); -struct Path4(PathHelper4); - -enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> { - // parameter - VA(W), //~ ERROR `W: std::marker::Sized` is not satisfied - VB{x: X}, //~ ERROR `X: std::marker::Sized` is not satisfied - VC(isize, Y), //~ ERROR `Y: std::marker::Sized` is not satisfied - VD{u: isize, x: Z}, //~ ERROR `Z: std::marker::Sized` is not satisfied - - // slice / str - VE([u8]), //~ ERROR `[u8]: std::marker::Sized` is not satisfied - VF{x: str}, //~ ERROR `str: std::marker::Sized` is not satisfied - VG(isize, [f32]), //~ ERROR `[f32]: std::marker::Sized` is not satisfied - VH{u: isize, x: [u32]}, //~ ERROR `[u32]: std::marker::Sized` is not satisfied - - // unsized struct - VI(Path1), //~ ERROR `PathHelper1 + 'static: std::marker::Sized` is not satisfied - VJ{x: Path2}, //~ ERROR `PathHelper2 + 'static: std::marker::Sized` is not satisfied - VK(isize, Path3), //~ ERROR `PathHelper3 + 'static: std::marker::Sized` is not satisfied - VL{u: isize, x: Path4}, //~ ERROR `PathHelper4 + 'static: std::marker::Sized` is not satisfied - - // plain trait - VM(Foo), //~ ERROR `Foo + 'static: std::marker::Sized` is not satisfied - VN{x: Bar}, //~ ERROR `Bar + 'static: std::marker::Sized` is not satisfied - VO(isize, FooBar), //~ ERROR `FooBar + 'static: std::marker::Sized` is not satisfied - VP{u: isize, x: BarFoo}, //~ ERROR `BarFoo + 'static: std::marker::Sized` is not satisfied - - // projected - VQ(<&'static [i8] as Deref>::Target), //~ ERROR `[i8]: std::marker::Sized` is not satisfied - VR{x: <&'static [char] as Deref>::Target}, - //~^ ERROR `[char]: std::marker::Sized` is not satisfied - VS(isize, <&'static [f64] as Deref>::Target), - //~^ ERROR `[f64]: std::marker::Sized` is not satisfied - VT{u: isize, x: <&'static [i32] as Deref>::Target}, - //~^ ERROR `[i32]: std::marker::Sized` is not satisfied -} - - -fn main() { } - diff --git a/src/test/compile-fail/use-mod.rs b/src/test/compile-fail/use-mod.rs deleted file mode 100644 index 485a75f0f91..00000000000 --- a/src/test/compile-fail/use-mod.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 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. - -use foo::bar::{ - self, -//~^ ERROR `self` import can only appear once in the list -//~^^ NOTE previous import of the module `bar` here - Bar, - self -//~^ NOTE another `self` import appears here -//~| ERROR the name `bar` is defined multiple times -//~| NOTE `bar` reimported here -//~| NOTE `bar` must be defined only once in the type namespace of this module -}; - -use {self}; -//~^ ERROR `self` import can only appear in an import list with a non-empty prefix - -mod foo { - pub mod bar { - pub struct Bar; - pub struct Baz; - } -} - -fn main() {} diff --git a/src/test/compile-fail/variadic-ffi-3.rs b/src/test/compile-fail/variadic-ffi-3.rs deleted file mode 100644 index fb102027180..00000000000 --- a/src/test/compile-fail/variadic-ffi-3.rs +++ /dev/null @@ -1,45 +0,0 @@ -// 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. - -extern { - fn foo(f: isize, x: u8, ...); - //~^ defined here - //~| defined here -} - -extern "C" fn bar(f: isize, x: u8) {} - -fn main() { - unsafe { - foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied - //~| NOTE expected at least 2 parameters - foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied - //~| NOTE expected at least 2 parameters - - let x: unsafe extern "C" fn(f: isize, x: u8) = foo; - //~^ ERROR: mismatched types - //~| expected type `unsafe extern "C" fn(isize, u8)` - //~| found type `unsafe extern "C" fn(isize, u8, ...) {foo}` - //~| NOTE: expected non-variadic fn, found variadic function - - let y: extern "C" fn(f: isize, x: u8, ...) = bar; - //~^ ERROR: mismatched types - //~| expected type `extern "C" fn(isize, u8, ...)` - //~| found type `extern "C" fn(isize, u8) {bar}` - //~| NOTE: expected variadic fn, found non-variadic function - - foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function, cast to `c_double` - foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function, cast to `c_int` - foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function, cast to `c_int` - foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function, cast to `c_uint` - foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function, cast to `c_int` - foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function, cast to `c_uint` - } -} diff --git a/src/test/compile-fail/variance-unused-type-param.rs b/src/test/compile-fail/variance-unused-type-param.rs deleted file mode 100644 index 862d842d62c..00000000000 --- a/src/test/compile-fail/variance-unused-type-param.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 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(dead_code)] - -// Test that we report an error for unused type parameters in types and traits, -// and that we offer a helpful suggestion. - -struct SomeStruct<A> { x: u32 } -//~^ ERROR parameter `A` is never used -//~| HELP PhantomData - -enum SomeEnum<A> { Nothing } -//~^ ERROR parameter `A` is never used -//~| HELP PhantomData - -// Here T might *appear* used, but in fact it isn't. -enum ListCell<T> { -//~^ ERROR parameter `T` is never used -//~| HELP PhantomData - Cons(Box<ListCell<T>>), - Nil -} - -fn main() {} diff --git a/src/test/compile-fail/vector-no-ann.rs b/src/test/compile-fail/vector-no-ann.rs deleted file mode 100644 index de229ded463..00000000000 --- a/src/test/compile-fail/vector-no-ann.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012-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. - - -fn main() { - let _foo = Vec::new(); - //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `T` - //~| NOTE consider giving `_foo` a type -} |
