From: Alexander Regueiro Date: Mon, 5 Nov 2018 04:00:03 +0000 (+0000) Subject: Moved and renamed ui issue tests. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;ds=sidebyside;h=a1c4060c9daf800e50016f67821baff4088fb19e;p=rust.git Moved and renamed ui issue tests. --- diff --git a/src/test/ui/issue-40827.rs b/src/test/ui/issue-40827.rs deleted file mode 100644 index 4b079ace3ca..00000000000 --- a/src/test/ui/issue-40827.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::rc::Rc; -use std::sync::Arc; - -struct Foo(Arc); - -enum Bar { - A(Rc), - B(Option), -} - -fn f(_: T) {} - -fn main() { - f(Foo(Arc::new(Bar::B(None)))); - //~^ ERROR E0277 - //~| ERROR E0277 -} diff --git a/src/test/ui/issue-40827.stderr b/src/test/ui/issue-40827.stderr deleted file mode 100644 index dd0ebf96d19..00000000000 --- a/src/test/ui/issue-40827.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0277]: `std::rc::Rc` cannot be sent between threads safely - --> $DIR/issue-40827.rs:24:5 - | -LL | f(Foo(Arc::new(Bar::B(None)))); - | ^ `std::rc::Rc` cannot be sent between threads safely - | - = help: within `Bar`, the trait `std::marker::Send` is not implemented for `std::rc::Rc` - = note: required because it appears within the type `Bar` - = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc` - = note: required because it appears within the type `Foo` -note: required by `f` - --> $DIR/issue-40827.rs:21:1 - | -LL | fn f(_: T) {} - | ^^^^^^^^^^^^^^^^^^^ - -error[E0277]: `std::rc::Rc` cannot be shared between threads safely - --> $DIR/issue-40827.rs:24:5 - | -LL | f(Foo(Arc::new(Bar::B(None)))); - | ^ `std::rc::Rc` cannot be shared between threads safely - | - = help: within `Bar`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc` - = note: required because it appears within the type `Bar` - = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc` - = note: required because it appears within the type `Foo` -note: required by `f` - --> $DIR/issue-40827.rs:21:1 - | -LL | fn f(_: T) {} - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issue-49556.rs b/src/test/ui/issue-49556.rs deleted file mode 100644 index 7f7b349c3a0..00000000000 --- a/src/test/ui/issue-49556.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-pass -fn iter<'a>(data: &'a [usize]) -> impl Iterator + 'a { - data.iter() - .map( - |x| x // fn(&'a usize) -> &'(ReScope) usize - ) - .map( - |x| *x // fn(&'(ReScope) usize) -> usize - ) -} - -fn main() { -} diff --git a/src/test/ui/issue-51602.rs b/src/test/ui/issue-51602.rs deleted file mode 100644 index a3edecb94f7..00000000000 --- a/src/test/ui/issue-51602.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main(){ - if i in 1..10 { - break; - } -} diff --git a/src/test/ui/issue-51602.stderr b/src/test/ui/issue-51602.stderr deleted file mode 100644 index d50ee64cf52..00000000000 --- a/src/test/ui/issue-51602.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: expected `{`, found keyword `in` - --> $DIR/issue-51602.rs:12:10 - | -LL | if i in 1..10 { - | -- ^^ expected `{` - | | - | this `if` statement has a condition, but no block - -error: aborting due to previous error - diff --git a/src/test/ui/issue-52717.rs b/src/test/ui/issue-52717.rs deleted file mode 100644 index d40e2bd3d53..00000000000 --- a/src/test/ui/issue-52717.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -enum A { - A { - foo: usize, - } -} - -fn main() { - let x = A::A { foo: 3 }; - match x { - A::A { fob } => { println!("{}", fob); } - } -} diff --git a/src/test/ui/issue-52717.stderr b/src/test/ui/issue-52717.stderr deleted file mode 100644 index 0ef5a84671d..00000000000 --- a/src/test/ui/issue-52717.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0026]: variant `A::A` does not have a field named `fob` - --> $DIR/issue-52717.rs:19:12 - | -LL | A::A { fob } => { println!("{}", fob); } - | ^^^ - | | - | variant `A::A` does not have this field - | help: did you mean: `foo` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0026`. diff --git a/src/test/ui/issue-52992.rs b/src/test/ui/issue-52992.rs deleted file mode 100644 index 2ece0ee9fee..00000000000 --- a/src/test/ui/issue-52992.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Regression test for an NLL-related ICE (#52992) -- computing -// implied bounds was causing outlives relations that were not -// properly handled. -// -// compile-pass - -#![feature(nll)] - -fn main() {} - -fn fail<'a>() -> Struct<'a, Generic<()>> { - Struct(&Generic(())) -} - -struct Struct<'a, T>(&'a T) where - T: Trait + 'a, - T::AT: 'a; // only fails with this bound - -struct Generic(T); - -trait Trait { - type AT; -} - -impl Trait for Generic { - type AT = T; // only fails with a generic AT -} diff --git a/src/test/ui/issue-53251.rs b/src/test/ui/issue-53251.rs deleted file mode 100644 index 8c75ea45a61..00000000000 --- a/src/test/ui/issue-53251.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct S; - -impl S { - fn f() {} -} - -macro_rules! impl_add { - ($($n:ident)*) => { - $( - fn $n() { - S::f::(); - //~^ ERROR wrong number of type arguments - } - )* - } -} - -impl_add!(a b); - -fn main() {} diff --git a/src/test/ui/issue-53251.stderr b/src/test/ui/issue-53251.stderr deleted file mode 100644 index 51ea745bedb..00000000000 --- a/src/test/ui/issue-53251.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/issue-53251.rs:21:24 - | -LL | S::f::(); - | ^^^ unexpected type argument -... -LL | impl_add!(a b); - | --------------- in this macro invocation - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/issue-53300.rs b/src/test/ui/issue-53300.rs deleted file mode 100644 index d055a6f12c1..00000000000 --- a/src/test/ui/issue-53300.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// issue 53300 - -pub trait A { - fn add(&self, b: i32) -> i32; -} - -fn addition() -> Wrapper {} -//~^ ERROR cannot find type `Wrapper` in this scope [E0412] - -fn main() { - let res = addition(); -} diff --git a/src/test/ui/issue-53300.stderr b/src/test/ui/issue-53300.stderr deleted file mode 100644 index 920287a32d6..00000000000 --- a/src/test/ui/issue-53300.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0412]: cannot find type `Wrapper` in this scope - --> $DIR/issue-53300.rs:17:18 - | -LL | fn addition() -> Wrapper {} - | ^^^^^^^ not found in this scope - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/issue-53419.rs b/src/test/ui/issue-53419.rs deleted file mode 100644 index 0dd5a851285..00000000000 --- a/src/test/ui/issue-53419.rs +++ /dev/null @@ -1,19 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//compile-pass - -struct Foo { - bar: for<'r> Fn(usize, &'r FnMut()) -} - -fn main() { -} - diff --git a/src/test/ui/issue-53565.rs b/src/test/ui/issue-53565.rs deleted file mode 100644 index 2bf38296f26..00000000000 --- a/src/test/ui/issue-53565.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -use std::time::{foo, bar, buzz}; -use std::time::{abc, def}; -fn main(){ - println!("Hello World!"); -} diff --git a/src/test/ui/issue-53565.stderr b/src/test/ui/issue-53565.stderr deleted file mode 100644 index 945f5efe4a8..00000000000 --- a/src/test/ui/issue-53565.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0432]: unresolved imports `std::time::foo`, `std::time::bar`, `std::time::buzz` - --> $DIR/issue-53565.rs:10:17 - | -LL | use std::time::{foo, bar, buzz}; - | ^^^ ^^^ ^^^^ no `buzz` in `time` - | | | - | | no `bar` in `time` - | no `foo` in `time` - -error[E0432]: unresolved imports `std::time::abc`, `std::time::def` - --> $DIR/issue-53565.rs:11:17 - | -LL | use std::time::{abc, def}; - | ^^^ ^^^ no `def` in `time` - | | - | no `abc` in `time` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/issue-53568.rs b/src/test/ui/issue-53568.rs deleted file mode 100644 index 6b479f75172..00000000000 --- a/src/test/ui/issue-53568.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Regression test for an NLL-related ICE (#53568) -- we failed to -// resolve inference variables in "custom type-ops". -// -// compile-pass - -#![feature(nll)] -#![allow(dead_code)] - -trait Future { - type Item; -} - -impl Future for F -where F: Fn() -> T -{ - type Item = T; -} - -trait Connect {} - -struct Connector { - handler: H, -} - -impl Connect for Connector -where - T: 'static, - H: Future -{ -} - -struct Client { - connector: C, -} - -fn build(_connector: C) -> Client { - unimplemented!() -} - -fn client(handler: H) -> Client -where H: Fn() + Copy -{ - let connector = Connector { - handler, - }; - let client = build(connector); - client -} - -fn main() { } - diff --git a/src/test/ui/issue-53692.rs b/src/test/ui/issue-53692.rs deleted file mode 100644 index 0b6cc36fa52..00000000000 --- a/src/test/ui/issue-53692.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -fn main() { - let items = vec![1, 2, 3]; - let ref_items: &[i32] = &items; - let items_clone: Vec = ref_items.clone(); - - // in that case no suggestion will be triggered - let items_clone_2:Vec = items.clone(); - - let s = "hi"; - let string: String = s.clone(); - - // in that case no suggestion will be triggered - let s2 = "hi"; - let string_2: String = s2.to_string(); -} diff --git a/src/test/ui/issue-53692.stderr b/src/test/ui/issue-53692.stderr deleted file mode 100644 index 9cd8a536155..00000000000 --- a/src/test/ui/issue-53692.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-53692.rs:13:37 - | -LL | let items_clone: Vec = ref_items.clone(); - | ^^^^^^^^^^^^^^^^^ - | | - | expected struct `std::vec::Vec`, found &[i32] - | help: try using a conversion method: `ref_items.to_vec()` - | - = note: expected type `std::vec::Vec` - found type `&[i32]` - -error[E0308]: mismatched types - --> $DIR/issue-53692.rs:19:30 - | -LL | let string: String = s.clone(); - | ^^^^^^^^^ - | | - | expected struct `std::string::String`, found &str - | help: try using a conversion method: `s.to_string()` - | - = note: expected type `std::string::String` - found type `&str` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issue-53840.rs b/src/test/ui/issue-53840.rs deleted file mode 100644 index ece3caf78e2..00000000000 --- a/src/test/ui/issue-53840.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -enum E { - Foo(String, String, String), -} - -struct Bar { - a: String, - b: String, -} - -fn main() { - let bar = Bar { a: "1".to_string(), b: "2".to_string() }; - match E::Foo("".into(), "".into(), "".into()) { - E::Foo(a, b, ref c) => {} - } - match bar { - Bar {a, ref b} => {} - } -} diff --git a/src/test/ui/issue-53840.stderr b/src/test/ui/issue-53840.stderr deleted file mode 100644 index 961e4c0ff62..00000000000 --- a/src/test/ui/issue-53840.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/issue-53840.rs:22:16 - | -LL | E::Foo(a, b, ref c) => {} - | ^ ^ ----- both by-ref and by-move used - | | | - | | by-move pattern here - | by-move pattern here - -error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/issue-53840.rs:25:14 - | -LL | Bar {a, ref b} => {} - | ^ ----- both by-ref and by-move used - | | - | by-move pattern here - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0009`. diff --git a/src/test/ui/issue-54302-cases.rs b/src/test/ui/issue-54302-cases.rs deleted file mode 100644 index 6d1c61c80f0..00000000000 --- a/src/test/ui/issue-54302-cases.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait Mirror { - type Image; - fn coerce(self) -> Self::Image; -} - -impl Mirror for T { - type Image = T; - fn coerce(self) -> Self { self } -} - -trait Foo<'x, T> { - fn foo(self) -> &'x T; -} - -impl<'s, 'x, T: 'x> Foo<'x, T> for &'s T where &'s T: Foo2<'x, T> { - fn foo(self) -> &'x T { self.foo2() } -} - -trait Foo2<'x, T> { - fn foo2(self) -> &'x T; -} - -// example 1 - fails leak check -impl<'x> Foo2<'x, u32> for &'x u32 -{ - fn foo2(self) -> &'x u32 { self } -} - -// example 2 - OK with this issue -impl<'x, 'a: 'x> Foo2<'x, i32> for &'a i32 -{ - fn foo2(self) -> &'x i32 { self } -} - -// example 3 - fails due to issue #XYZ + Leak-check -impl<'x, T> Foo2<'x, u64> for T - where T: Mirror -{ - fn foo2(self) -> &'x u64 { self.coerce() } -} - -// example 4 - fails due to issue #XYZ -impl<'x, 'a: 'x, T> Foo2<'x, i64> for T - where T: Mirror -{ - fn foo2(self) -> &'x i64 { self.coerce() } -} - - -trait RefFoo { - fn ref_foo(&self) -> &'static T; -} - -impl RefFoo for T where for<'a> &'a T: Foo<'static, T> { - fn ref_foo(&self) -> &'static T { - self.foo() - } -} - - -fn coerce_lifetime1(a: &u32) -> &'static u32 -{ - >::ref_foo(a) - //~^ ERROR the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied -} - -fn coerce_lifetime2(a: &i32) -> &'static i32 -{ - >::ref_foo(a) - //~^ ERROR the requirement `for<'a> 'a : ` is not satisfied -} - -fn coerce_lifetime3(a: &u64) -> &'static u64 -{ - >::ref_foo(a) - //~^ ERROR type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64` -} - -fn coerce_lifetime4(a: &i64) -> &'static i64 -{ - >::ref_foo(a) - //~^ ERROR type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64` -} - -fn main() {} diff --git a/src/test/ui/issue-54302-cases.stderr b/src/test/ui/issue-54302-cases.stderr deleted file mode 100644 index 9603f7a973c..00000000000 --- a/src/test/ui/issue-54302-cases.stderr +++ /dev/null @@ -1,65 +0,0 @@ -error[E0277]: the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied - --> $DIR/issue-54302-cases.rs:73:5 - | -LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo2<'_, u32>` is not implemented for `&'a u32` - | - = help: the following implementations were found: - <&'x u32 as Foo2<'x, u32>> - = note: required because of the requirements on the impl of `for<'a> Foo<'static, u32>` for `&'a u32` - = note: required because of the requirements on the impl of `RefFoo` for `u32` -note: required by `RefFoo::ref_foo` - --> $DIR/issue-54302-cases.rs:61:5 - | -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0279]: the requirement `for<'a> 'a : ` is not satisfied (`expected bound lifetime parameter 'a, found concrete lifetime`) - --> $DIR/issue-54302-cases.rs:79:5 - | -LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i32>` for `&'a i32` - = note: required because of the requirements on the impl of `for<'a> Foo<'static, i32>` for `&'a i32` - = note: required because of the requirements on the impl of `RefFoo` for `i32` -note: required by `RefFoo::ref_foo` - --> $DIR/issue-54302-cases.rs:61:5 - | -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0271]: type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64` - --> $DIR/issue-54302-cases.rs:85:5 - | -LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime - | - = note: required because of the requirements on the impl of `for<'a> Foo2<'_, u64>` for `&'a u64` - = note: required because of the requirements on the impl of `for<'a> Foo<'static, u64>` for `&'a u64` - = note: required because of the requirements on the impl of `RefFoo` for `u64` -note: required by `RefFoo::ref_foo` - --> $DIR/issue-54302-cases.rs:61:5 - | -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0271]: type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64` - --> $DIR/issue-54302-cases.rs:91:5 - | -LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime - | - = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i64>` for `&'a i64` - = note: required because of the requirements on the impl of `for<'a> Foo<'static, i64>` for `&'a i64` - = note: required because of the requirements on the impl of `RefFoo` for `i64` -note: required by `RefFoo::ref_foo` - --> $DIR/issue-54302-cases.rs:61:5 - | -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors - -Some errors occurred: E0271, E0277, E0279. -For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/issue-54302.rs b/src/test/ui/issue-54302.rs deleted file mode 100644 index 969d19cac2d..00000000000 --- a/src/test/ui/issue-54302.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait Deserialize<'de> {} - -trait DeserializeOwned: for<'de> Deserialize<'de> {} -impl DeserializeOwned for T where T: for<'de> Deserialize<'de> {} - -// Based on this impl, `&'static str` only implements Deserialize<'static>. -// It does not implement for<'de> Deserialize<'de>. -impl<'de: 'a, 'a> Deserialize<'de> for &'a str {} - -fn main() { - // Then why does it implement DeserializeOwned? This compiles. - fn assert_deserialize_owned() {} - assert_deserialize_owned::<&'static str>(); - //~^ ERROR the requirement `for<'de> 'de : ` is not satisfied - - // It correctly does not implement for<'de> Deserialize<'de>. - //fn assert_hrtb Deserialize<'de>>() {} - //assert_hrtb::<&'static str>(); -} diff --git a/src/test/ui/issue-54302.stderr b/src/test/ui/issue-54302.stderr deleted file mode 100644 index f122daeecf6..00000000000 --- a/src/test/ui/issue-54302.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0279]: the requirement `for<'de> 'de : ` is not satisfied (`expected bound lifetime parameter 'de, found concrete lifetime`) - --> $DIR/issue-54302.rs:23:5 - | -LL | assert_deserialize_owned::<&'static str>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: required because of the requirements on the impl of `for<'de> Deserialize<'de>` for `&'static str` - = note: required because of the requirements on the impl of `DeserializeOwned` for `&'static str` -note: required by `main::assert_deserialize_owned` - --> $DIR/issue-54302.rs:22:5 - | -LL | fn assert_deserialize_owned() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0279`. diff --git a/src/test/ui/issues/auxiliary/issue-11680.rs b/src/test/ui/issues/auxiliary/issue-11680.rs new file mode 100644 index 00000000000..18f78750b15 --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-11680.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum Foo { + Bar(isize) +} + +pub mod test { + enum Foo { + Bar(isize) + } +} diff --git a/src/test/ui/issues/auxiliary/issue-16725.rs b/src/test/ui/issues/auxiliary/issue-16725.rs new file mode 100644 index 00000000000..b3b04b4a5ac --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-16725.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern { + fn bar(); +} diff --git a/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs b/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs new file mode 100644 index 00000000000..3901d73382f --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use foo::FOO2; + +pub const FOO: usize = 3; +const BAR: usize = 3; + +mod foo { + pub const FOO2: usize = 3; +} diff --git a/src/test/ui/issues/auxiliary/issue-1920.rs b/src/test/ui/issues/auxiliary/issue-1920.rs new file mode 100644 index 00000000000..55065174ca7 --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-1920.rs @@ -0,0 +1,14 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Just exporting some type to test for correct diagnostics when this +// crate is pulled in at a non-root location in client crate. + +pub struct S; diff --git a/src/test/ui/issues/auxiliary/issue-21202.rs b/src/test/ui/issues/auxiliary/issue-21202.rs new file mode 100644 index 00000000000..afdbf78aa82 --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-21202.rs @@ -0,0 +1,16 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod A { + pub struct Foo; + impl Foo { + fn foo(&self) { } + } +} diff --git a/src/test/ui/issues/auxiliary/issue-30123-aux.rs b/src/test/ui/issues/auxiliary/issue-30123-aux.rs new file mode 100644 index 00000000000..f60311a9400 --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-30123-aux.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::marker::PhantomData; + +pub struct Directed; +pub struct Undirected; + +pub struct Graph { + nodes: Vec>, + edges: Vec>, + ty: PhantomData, +} + + +impl Graph { + pub fn new() -> Self { + Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData} + } +} + +impl Graph { + pub fn new_undirected() -> Self { + Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData} + } +} diff --git a/src/test/ui/issues/auxiliary/issue-41549.rs b/src/test/ui/issues/auxiliary/issue-41549.rs new file mode 100644 index 00000000000..5a6db789282 --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-41549.rs @@ -0,0 +1,14 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub trait Trait { + const CONST: u32; +} diff --git a/src/test/ui/issues/auxiliary/issue-5844-aux.rs b/src/test/ui/issues/auxiliary/issue-5844-aux.rs new file mode 100644 index 00000000000..7fa937e93b3 --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-5844-aux.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern "C" { + pub fn rand() -> u32; +} diff --git a/src/test/ui/issues/auxiliary/issue_11680.rs b/src/test/ui/issues/auxiliary/issue_11680.rs deleted file mode 100644 index 18f78750b15..00000000000 --- a/src/test/ui/issues/auxiliary/issue_11680.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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum Foo { - Bar(isize) -} - -pub mod test { - enum Foo { - Bar(isize) - } -} diff --git a/src/test/ui/issues/auxiliary/issue_16725.rs b/src/test/ui/issues/auxiliary/issue_16725.rs deleted file mode 100644 index b3b04b4a5ac..00000000000 --- a/src/test/ui/issues/auxiliary/issue_16725.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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern { - fn bar(); -} diff --git a/src/test/ui/issues/auxiliary/issue_17718_const_privacy.rs b/src/test/ui/issues/auxiliary/issue_17718_const_privacy.rs deleted file mode 100644 index 3901d73382f..00000000000 --- a/src/test/ui/issues/auxiliary/issue_17718_const_privacy.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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub use foo::FOO2; - -pub const FOO: usize = 3; -const BAR: usize = 3; - -mod foo { - pub const FOO2: usize = 3; -} diff --git a/src/test/ui/issues/auxiliary/issue_1920.rs b/src/test/ui/issues/auxiliary/issue_1920.rs deleted file mode 100644 index 55065174ca7..00000000000 --- a/src/test/ui/issues/auxiliary/issue_1920.rs +++ /dev/null @@ -1,14 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Just exporting some type to test for correct diagnostics when this -// crate is pulled in at a non-root location in client crate. - -pub struct S; diff --git a/src/test/ui/issues/auxiliary/issue_21202.rs b/src/test/ui/issues/auxiliary/issue_21202.rs deleted file mode 100644 index afdbf78aa82..00000000000 --- a/src/test/ui/issues/auxiliary/issue_21202.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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod A { - pub struct Foo; - impl Foo { - fn foo(&self) { } - } -} diff --git a/src/test/ui/issues/auxiliary/issue_30123_aux.rs b/src/test/ui/issues/auxiliary/issue_30123_aux.rs deleted file mode 100644 index f60311a9400..00000000000 --- a/src/test/ui/issues/auxiliary/issue_30123_aux.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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::marker::PhantomData; - -pub struct Directed; -pub struct Undirected; - -pub struct Graph { - nodes: Vec>, - edges: Vec>, - ty: PhantomData, -} - - -impl Graph { - pub fn new() -> Self { - Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData} - } -} - -impl Graph { - pub fn new_undirected() -> Self { - Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData} - } -} diff --git a/src/test/ui/issues/auxiliary/issue_41549.rs b/src/test/ui/issues/auxiliary/issue_41549.rs deleted file mode 100644 index 5a6db789282..00000000000 --- a/src/test/ui/issues/auxiliary/issue_41549.rs +++ /dev/null @@ -1,14 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub trait Trait { - const CONST: u32; -} diff --git a/src/test/ui/issues/auxiliary/issue_5844_aux.rs b/src/test/ui/issues/auxiliary/issue_5844_aux.rs deleted file mode 100644 index 7fa937e93b3..00000000000 --- a/src/test/ui/issues/auxiliary/issue_5844_aux.rs +++ /dev/null @@ -1,13 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern "C" { - pub fn rand() -> u32; -} diff --git a/src/test/ui/issues/auxiliary/lint-stability.rs b/src/test/ui/issues/auxiliary/lint-stability.rs new file mode 100644 index 00000000000..5547458abbe --- /dev/null +++ b/src/test/ui/issues/auxiliary/lint-stability.rs @@ -0,0 +1,198 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="lint_stability"] +#![crate_type = "lib"] +#![feature(staged_api)] +#![feature(associated_type_defaults)] +#![stable(feature = "lint_stability", since = "1.0.0")] + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn deprecated() {} +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn deprecated_text() {} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "99.99.99", reason = "text")] +pub fn deprecated_future() {} + +#[unstable(feature = "unstable_test_feature", issue = "0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn deprecated_unstable() {} +#[unstable(feature = "unstable_test_feature", issue = "0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn deprecated_unstable_text() {} + +#[unstable(feature = "unstable_test_feature", issue = "0")] +pub fn unstable() {} +#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] +pub fn unstable_text() {} + +#[stable(feature = "rust1", since = "1.0.0")] +pub fn stable() {} +#[stable(feature = "rust1", since = "1.0.0")] +pub fn stable_text() {} + +#[stable(feature = "rust1", since = "1.0.0")] +pub struct MethodTester; + +impl MethodTester { + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + pub fn method_deprecated(&self) {} + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + pub fn method_deprecated_text(&self) {} + + #[unstable(feature = "unstable_test_feature", issue = "0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + pub fn method_deprecated_unstable(&self) {} + #[unstable(feature = "unstable_test_feature", issue = "0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + pub fn method_deprecated_unstable_text(&self) {} + + #[unstable(feature = "unstable_test_feature", issue = "0")] + pub fn method_unstable(&self) {} + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] + pub fn method_unstable_text(&self) {} + + #[stable(feature = "rust1", since = "1.0.0")] + pub fn method_stable(&self) {} + #[stable(feature = "rust1", since = "1.0.0")] + pub fn method_stable_text(&self) {} +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +pub trait Trait { + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + fn trait_deprecated(&self) {} + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + fn trait_deprecated_text(&self) {} + + #[unstable(feature = "unstable_test_feature", issue = "0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + fn trait_deprecated_unstable(&self) {} + #[unstable(feature = "unstable_test_feature", issue = "0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + fn trait_deprecated_unstable_text(&self) {} + + #[unstable(feature = "unstable_test_feature", issue = "0")] + fn trait_unstable(&self) {} + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] + fn trait_unstable_text(&self) {} + + #[stable(feature = "rust1", since = "1.0.0")] + fn trait_stable(&self) {} + #[stable(feature = "rust1", since = "1.0.0")] + fn trait_stable_text(&self) {} +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +pub trait TraitWithAssociatedTypes { + #[unstable(feature = "unstable_test_feature", issue = "0")] + type TypeUnstable = u8; + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + type TypeDeprecated = u8; +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +impl Trait for MethodTester {} + +#[unstable(feature = "unstable_test_feature", issue = "0")] +pub trait UnstableTrait { fn dummy(&self) { } } + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub trait DeprecatedTrait { + #[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { } +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedStruct { + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize +} +#[unstable(feature = "unstable_test_feature", issue = "0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedUnstableStruct { + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize +} +#[unstable(feature = "unstable_test_feature", issue = "0")] +pub struct UnstableStruct { + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize +} +#[stable(feature = "rust1", since = "1.0.0")] +pub struct StableStruct { + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize +} +#[unstable(feature = "unstable_test_feature", issue = "0")] +pub enum UnstableEnum {} +#[stable(feature = "rust1", since = "1.0.0")] +pub enum StableEnum {} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedUnitStruct; +#[unstable(feature = "unstable_test_feature", issue = "0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedUnstableUnitStruct; +#[unstable(feature = "unstable_test_feature", issue = "0")] +pub struct UnstableUnitStruct; +#[stable(feature = "rust1", since = "1.0.0")] +pub struct StableUnitStruct; + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +pub enum Enum { + #[stable(feature = "stable_test_feature", since = "1.0.0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + DeprecatedVariant, + #[unstable(feature = "unstable_test_feature", issue = "0")] + #[rustc_deprecated(since = "1.0.0", reason = "text")] + DeprecatedUnstableVariant, + #[unstable(feature = "unstable_test_feature", issue = "0")] + UnstableVariant, + + #[stable(feature = "rust1", since = "1.0.0")] + StableVariant, +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); +#[unstable(feature = "unstable_test_feature", issue = "0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); +#[unstable(feature = "unstable_test_feature", issue = "0")] +pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); +#[stable(feature = "rust1", since = "1.0.0")] +pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[macro_export] +macro_rules! macro_test { + () => (deprecated()); +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[macro_export] +macro_rules! macro_test_arg { + ($func:expr) => ($func); +} + +#[stable(feature = "stable_test_feature", since = "1.0.0")] +#[macro_export] +macro_rules! macro_test_arg_nested { + ($func:ident) => (macro_test_arg!($func())); +} diff --git a/src/test/ui/issues/auxiliary/lint_stability.rs b/src/test/ui/issues/auxiliary/lint_stability.rs deleted file mode 100644 index 5547458abbe..00000000000 --- a/src/test/ui/issues/auxiliary/lint_stability.rs +++ /dev/null @@ -1,198 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="lint_stability"] -#![crate_type = "lib"] -#![feature(staged_api)] -#![feature(associated_type_defaults)] -#![stable(feature = "lint_stability", since = "1.0.0")] - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub fn deprecated() {} -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub fn deprecated_text() {} - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "99.99.99", reason = "text")] -pub fn deprecated_future() {} - -#[unstable(feature = "unstable_test_feature", issue = "0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub fn deprecated_unstable() {} -#[unstable(feature = "unstable_test_feature", issue = "0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub fn deprecated_unstable_text() {} - -#[unstable(feature = "unstable_test_feature", issue = "0")] -pub fn unstable() {} -#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] -pub fn unstable_text() {} - -#[stable(feature = "rust1", since = "1.0.0")] -pub fn stable() {} -#[stable(feature = "rust1", since = "1.0.0")] -pub fn stable_text() {} - -#[stable(feature = "rust1", since = "1.0.0")] -pub struct MethodTester; - -impl MethodTester { - #[stable(feature = "stable_test_feature", since = "1.0.0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - pub fn method_deprecated(&self) {} - #[stable(feature = "stable_test_feature", since = "1.0.0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - pub fn method_deprecated_text(&self) {} - - #[unstable(feature = "unstable_test_feature", issue = "0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - pub fn method_deprecated_unstable(&self) {} - #[unstable(feature = "unstable_test_feature", issue = "0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - pub fn method_deprecated_unstable_text(&self) {} - - #[unstable(feature = "unstable_test_feature", issue = "0")] - pub fn method_unstable(&self) {} - #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] - pub fn method_unstable_text(&self) {} - - #[stable(feature = "rust1", since = "1.0.0")] - pub fn method_stable(&self) {} - #[stable(feature = "rust1", since = "1.0.0")] - pub fn method_stable_text(&self) {} -} - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -pub trait Trait { - #[stable(feature = "stable_test_feature", since = "1.0.0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - fn trait_deprecated(&self) {} - #[stable(feature = "stable_test_feature", since = "1.0.0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - fn trait_deprecated_text(&self) {} - - #[unstable(feature = "unstable_test_feature", issue = "0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - fn trait_deprecated_unstable(&self) {} - #[unstable(feature = "unstable_test_feature", issue = "0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - fn trait_deprecated_unstable_text(&self) {} - - #[unstable(feature = "unstable_test_feature", issue = "0")] - fn trait_unstable(&self) {} - #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] - fn trait_unstable_text(&self) {} - - #[stable(feature = "rust1", since = "1.0.0")] - fn trait_stable(&self) {} - #[stable(feature = "rust1", since = "1.0.0")] - fn trait_stable_text(&self) {} -} - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -pub trait TraitWithAssociatedTypes { - #[unstable(feature = "unstable_test_feature", issue = "0")] - type TypeUnstable = u8; - #[stable(feature = "stable_test_feature", since = "1.0.0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - type TypeDeprecated = u8; -} - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -impl Trait for MethodTester {} - -#[unstable(feature = "unstable_test_feature", issue = "0")] -pub trait UnstableTrait { fn dummy(&self) { } } - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub trait DeprecatedTrait { - #[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { } -} - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub struct DeprecatedStruct { - #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize -} -#[unstable(feature = "unstable_test_feature", issue = "0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub struct DeprecatedUnstableStruct { - #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize -} -#[unstable(feature = "unstable_test_feature", issue = "0")] -pub struct UnstableStruct { - #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize -} -#[stable(feature = "rust1", since = "1.0.0")] -pub struct StableStruct { - #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize -} -#[unstable(feature = "unstable_test_feature", issue = "0")] -pub enum UnstableEnum {} -#[stable(feature = "rust1", since = "1.0.0")] -pub enum StableEnum {} - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub struct DeprecatedUnitStruct; -#[unstable(feature = "unstable_test_feature", issue = "0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub struct DeprecatedUnstableUnitStruct; -#[unstable(feature = "unstable_test_feature", issue = "0")] -pub struct UnstableUnitStruct; -#[stable(feature = "rust1", since = "1.0.0")] -pub struct StableUnitStruct; - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -pub enum Enum { - #[stable(feature = "stable_test_feature", since = "1.0.0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - DeprecatedVariant, - #[unstable(feature = "unstable_test_feature", issue = "0")] - #[rustc_deprecated(since = "1.0.0", reason = "text")] - DeprecatedUnstableVariant, - #[unstable(feature = "unstable_test_feature", issue = "0")] - UnstableVariant, - - #[stable(feature = "rust1", since = "1.0.0")] - StableVariant, -} - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); -#[unstable(feature = "unstable_test_feature", issue = "0")] -#[rustc_deprecated(since = "1.0.0", reason = "text")] -pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); -#[unstable(feature = "unstable_test_feature", issue = "0")] -pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); -#[stable(feature = "rust1", since = "1.0.0")] -pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[macro_export] -macro_rules! macro_test { - () => (deprecated()); -} - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[macro_export] -macro_rules! macro_test_arg { - ($func:expr) => ($func); -} - -#[stable(feature = "stable_test_feature", since = "1.0.0")] -#[macro_export] -macro_rules! macro_test_arg_nested { - ($func:ident) => (macro_test_arg!($func())); -} diff --git a/src/test/ui/issues/auxiliary/private-trait-xc.rs b/src/test/ui/issues/auxiliary/private-trait-xc.rs new file mode 100644 index 00000000000..37ee10c8d37 --- /dev/null +++ b/src/test/ui/issues/auxiliary/private-trait-xc.rs @@ -0,0 +1,11 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Foo {} diff --git a/src/test/ui/issues/auxiliary/private_trait_xc.rs b/src/test/ui/issues/auxiliary/private_trait_xc.rs deleted file mode 100644 index 37ee10c8d37..00000000000 --- a/src/test/ui/issues/auxiliary/private_trait_xc.rs +++ /dev/null @@ -1,11 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait Foo {} diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs new file mode 100644 index 00000000000..95b2d62e426 --- /dev/null +++ b/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs @@ -0,0 +1,17 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + + +pub trait A { + fn a(&self) {} +} +impl A for () {} diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs new file mode 100644 index 00000000000..a396c31e21d --- /dev/null +++ b/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs @@ -0,0 +1,13 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub extern crate xcrate_issue_43189_a; diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs b/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs new file mode 100644 index 00000000000..80f877f834d --- /dev/null +++ b/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs @@ -0,0 +1,13 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub extern crate core; diff --git a/src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs b/src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs deleted file mode 100644 index 95b2d62e426..00000000000 --- a/src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - - -pub trait A { - fn a(&self) {} -} -impl A for () {} diff --git a/src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs b/src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs deleted file mode 100644 index a396c31e21d..00000000000 --- a/src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -pub extern crate xcrate_issue_43189_a; diff --git a/src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs b/src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs deleted file mode 100644 index 80f877f834d..00000000000 --- a/src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs +++ /dev/null @@ -1,13 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -pub extern crate core; diff --git a/src/test/ui/issues/issue-11593.rs b/src/test/ui/issues/issue-11593.rs index 2749438433d..f962704dc75 100644 --- a/src/test/ui/issues/issue-11593.rs +++ b/src/test/ui/issues/issue-11593.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:private_trait_xc.rs +// aux-build:private-trait-xc.rs extern crate private_trait_xc; diff --git a/src/test/ui/issues/issue-11680.rs b/src/test/ui/issues/issue-11680.rs index 7dccd781106..209b63104fa 100644 --- a/src/test/ui/issues/issue-11680.rs +++ b/src/test/ui/issues/issue-11680.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_11680.rs +// aux-build:issue-11680.rs extern crate issue_11680 as other; diff --git a/src/test/ui/issues/issue-16725.rs b/src/test/ui/issues/issue-16725.rs index cadf602a4cf..659ffb2c984 100644 --- a/src/test/ui/issues/issue-16725.rs +++ b/src/test/ui/issues/issue-16725.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_16725.rs +// aux-build:issue-16725.rs extern crate issue_16725 as foo; diff --git a/src/test/ui/issues/issue-17718-const-privacy.rs b/src/test/ui/issues/issue-17718-const-privacy.rs index 523a387956a..60eb4b7126d 100644 --- a/src/test/ui/issues/issue-17718-const-privacy.rs +++ b/src/test/ui/issues/issue-17718-const-privacy.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_17718_const_privacy.rs +// aux-build:issue-17718-const-privacy.rs extern crate issue_17718_const_privacy as other; diff --git a/src/test/ui/issues/issue-1920-1.rs b/src/test/ui/issues/issue-1920-1.rs index 97dd290a45b..7ba65580582 100644 --- a/src/test/ui/issues/issue-1920-1.rs +++ b/src/test/ui/issues/issue-1920-1.rs @@ -10,7 +10,7 @@ //! Test that absolute path names are correct when a crate is not linked into the root namespace -// aux-build:issue_1920.rs +// aux-build:issue-1920.rs mod foo { pub extern crate issue_1920; diff --git a/src/test/ui/issues/issue-1920-2.rs b/src/test/ui/issues/issue-1920-2.rs index 2af6e2cc991..bf4817aaf34 100644 --- a/src/test/ui/issues/issue-1920-2.rs +++ b/src/test/ui/issues/issue-1920-2.rs @@ -10,7 +10,7 @@ //! Test that when a crate is linked under another name that name is used in global paths -// aux-build:issue_1920.rs +// aux-build:issue-1920.rs extern crate issue_1920 as bar; diff --git a/src/test/ui/issues/issue-1920-3.rs b/src/test/ui/issues/issue-1920-3.rs index fa6efea845f..a70e958630f 100644 --- a/src/test/ui/issues/issue-1920-3.rs +++ b/src/test/ui/issues/issue-1920-3.rs @@ -10,7 +10,7 @@ //! Test that when a crate is linked multiple times that the shortest absolute path name is used -// aux-build:issue_1920.rs +// aux-build:issue-1920.rs mod foo { pub extern crate issue_1920; diff --git a/src/test/ui/issues/issue-21202.rs b/src/test/ui/issues/issue-21202.rs index 2bce838c1cf..fa4b515c81c 100644 --- a/src/test/ui/issues/issue-21202.rs +++ b/src/test/ui/issues/issue-21202.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_21202.rs +// aux-build:issue-21202.rs extern crate issue_21202 as crate1; diff --git a/src/test/ui/issues/issue-28075.rs b/src/test/ui/issues/issue-28075.rs index 0f6b9d1b5dc..494b446dd3f 100644 --- a/src/test/ui/issues/issue-28075.rs +++ b/src/test/ui/issues/issue-28075.rs @@ -10,7 +10,7 @@ // Unstable entities should be caught in import lists -// aux-build:lint_stability.rs +// aux-build:lint-stability.rs #![allow(warnings)] diff --git a/src/test/ui/issues/issue-28388-3.rs b/src/test/ui/issues/issue-28388-3.rs index 12e3457ef9e..7593bb35add 100644 --- a/src/test/ui/issues/issue-28388-3.rs +++ b/src/test/ui/issues/issue-28388-3.rs @@ -10,7 +10,7 @@ // Prefix in imports with empty braces should be resolved and checked privacy, stability, etc. -// aux-build:lint_stability.rs +// aux-build:lint-stability.rs extern crate lint_stability; diff --git a/src/test/ui/issues/issue-30123.rs b/src/test/ui/issues/issue-30123.rs index 653097ad69f..39278cffa12 100644 --- a/src/test/ui/issues/issue-30123.rs +++ b/src/test/ui/issues/issue-30123.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_30123_aux.rs +// aux-build:issue-30123-aux.rs extern crate issue_30123_aux; use issue_30123_aux::*; diff --git a/src/test/ui/issues/issue-32829-2.rs b/src/test/ui/issues/issue-32829-2.rs new file mode 100644 index 00000000000..2b223bac8e6 --- /dev/null +++ b/src/test/ui/issues/issue-32829-2.rs @@ -0,0 +1,94 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-tidy-linelength + +#![feature(const_fn)] + +const bad : u32 = { + { + 5; + //~^ ERROR statements in constants are unstable + 0 + } +}; + +const bad_two : u32 = { + { + invalid(); + //~^ ERROR statements in constants are unstable + //~^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants + 0 + } +}; + +const bad_three : u32 = { + { + valid(); + //~^ ERROR statements in constants are unstable + 0 + } +}; + +static bad_four : u32 = { + { + 5; + //~^ ERROR statements in statics are unstable + 0 + } +}; + +static bad_five : u32 = { + { + invalid(); + //~^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants + //~| ERROR statements in statics are unstable + 0 + } +}; + +static bad_six : u32 = { + { + valid(); + //~^ ERROR statements in statics are unstable + 0 + } +}; + +static mut bad_seven : u32 = { + { + 5; + //~^ ERROR statements in statics are unstable + 0 + } +}; + +static mut bad_eight : u32 = { + { + invalid(); + //~^ ERROR statements in statics are unstable + //~| ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants + 0 + } +}; + +static mut bad_nine : u32 = { + { + valid(); + //~^ ERROR statements in statics are unstable + 0 + } +}; + + +fn invalid() {} +const fn valid() {} + +fn main() {} diff --git a/src/test/ui/issues/issue-32829-2.stderr b/src/test/ui/issues/issue-32829-2.stderr new file mode 100644 index 00000000000..6d6b94ca4bc --- /dev/null +++ b/src/test/ui/issues/issue-32829-2.stderr @@ -0,0 +1,94 @@ +error[E0658]: statements in constants are unstable (see issue #48821) + --> $DIR/issue-32829-2.rs:17:9 + | +LL | 5; + | ^ + | + = help: add #![feature(const_let)] to the crate attributes to enable + +error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants + --> $DIR/issue-32829-2.rs:25:9 + | +LL | invalid(); + | ^^^^^^^^^ + +error[E0658]: statements in constants are unstable (see issue #48821) + --> $DIR/issue-32829-2.rs:25:9 + | +LL | invalid(); + | ^^^^^^^^^ + | + = help: add #![feature(const_let)] to the crate attributes to enable + +error[E0658]: statements in constants are unstable (see issue #48821) + --> $DIR/issue-32829-2.rs:34:9 + | +LL | valid(); + | ^^^^^^^ + | + = help: add #![feature(const_let)] to the crate attributes to enable + +error[E0658]: statements in statics are unstable (see issue #48821) + --> $DIR/issue-32829-2.rs:42:9 + | +LL | 5; + | ^ + | + = help: add #![feature(const_let)] to the crate attributes to enable + +error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants + --> $DIR/issue-32829-2.rs:50:9 + | +LL | invalid(); + | ^^^^^^^^^ + +error[E0658]: statements in statics are unstable (see issue #48821) + --> $DIR/issue-32829-2.rs:50:9 + | +LL | invalid(); + | ^^^^^^^^^ + | + = help: add #![feature(const_let)] to the crate attributes to enable + +error[E0658]: statements in statics are unstable (see issue #48821) + --> $DIR/issue-32829-2.rs:59:9 + | +LL | valid(); + | ^^^^^^^ + | + = help: add #![feature(const_let)] to the crate attributes to enable + +error[E0658]: statements in statics are unstable (see issue #48821) + --> $DIR/issue-32829-2.rs:67:9 + | +LL | 5; + | ^ + | + = help: add #![feature(const_let)] to the crate attributes to enable + +error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants + --> $DIR/issue-32829-2.rs:75:9 + | +LL | invalid(); + | ^^^^^^^^^ + +error[E0658]: statements in statics are unstable (see issue #48821) + --> $DIR/issue-32829-2.rs:75:9 + | +LL | invalid(); + | ^^^^^^^^^ + | + = help: add #![feature(const_let)] to the crate attributes to enable + +error[E0658]: statements in statics are unstable (see issue #48821) + --> $DIR/issue-32829-2.rs:84:9 + | +LL | valid(); + | ^^^^^^^ + | + = help: add #![feature(const_let)] to the crate attributes to enable + +error: aborting due to 12 previous errors + +Some errors occurred: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs b/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs new file mode 100644 index 00000000000..dd58735209b --- /dev/null +++ b/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs @@ -0,0 +1,11 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub const FOO: usize = *&0; diff --git a/src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs b/src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs deleted file mode 100644 index dd58735209b..00000000000 --- a/src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs +++ /dev/null @@ -1,11 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub const FOO: usize = *&0; diff --git a/src/test/ui/issues/issue-38875/issue-38875.rs b/src/test/ui/issues/issue-38875/issue-38875.rs new file mode 100644 index 00000000000..74db92cb828 --- /dev/null +++ b/src/test/ui/issues/issue-38875/issue-38875.rs @@ -0,0 +1,18 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:issue-38875-b.rs +// compile-pass + +extern crate issue_38875_b; + +fn main() { + let test_x = [0; issue_38875_b::FOO]; +} diff --git a/src/test/ui/issues/issue-38875/issue_38875.rs b/src/test/ui/issues/issue-38875/issue_38875.rs deleted file mode 100644 index d9debe34c4d..00000000000 --- a/src/test/ui/issues/issue-38875/issue_38875.rs +++ /dev/null @@ -1,18 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue_38875_b.rs -// compile-pass - -extern crate issue_38875_b; - -fn main() { - let test_x = [0; issue_38875_b::FOO]; -} diff --git a/src/test/ui/issues/issue-40827.rs b/src/test/ui/issues/issue-40827.rs new file mode 100644 index 00000000000..4b079ace3ca --- /dev/null +++ b/src/test/ui/issues/issue-40827.rs @@ -0,0 +1,27 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::rc::Rc; +use std::sync::Arc; + +struct Foo(Arc); + +enum Bar { + A(Rc), + B(Option), +} + +fn f(_: T) {} + +fn main() { + f(Foo(Arc::new(Bar::B(None)))); + //~^ ERROR E0277 + //~| ERROR E0277 +} diff --git a/src/test/ui/issues/issue-40827.stderr b/src/test/ui/issues/issue-40827.stderr new file mode 100644 index 00000000000..dd0ebf96d19 --- /dev/null +++ b/src/test/ui/issues/issue-40827.stderr @@ -0,0 +1,35 @@ +error[E0277]: `std::rc::Rc` cannot be sent between threads safely + --> $DIR/issue-40827.rs:24:5 + | +LL | f(Foo(Arc::new(Bar::B(None)))); + | ^ `std::rc::Rc` cannot be sent between threads safely + | + = help: within `Bar`, the trait `std::marker::Send` is not implemented for `std::rc::Rc` + = note: required because it appears within the type `Bar` + = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc` + = note: required because it appears within the type `Foo` +note: required by `f` + --> $DIR/issue-40827.rs:21:1 + | +LL | fn f(_: T) {} + | ^^^^^^^^^^^^^^^^^^^ + +error[E0277]: `std::rc::Rc` cannot be shared between threads safely + --> $DIR/issue-40827.rs:24:5 + | +LL | f(Foo(Arc::new(Bar::B(None)))); + | ^ `std::rc::Rc` cannot be shared between threads safely + | + = help: within `Bar`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc` + = note: required because it appears within the type `Bar` + = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc` + = note: required because it appears within the type `Foo` +note: required by `f` + --> $DIR/issue-40827.rs:21:1 + | +LL | fn f(_: T) {} + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-41549.rs b/src/test/ui/issues/issue-41549.rs index 67be194c8ed..de52fcfe327 100644 --- a/src/test/ui/issues/issue-41549.rs +++ b/src/test/ui/issues/issue-41549.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_41549.rs +// aux-build:issue-41549.rs extern crate issue_41549; diff --git a/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs b/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs new file mode 100644 index 00000000000..0b714432f16 --- /dev/null +++ b/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait Tr { + // Note: The function needs to be declared over multiple lines to reproduce + // the crash. DO NOT reformat. + fn f() + where Self: Sized; +} diff --git a/src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs b/src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs deleted file mode 100644 index 0b714432f16..00000000000 --- a/src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs +++ /dev/null @@ -1,16 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait Tr { - // Note: The function needs to be declared over multiple lines to reproduce - // the crash. DO NOT reformat. - fn f() - where Self: Sized; -} diff --git a/src/test/ui/issues/issue-41652/issue-41652.rs b/src/test/ui/issues/issue-41652/issue-41652.rs new file mode 100644 index 00000000000..4b42c0475eb --- /dev/null +++ b/src/test/ui/issues/issue-41652/issue-41652.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:issue-41652-b.rs + +extern crate issue_41652_b; + +struct S; + +impl issue_41652_b::Tr for S { + fn f() { + 3.f() + //~^ ERROR can't call method `f` on ambiguous numeric type `{integer}` + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-41652/issue-41652.stderr b/src/test/ui/issues/issue-41652/issue-41652.stderr new file mode 100644 index 00000000000..ed5eb360298 --- /dev/null +++ b/src/test/ui/issues/issue-41652/issue-41652.stderr @@ -0,0 +1,13 @@ +error[E0689]: can't call method `f` on ambiguous numeric type `{integer}` + --> $DIR/issue-41652.rs:19:11 + | +LL | 3.f() + | ^ +help: you must specify a concrete type for this numeric value, like `i32` + | +LL | 3_i32.f() + | ^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0689`. diff --git a/src/test/ui/issues/issue-41652/issue_41652.rs b/src/test/ui/issues/issue-41652/issue_41652.rs deleted file mode 100644 index a4e92820e21..00000000000 --- a/src/test/ui/issues/issue-41652/issue_41652.rs +++ /dev/null @@ -1,24 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue_41652_b.rs - -extern crate issue_41652_b; - -struct S; - -impl issue_41652_b::Tr for S { - fn f() { - 3.f() - //~^ ERROR can't call method `f` on ambiguous numeric type `{integer}` - } -} - -fn main() {} diff --git a/src/test/ui/issues/issue-41652/issue_41652.stderr b/src/test/ui/issues/issue-41652/issue_41652.stderr deleted file mode 100644 index 3f76b25692c..00000000000 --- a/src/test/ui/issues/issue-41652/issue_41652.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0689]: can't call method `f` on ambiguous numeric type `{integer}` - --> $DIR/issue_41652.rs:19:11 - | -LL | 3.f() - | ^ -help: you must specify a concrete type for this numeric value, like `i32` - | -LL | 3_i32.f() - | ^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0689`. diff --git a/src/test/ui/issues/issue-43189.rs b/src/test/ui/issues/issue-43189.rs index 154bee5d1d4..7018198aff5 100644 --- a/src/test/ui/issues/issue-43189.rs +++ b/src/test/ui/issues/issue-43189.rs @@ -12,8 +12,8 @@ // paths rooted from `std` to be misrendered in the diagnostic output. // ignore-windows -// aux-build:xcrate_issue_43189_a.rs -// aux-build:xcrate_issue_43189_b.rs +// aux-build:xcrate-issue-43189-a.rs +// aux-build:xcrate-issue-43189-b.rs extern crate xcrate_issue_43189_b; fn main() { diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs new file mode 100644 index 00000000000..56eb1541e1f --- /dev/null +++ b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs @@ -0,0 +1,11 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub const FOO: usize = *&0; diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs new file mode 100644 index 00000000000..56eb1541e1f --- /dev/null +++ b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs @@ -0,0 +1,11 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub const FOO: usize = *&0; diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs b/src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs deleted file mode 100644 index 56eb1541e1f..00000000000 --- a/src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub const FOO: usize = *&0; diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs b/src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs deleted file mode 100644 index 56eb1541e1f..00000000000 --- a/src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub const FOO: usize = *&0; diff --git a/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs b/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs index 5230cadf604..6befee331d5 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs +++ b/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_45829_b.rs +// aux-build:issue-45829-b.rs mod foo { pub mod bar {} diff --git a/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs b/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs index 7066ed65c78..61c7e915fe8 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs +++ b/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_45829_a.rs -// aux-build:issue_45829_b.rs +// aux-build:issue-45829-a.rs +// aux-build:issue-45829-b.rs extern crate issue_45829_a; extern crate issue_45829_b as issue_45829_a; diff --git a/src/test/ui/issues/issue-45829/rename-extern.rs b/src/test/ui/issues/issue-45829/rename-extern.rs index 7c3d9724005..41e3e8bbe14 100644 --- a/src/test/ui/issues/issue-45829/rename-extern.rs +++ b/src/test/ui/issues/issue-45829/rename-extern.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_45829_a.rs -// aux-build:issue_45829_b.rs +// aux-build:issue-45829-a.rs +// aux-build:issue-45829-b.rs extern crate issue_45829_a; extern crate issue_45829_b as issue_45829_a; diff --git a/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs b/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs index 1cc261ed922..9a2ec7a5273 100644 --- a/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs +++ b/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:issue_45829_b.rs +// aux-build:issue-45829-b.rs extern crate issue_45829_b; use std as issue_45829_b; diff --git a/src/test/ui/issues/issue-46112.rs b/src/test/ui/issues/issue-46112.rs index 698005b5d30..202c67e584c 100644 --- a/src/test/ui/issues/issue-46112.rs +++ b/src/test/ui/issues/issue-46112.rs @@ -12,7 +12,7 @@ // paths rooted from `std` to be misrendered in the diagnostic output. // ignore-windows -// aux-build:xcrate_issue_46112_rexport_core.rs +// aux-build:xcrate-issue-46112-rexport-core.rs extern crate xcrate_issue_46112_rexport_core; fn test(r: Result, &'static str>) { } diff --git a/src/test/ui/issues/issue-49556.rs b/src/test/ui/issues/issue-49556.rs new file mode 100644 index 00000000000..7f7b349c3a0 --- /dev/null +++ b/src/test/ui/issues/issue-49556.rs @@ -0,0 +1,23 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-pass +fn iter<'a>(data: &'a [usize]) -> impl Iterator + 'a { + data.iter() + .map( + |x| x // fn(&'a usize) -> &'(ReScope) usize + ) + .map( + |x| *x // fn(&'(ReScope) usize) -> usize + ) +} + +fn main() { +} diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs new file mode 100644 index 00000000000..4c67fb3bef1 --- /dev/null +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs @@ -0,0 +1,16 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(inner_deref)] + +fn main() { + let _result = &Some(42).deref(); +//~^ ERROR no method named `deref` found for type `std::option::Option<{integer}>` +} diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr new file mode 100644 index 00000000000..3e255ca6539 --- /dev/null +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `deref` found for type `std::option::Option<{integer}>` in the current scope + --> $DIR/option-deref.rs:14:29 + | +LL | let _result = &Some(42).deref(); + | ^^^^^ + | + = note: the method `deref` exists but the following trait bounds were not satisfied: + `{integer} : std::ops::Deref` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs deleted file mode 100644 index 4c67fb3bef1..00000000000 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(inner_deref)] - -fn main() { - let _result = &Some(42).deref(); -//~^ ERROR no method named `deref` found for type `std::option::Option<{integer}>` -} diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr deleted file mode 100644 index a56cd6e8d2f..00000000000 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0599]: no method named `deref` found for type `std::option::Option<{integer}>` in the current scope - --> $DIR/option_deref.rs:14:29 - | -LL | let _result = &Some(42).deref(); - | ^^^^^ - | - = note: the method `deref` exists but the following trait bounds were not satisfied: - `{integer} : std::ops::Deref` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs new file mode 100644 index 00000000000..5d1e7472d8f --- /dev/null +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs @@ -0,0 +1,16 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(inner_deref)] + +fn main() { + let _result = &Err(41).deref_err(); +//~^ ERROR no method named `deref_err` found +} diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr new file mode 100644 index 00000000000..57b5d07afb4 --- /dev/null +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `deref_err` found for type `std::result::Result<_, {integer}>` in the current scope + --> $DIR/result-deref-err.rs:14:28 + | +LL | let _result = &Err(41).deref_err(); + | ^^^^^^^^^ + | + = note: the method `deref_err` exists but the following trait bounds were not satisfied: + `{integer} : std::ops::Deref` + = help: did you mean `deref_ok`? + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs new file mode 100644 index 00000000000..bee8e0c062b --- /dev/null +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs @@ -0,0 +1,16 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(inner_deref)] + +fn main() { + let _result = &Ok(42).deref_ok(); +//~^ ERROR no method named `deref_ok` found +} diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr new file mode 100644 index 00000000000..ee0c439715b --- /dev/null +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `deref_ok` found for type `std::result::Result<{integer}, _>` in the current scope + --> $DIR/result-deref-ok.rs:14:27 + | +LL | let _result = &Ok(42).deref_ok(); + | ^^^^^^^^ + | + = note: the method `deref_ok` exists but the following trait bounds were not satisfied: + `{integer} : std::ops::Deref` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs new file mode 100644 index 00000000000..73bdf0b9209 --- /dev/null +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs @@ -0,0 +1,16 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(inner_deref)] + +fn main() { + let _result = &Ok(42).deref(); +//~^ ERROR no method named `deref` found +} diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr new file mode 100644 index 00000000000..46fee660f66 --- /dev/null +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr @@ -0,0 +1,12 @@ +error[E0599]: no method named `deref` found for type `std::result::Result<{integer}, _>` in the current scope + --> $DIR/result-deref.rs:14:27 + | +LL | let _result = &Ok(42).deref(); + | ^^^^^ + | + = note: the method `deref` exists but the following trait bounds were not satisfied: + `{integer} : std::ops::Deref` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs deleted file mode 100644 index 73bdf0b9209..00000000000 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(inner_deref)] - -fn main() { - let _result = &Ok(42).deref(); -//~^ ERROR no method named `deref` found -} diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr deleted file mode 100644 index d3d7c1993ca..00000000000 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0599]: no method named `deref` found for type `std::result::Result<{integer}, _>` in the current scope - --> $DIR/result_deref.rs:14:27 - | -LL | let _result = &Ok(42).deref(); - | ^^^^^ - | - = note: the method `deref` exists but the following trait bounds were not satisfied: - `{integer} : std::ops::Deref` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs deleted file mode 100644 index 5d1e7472d8f..00000000000 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(inner_deref)] - -fn main() { - let _result = &Err(41).deref_err(); -//~^ ERROR no method named `deref_err` found -} diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr deleted file mode 100644 index bf75687b21f..00000000000 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0599]: no method named `deref_err` found for type `std::result::Result<_, {integer}>` in the current scope - --> $DIR/result_deref_err.rs:14:28 - | -LL | let _result = &Err(41).deref_err(); - | ^^^^^^^^^ - | - = note: the method `deref_err` exists but the following trait bounds were not satisfied: - `{integer} : std::ops::Deref` - = help: did you mean `deref_ok`? - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs deleted file mode 100644 index bee8e0c062b..00000000000 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(inner_deref)] - -fn main() { - let _result = &Ok(42).deref_ok(); -//~^ ERROR no method named `deref_ok` found -} diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr deleted file mode 100644 index a77333a7568..00000000000 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0599]: no method named `deref_ok` found for type `std::result::Result<{integer}, _>` in the current scope - --> $DIR/result_deref_ok.rs:14:27 - | -LL | let _result = &Ok(42).deref_ok(); - | ^^^^^^^^ - | - = note: the method `deref_ok` exists but the following trait bounds were not satisfied: - `{integer} : std::ops::Deref` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-51602.rs b/src/test/ui/issues/issue-51602.rs new file mode 100644 index 00000000000..a3edecb94f7 --- /dev/null +++ b/src/test/ui/issues/issue-51602.rs @@ -0,0 +1,15 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main(){ + if i in 1..10 { + break; + } +} diff --git a/src/test/ui/issues/issue-51602.stderr b/src/test/ui/issues/issue-51602.stderr new file mode 100644 index 00000000000..d50ee64cf52 --- /dev/null +++ b/src/test/ui/issues/issue-51602.stderr @@ -0,0 +1,10 @@ +error: expected `{`, found keyword `in` + --> $DIR/issue-51602.rs:12:10 + | +LL | if i in 1..10 { + | -- ^^ expected `{` + | | + | this `if` statement has a condition, but no block + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-52717.rs b/src/test/ui/issues/issue-52717.rs new file mode 100644 index 00000000000..d40e2bd3d53 --- /dev/null +++ b/src/test/ui/issues/issue-52717.rs @@ -0,0 +1,21 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +enum A { + A { + foo: usize, + } +} + +fn main() { + let x = A::A { foo: 3 }; + match x { + A::A { fob } => { println!("{}", fob); } + } +} diff --git a/src/test/ui/issues/issue-52717.stderr b/src/test/ui/issues/issue-52717.stderr new file mode 100644 index 00000000000..0ef5a84671d --- /dev/null +++ b/src/test/ui/issues/issue-52717.stderr @@ -0,0 +1,12 @@ +error[E0026]: variant `A::A` does not have a field named `fob` + --> $DIR/issue-52717.rs:19:12 + | +LL | A::A { fob } => { println!("{}", fob); } + | ^^^ + | | + | variant `A::A` does not have this field + | help: did you mean: `foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0026`. diff --git a/src/test/ui/issues/issue-52992.rs b/src/test/ui/issues/issue-52992.rs new file mode 100644 index 00000000000..2ece0ee9fee --- /dev/null +++ b/src/test/ui/issues/issue-52992.rs @@ -0,0 +1,37 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for an NLL-related ICE (#52992) -- computing +// implied bounds was causing outlives relations that were not +// properly handled. +// +// compile-pass + +#![feature(nll)] + +fn main() {} + +fn fail<'a>() -> Struct<'a, Generic<()>> { + Struct(&Generic(())) +} + +struct Struct<'a, T>(&'a T) where + T: Trait + 'a, + T::AT: 'a; // only fails with this bound + +struct Generic(T); + +trait Trait { + type AT; +} + +impl Trait for Generic { + type AT = T; // only fails with a generic AT +} diff --git a/src/test/ui/issues/issue-53251.rs b/src/test/ui/issues/issue-53251.rs new file mode 100644 index 00000000000..8c75ea45a61 --- /dev/null +++ b/src/test/ui/issues/issue-53251.rs @@ -0,0 +1,30 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct S; + +impl S { + fn f() {} +} + +macro_rules! impl_add { + ($($n:ident)*) => { + $( + fn $n() { + S::f::(); + //~^ ERROR wrong number of type arguments + } + )* + } +} + +impl_add!(a b); + +fn main() {} diff --git a/src/test/ui/issues/issue-53251.stderr b/src/test/ui/issues/issue-53251.stderr new file mode 100644 index 00000000000..51ea745bedb --- /dev/null +++ b/src/test/ui/issues/issue-53251.stderr @@ -0,0 +1,12 @@ +error[E0107]: wrong number of type arguments: expected 0, found 1 + --> $DIR/issue-53251.rs:21:24 + | +LL | S::f::(); + | ^^^ unexpected type argument +... +LL | impl_add!(a b); + | --------------- in this macro invocation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/issues/issue-53300.rs b/src/test/ui/issues/issue-53300.rs new file mode 100644 index 00000000000..d055a6f12c1 --- /dev/null +++ b/src/test/ui/issues/issue-53300.rs @@ -0,0 +1,22 @@ +// Copyright 2012-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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// issue 53300 + +pub trait A { + fn add(&self, b: i32) -> i32; +} + +fn addition() -> Wrapper {} +//~^ ERROR cannot find type `Wrapper` in this scope [E0412] + +fn main() { + let res = addition(); +} diff --git a/src/test/ui/issues/issue-53300.stderr b/src/test/ui/issues/issue-53300.stderr new file mode 100644 index 00000000000..920287a32d6 --- /dev/null +++ b/src/test/ui/issues/issue-53300.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Wrapper` in this scope + --> $DIR/issue-53300.rs:17:18 + | +LL | fn addition() -> Wrapper {} + | ^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/issues/issue-53419.rs b/src/test/ui/issues/issue-53419.rs new file mode 100644 index 00000000000..0dd5a851285 --- /dev/null +++ b/src/test/ui/issues/issue-53419.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//compile-pass + +struct Foo { + bar: for<'r> Fn(usize, &'r FnMut()) +} + +fn main() { +} + diff --git a/src/test/ui/issues/issue-53565.rs b/src/test/ui/issues/issue-53565.rs new file mode 100644 index 00000000000..2bf38296f26 --- /dev/null +++ b/src/test/ui/issues/issue-53565.rs @@ -0,0 +1,14 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +use std::time::{foo, bar, buzz}; +use std::time::{abc, def}; +fn main(){ + println!("Hello World!"); +} diff --git a/src/test/ui/issues/issue-53565.stderr b/src/test/ui/issues/issue-53565.stderr new file mode 100644 index 00000000000..945f5efe4a8 --- /dev/null +++ b/src/test/ui/issues/issue-53565.stderr @@ -0,0 +1,20 @@ +error[E0432]: unresolved imports `std::time::foo`, `std::time::bar`, `std::time::buzz` + --> $DIR/issue-53565.rs:10:17 + | +LL | use std::time::{foo, bar, buzz}; + | ^^^ ^^^ ^^^^ no `buzz` in `time` + | | | + | | no `bar` in `time` + | no `foo` in `time` + +error[E0432]: unresolved imports `std::time::abc`, `std::time::def` + --> $DIR/issue-53565.rs:11:17 + | +LL | use std::time::{abc, def}; + | ^^^ ^^^ no `def` in `time` + | | + | no `abc` in `time` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/issues/issue-53568.rs b/src/test/ui/issues/issue-53568.rs new file mode 100644 index 00000000000..6b479f75172 --- /dev/null +++ b/src/test/ui/issues/issue-53568.rs @@ -0,0 +1,61 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for an NLL-related ICE (#53568) -- we failed to +// resolve inference variables in "custom type-ops". +// +// compile-pass + +#![feature(nll)] +#![allow(dead_code)] + +trait Future { + type Item; +} + +impl Future for F +where F: Fn() -> T +{ + type Item = T; +} + +trait Connect {} + +struct Connector { + handler: H, +} + +impl Connect for Connector +where + T: 'static, + H: Future +{ +} + +struct Client { + connector: C, +} + +fn build(_connector: C) -> Client { + unimplemented!() +} + +fn client(handler: H) -> Client +where H: Fn() + Copy +{ + let connector = Connector { + handler, + }; + let client = build(connector); + client +} + +fn main() { } + diff --git a/src/test/ui/issues/issue-53692.rs b/src/test/ui/issues/issue-53692.rs new file mode 100644 index 00000000000..0b6cc36fa52 --- /dev/null +++ b/src/test/ui/issues/issue-53692.rs @@ -0,0 +1,24 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +fn main() { + let items = vec![1, 2, 3]; + let ref_items: &[i32] = &items; + let items_clone: Vec = ref_items.clone(); + + // in that case no suggestion will be triggered + let items_clone_2:Vec = items.clone(); + + let s = "hi"; + let string: String = s.clone(); + + // in that case no suggestion will be triggered + let s2 = "hi"; + let string_2: String = s2.to_string(); +} diff --git a/src/test/ui/issues/issue-53692.stderr b/src/test/ui/issues/issue-53692.stderr new file mode 100644 index 00000000000..9cd8a536155 --- /dev/null +++ b/src/test/ui/issues/issue-53692.stderr @@ -0,0 +1,27 @@ +error[E0308]: mismatched types + --> $DIR/issue-53692.rs:13:37 + | +LL | let items_clone: Vec = ref_items.clone(); + | ^^^^^^^^^^^^^^^^^ + | | + | expected struct `std::vec::Vec`, found &[i32] + | help: try using a conversion method: `ref_items.to_vec()` + | + = note: expected type `std::vec::Vec` + found type `&[i32]` + +error[E0308]: mismatched types + --> $DIR/issue-53692.rs:19:30 + | +LL | let string: String = s.clone(); + | ^^^^^^^^^ + | | + | expected struct `std::string::String`, found &str + | help: try using a conversion method: `s.to_string()` + | + = note: expected type `std::string::String` + found type `&str` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-53840.rs b/src/test/ui/issues/issue-53840.rs new file mode 100644 index 00000000000..ece3caf78e2 --- /dev/null +++ b/src/test/ui/issues/issue-53840.rs @@ -0,0 +1,27 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +enum E { + Foo(String, String, String), +} + +struct Bar { + a: String, + b: String, +} + +fn main() { + let bar = Bar { a: "1".to_string(), b: "2".to_string() }; + match E::Foo("".into(), "".into(), "".into()) { + E::Foo(a, b, ref c) => {} + } + match bar { + Bar {a, ref b} => {} + } +} diff --git a/src/test/ui/issues/issue-53840.stderr b/src/test/ui/issues/issue-53840.stderr new file mode 100644 index 00000000000..961e4c0ff62 --- /dev/null +++ b/src/test/ui/issues/issue-53840.stderr @@ -0,0 +1,20 @@ +error[E0009]: cannot bind by-move and by-ref in the same pattern + --> $DIR/issue-53840.rs:22:16 + | +LL | E::Foo(a, b, ref c) => {} + | ^ ^ ----- both by-ref and by-move used + | | | + | | by-move pattern here + | by-move pattern here + +error[E0009]: cannot bind by-move and by-ref in the same pattern + --> $DIR/issue-53840.rs:25:14 + | +LL | Bar {a, ref b} => {} + | ^ ----- both by-ref and by-move used + | | + | by-move pattern here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0009`. diff --git a/src/test/ui/issues/issue-54302-cases.rs b/src/test/ui/issues/issue-54302-cases.rs new file mode 100644 index 00000000000..6d1c61c80f0 --- /dev/null +++ b/src/test/ui/issues/issue-54302-cases.rs @@ -0,0 +1,95 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Mirror { + type Image; + fn coerce(self) -> Self::Image; +} + +impl Mirror for T { + type Image = T; + fn coerce(self) -> Self { self } +} + +trait Foo<'x, T> { + fn foo(self) -> &'x T; +} + +impl<'s, 'x, T: 'x> Foo<'x, T> for &'s T where &'s T: Foo2<'x, T> { + fn foo(self) -> &'x T { self.foo2() } +} + +trait Foo2<'x, T> { + fn foo2(self) -> &'x T; +} + +// example 1 - fails leak check +impl<'x> Foo2<'x, u32> for &'x u32 +{ + fn foo2(self) -> &'x u32 { self } +} + +// example 2 - OK with this issue +impl<'x, 'a: 'x> Foo2<'x, i32> for &'a i32 +{ + fn foo2(self) -> &'x i32 { self } +} + +// example 3 - fails due to issue #XYZ + Leak-check +impl<'x, T> Foo2<'x, u64> for T + where T: Mirror +{ + fn foo2(self) -> &'x u64 { self.coerce() } +} + +// example 4 - fails due to issue #XYZ +impl<'x, 'a: 'x, T> Foo2<'x, i64> for T + where T: Mirror +{ + fn foo2(self) -> &'x i64 { self.coerce() } +} + + +trait RefFoo { + fn ref_foo(&self) -> &'static T; +} + +impl RefFoo for T where for<'a> &'a T: Foo<'static, T> { + fn ref_foo(&self) -> &'static T { + self.foo() + } +} + + +fn coerce_lifetime1(a: &u32) -> &'static u32 +{ + >::ref_foo(a) + //~^ ERROR the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied +} + +fn coerce_lifetime2(a: &i32) -> &'static i32 +{ + >::ref_foo(a) + //~^ ERROR the requirement `for<'a> 'a : ` is not satisfied +} + +fn coerce_lifetime3(a: &u64) -> &'static u64 +{ + >::ref_foo(a) + //~^ ERROR type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64` +} + +fn coerce_lifetime4(a: &i64) -> &'static i64 +{ + >::ref_foo(a) + //~^ ERROR type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64` +} + +fn main() {} diff --git a/src/test/ui/issues/issue-54302-cases.stderr b/src/test/ui/issues/issue-54302-cases.stderr new file mode 100644 index 00000000000..9603f7a973c --- /dev/null +++ b/src/test/ui/issues/issue-54302-cases.stderr @@ -0,0 +1,65 @@ +error[E0277]: the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied + --> $DIR/issue-54302-cases.rs:73:5 + | +LL | >::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo2<'_, u32>` is not implemented for `&'a u32` + | + = help: the following implementations were found: + <&'x u32 as Foo2<'x, u32>> + = note: required because of the requirements on the impl of `for<'a> Foo<'static, u32>` for `&'a u32` + = note: required because of the requirements on the impl of `RefFoo` for `u32` +note: required by `RefFoo::ref_foo` + --> $DIR/issue-54302-cases.rs:61:5 + | +LL | fn ref_foo(&self) -> &'static T; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0279]: the requirement `for<'a> 'a : ` is not satisfied (`expected bound lifetime parameter 'a, found concrete lifetime`) + --> $DIR/issue-54302-cases.rs:79:5 + | +LL | >::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i32>` for `&'a i32` + = note: required because of the requirements on the impl of `for<'a> Foo<'static, i32>` for `&'a i32` + = note: required because of the requirements on the impl of `RefFoo` for `i32` +note: required by `RefFoo::ref_foo` + --> $DIR/issue-54302-cases.rs:61:5 + | +LL | fn ref_foo(&self) -> &'static T; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0271]: type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64` + --> $DIR/issue-54302-cases.rs:85:5 + | +LL | >::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime + | + = note: required because of the requirements on the impl of `for<'a> Foo2<'_, u64>` for `&'a u64` + = note: required because of the requirements on the impl of `for<'a> Foo<'static, u64>` for `&'a u64` + = note: required because of the requirements on the impl of `RefFoo` for `u64` +note: required by `RefFoo::ref_foo` + --> $DIR/issue-54302-cases.rs:61:5 + | +LL | fn ref_foo(&self) -> &'static T; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0271]: type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64` + --> $DIR/issue-54302-cases.rs:91:5 + | +LL | >::ref_foo(a) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime + | + = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i64>` for `&'a i64` + = note: required because of the requirements on the impl of `for<'a> Foo<'static, i64>` for `&'a i64` + = note: required because of the requirements on the impl of `RefFoo` for `i64` +note: required by `RefFoo::ref_foo` + --> $DIR/issue-54302-cases.rs:61:5 + | +LL | fn ref_foo(&self) -> &'static T; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + +Some errors occurred: E0271, E0277, E0279. +For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/issues/issue-54302.rs b/src/test/ui/issues/issue-54302.rs new file mode 100644 index 00000000000..969d19cac2d --- /dev/null +++ b/src/test/ui/issues/issue-54302.rs @@ -0,0 +1,29 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Deserialize<'de> {} + +trait DeserializeOwned: for<'de> Deserialize<'de> {} +impl DeserializeOwned for T where T: for<'de> Deserialize<'de> {} + +// Based on this impl, `&'static str` only implements Deserialize<'static>. +// It does not implement for<'de> Deserialize<'de>. +impl<'de: 'a, 'a> Deserialize<'de> for &'a str {} + +fn main() { + // Then why does it implement DeserializeOwned? This compiles. + fn assert_deserialize_owned() {} + assert_deserialize_owned::<&'static str>(); + //~^ ERROR the requirement `for<'de> 'de : ` is not satisfied + + // It correctly does not implement for<'de> Deserialize<'de>. + //fn assert_hrtb Deserialize<'de>>() {} + //assert_hrtb::<&'static str>(); +} diff --git a/src/test/ui/issues/issue-54302.stderr b/src/test/ui/issues/issue-54302.stderr new file mode 100644 index 00000000000..f122daeecf6 --- /dev/null +++ b/src/test/ui/issues/issue-54302.stderr @@ -0,0 +1,17 @@ +error[E0279]: the requirement `for<'de> 'de : ` is not satisfied (`expected bound lifetime parameter 'de, found concrete lifetime`) + --> $DIR/issue-54302.rs:23:5 + | +LL | assert_deserialize_owned::<&'static str>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: required because of the requirements on the impl of `for<'de> Deserialize<'de>` for `&'static str` + = note: required because of the requirements on the impl of `DeserializeOwned` for `&'static str` +note: required by `main::assert_deserialize_owned` + --> $DIR/issue-54302.rs:22:5 + | +LL | fn assert_deserialize_owned() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0279`. diff --git a/src/test/ui/issues/issue-5844.rs b/src/test/ui/issues/issue-5844.rs index 02e5b9b0921..329bfd1dde0 100644 --- a/src/test/ui/issues/issue-5844.rs +++ b/src/test/ui/issues/issue-5844.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//aux-build:issue_5844_aux.rs +//aux-build:issue-5844-aux.rs extern crate issue_5844_aux; diff --git a/src/test/ui/issues/issue32829.rs b/src/test/ui/issues/issue32829.rs deleted file mode 100644 index 2b223bac8e6..00000000000 --- a/src/test/ui/issues/issue32829.rs +++ /dev/null @@ -1,94 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-tidy-linelength - -#![feature(const_fn)] - -const bad : u32 = { - { - 5; - //~^ ERROR statements in constants are unstable - 0 - } -}; - -const bad_two : u32 = { - { - invalid(); - //~^ ERROR statements in constants are unstable - //~^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants - 0 - } -}; - -const bad_three : u32 = { - { - valid(); - //~^ ERROR statements in constants are unstable - 0 - } -}; - -static bad_four : u32 = { - { - 5; - //~^ ERROR statements in statics are unstable - 0 - } -}; - -static bad_five : u32 = { - { - invalid(); - //~^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants - //~| ERROR statements in statics are unstable - 0 - } -}; - -static bad_six : u32 = { - { - valid(); - //~^ ERROR statements in statics are unstable - 0 - } -}; - -static mut bad_seven : u32 = { - { - 5; - //~^ ERROR statements in statics are unstable - 0 - } -}; - -static mut bad_eight : u32 = { - { - invalid(); - //~^ ERROR statements in statics are unstable - //~| ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants - 0 - } -}; - -static mut bad_nine : u32 = { - { - valid(); - //~^ ERROR statements in statics are unstable - 0 - } -}; - - -fn invalid() {} -const fn valid() {} - -fn main() {} diff --git a/src/test/ui/issues/issue32829.stderr b/src/test/ui/issues/issue32829.stderr deleted file mode 100644 index dad0880dbdf..00000000000 --- a/src/test/ui/issues/issue32829.stderr +++ /dev/null @@ -1,94 +0,0 @@ -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue32829.rs:17:9 - | -LL | 5; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue32829.rs:25:9 - | -LL | invalid(); - | ^^^^^^^^^ - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue32829.rs:25:9 - | -LL | invalid(); - | ^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue32829.rs:34:9 - | -LL | valid(); - | ^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:42:9 - | -LL | 5; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue32829.rs:50:9 - | -LL | invalid(); - | ^^^^^^^^^ - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:50:9 - | -LL | invalid(); - | ^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:59:9 - | -LL | valid(); - | ^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:67:9 - | -LL | 5; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue32829.rs:75:9 - | -LL | invalid(); - | ^^^^^^^^^ - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:75:9 - | -LL | invalid(); - | ^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue32829.rs:84:9 - | -LL | valid(); - | ^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error: aborting due to 12 previous errors - -Some errors occurred: E0015, E0658. -For more information about an error, try `rustc --explain E0015`.