diff options
| author | bors <bors@rust-lang.org> | 2016-08-06 05:02:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-06 05:02:16 -0700 |
| commit | 444ff9fbfb1f2a8e6645f67684f8a9ad99b343d3 (patch) | |
| tree | dad9595deade059b82952d7c38ccef3140686537 /src/test/compile-fail | |
| parent | ecdd51b7bb7fd993acd2ff5dbd72209244b1e4aa (diff) | |
| parent | 67f082287d49320af9042678b861437cd8d0224c (diff) | |
| download | rust-444ff9fbfb1f2a8e6645f67684f8a9ad99b343d3.tar.gz rust-444ff9fbfb1f2a8e6645f67684f8a9ad99b343d3.zip | |
Auto merge of #35407 - eddyb:rollup, r=eddyb
Rollup of 21 pull requests - Successful merges: #33951, #34916, #35287, #35288, #35351, #35353, #35356, #35362, #35363, #35364, #35366, #35368, #35370, #35372, #35373, #35374, #35375, #35376, #35380, #35393, #35394 - Failed merges: #35331, #35395
Diffstat (limited to 'src/test/compile-fail')
36 files changed, 346 insertions, 35 deletions
diff --git a/src/test/compile-fail/E0069.rs b/src/test/compile-fail/E0069.rs index d164d863487..00facc91728 100644 --- a/src/test/compile-fail/E0069.rs +++ b/src/test/compile-fail/E0069.rs @@ -9,7 +9,9 @@ // except according to those terms. fn foo() -> u8 { - return; //~ ERROR E0069 + return; + //~^ ERROR `return;` in a function whose return type is not `()` + //~| NOTE return type is not () } fn main() { diff --git a/src/test/compile-fail/E0106.rs b/src/test/compile-fail/E0106.rs index f1cd530863d..dab03f0bccf 100644 --- a/src/test/compile-fail/E0106.rs +++ b/src/test/compile-fail/E0106.rs @@ -9,13 +9,19 @@ // except according to those terms. struct Foo { - x: &bool, //~ ERROR E0106 + x: &bool, + //~^ ERROR E0106 + //~| NOTE expected lifetime parameter } enum Bar { A(u8), - B(&bool), //~ ERROR E0106 + B(&bool), + //~^ ERROR E0106 + //~| NOTE expected lifetime parameter } -type MyStr = &str; //~ ERROR E0106 +type MyStr = &str; + //~^ ERROR E0106 + //~| NOTE expected lifetime parameter fn main() { } diff --git a/src/test/compile-fail/E0107.rs b/src/test/compile-fail/E0107.rs index d27b70865bb..5f333e17c47 100644 --- a/src/test/compile-fail/E0107.rs +++ b/src/test/compile-fail/E0107.rs @@ -9,6 +9,7 @@ // except according to those terms. struct Foo<'a>(&'a str); +struct Buzz<'a, 'b>(&'a str, &'b str); enum Bar { A, @@ -16,9 +17,19 @@ enum Bar { C, } -struct Baz<'a> { - foo: Foo, //~ ERROR E0107 - bar: Bar<'a>, //~ ERROR E0107 +struct Baz<'a, 'b, 'c> { + foo: Foo, + //~^ ERROR E0107 + //~| expected 1 lifetime parameter + buzz: Buzz<'a>, + //~^ ERROR E0107 + //~| expected 2 lifetime parameters + bar: Bar<'a>, + //~^ ERROR E0107 + //~| unexpected lifetime parameter + foo2: Foo<'a, 'b, 'c>, + //~^ ERROR E0107 + //~| 2 unexpected lifetime parameters } fn main() { diff --git a/src/test/compile-fail/E0166.rs b/src/test/compile-fail/E0166.rs index 9fa41249aa5..f8585d71b40 100644 --- a/src/test/compile-fail/E0166.rs +++ b/src/test/compile-fail/E0166.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo() -> ! { return; } //~ ERROR E0166 +fn foo() -> ! { return; } + //~^ ERROR E0166 + //~| NOTE diverging function cannot return fn main() { } diff --git a/src/test/compile-fail/E0207.rs b/src/test/compile-fail/E0207.rs index bd87dbaf786..43ff085a4fa 100644 --- a/src/test/compile-fail/E0207.rs +++ b/src/test/compile-fail/E0207.rs @@ -11,6 +11,7 @@ struct Foo; impl<T: Default> Foo { //~ ERROR E0207 + //~| NOTE unconstrained lifetime parameter fn get(&self) -> T { <T as Default>::default() } diff --git a/src/test/compile-fail/E0229.rs b/src/test/compile-fail/E0229.rs index 45d5c59592f..6ff0baeeb4d 100644 --- a/src/test/compile-fail/E0229.rs +++ b/src/test/compile-fail/E0229.rs @@ -20,7 +20,9 @@ impl Foo for isize { fn boo(&self) -> usize { 42 } } -fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} //~ ERROR E0229 +fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} +//~^ ERROR associated type bindings are not allowed here [E0229] +//~| NOTE associate type not allowed here fn main() { } diff --git a/src/test/compile-fail/E0253.rs b/src/test/compile-fail/E0253.rs new file mode 100644 index 00000000000..28fcf4452b3 --- /dev/null +++ b/src/test/compile-fail/E0253.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod foo { + pub trait MyTrait { + fn do_something(); + } +} + +use foo::MyTrait::do_something; //~ ERROR E0253 + +fn main() {} diff --git a/src/test/compile-fail/E0254.rs b/src/test/compile-fail/E0254.rs new file mode 100644 index 00000000000..28f9aea9657 --- /dev/null +++ b/src/test/compile-fail/E0254.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate collections; + +mod foo { + pub trait collections { + fn do_something(); + } +} + +use foo::collections; //~ ERROR E0254 + +fn main() {} diff --git a/src/test/compile-fail/E0255.rs b/src/test/compile-fail/E0255.rs new file mode 100644 index 00000000000..e05c6bede7e --- /dev/null +++ b/src/test/compile-fail/E0255.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use bar::foo; + +fn foo() {} //~ ERROR E0255 + +mod bar { + pub fn foo() {} +} + +fn main() {} diff --git a/src/test/compile-fail/E0259.rs b/src/test/compile-fail/E0259.rs new file mode 100644 index 00000000000..6b7e8613859 --- /dev/null +++ b/src/test/compile-fail/E0259.rs @@ -0,0 +1,14 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate collections; +extern crate libc as collections; //~ ERROR E0259 + +fn main() {} diff --git a/src/test/compile-fail/E0260.rs b/src/test/compile-fail/E0260.rs new file mode 100644 index 00000000000..d20829bf4d4 --- /dev/null +++ b/src/test/compile-fail/E0260.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate collections; + +mod collections { //~ ERROR E0260 + pub trait MyTrait { + fn do_something(); + } +} + +fn main() {} diff --git a/src/test/compile-fail/E0261.rs b/src/test/compile-fail/E0261.rs new file mode 100644 index 00000000000..4196ad370b8 --- /dev/null +++ b/src/test/compile-fail/E0261.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo(x: &'a str) { } //~ ERROR E0261 + +struct Foo { + x: &'a str, //~ ERROR E0261 +} + +fn main() {} diff --git a/src/test/compile-fail/E0262.rs b/src/test/compile-fail/E0262.rs new file mode 100644 index 00000000000..e09e4766d51 --- /dev/null +++ b/src/test/compile-fail/E0262.rs @@ -0,0 +1,13 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo<'static>(x: &'static str) { } //~ ERROR E0262 + +fn main() {} diff --git a/src/test/compile-fail/E0263.rs b/src/test/compile-fail/E0263.rs new file mode 100644 index 00000000000..09f654c368c --- /dev/null +++ b/src/test/compile-fail/E0263.rs @@ -0,0 +1,13 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { } //~ ERROR E0263 + +fn main() {} diff --git a/src/test/compile-fail/E0264.rs b/src/test/compile-fail/E0264.rs new file mode 100644 index 00000000000..92332977e76 --- /dev/null +++ b/src/test/compile-fail/E0264.rs @@ -0,0 +1,18 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(lang_items)] + +extern "C" { + #[lang = "cake"] + fn cake(); //~ ERROR E0264 +} + +fn main() {} diff --git a/src/test/compile-fail/E0267.rs b/src/test/compile-fail/E0267.rs new file mode 100644 index 00000000000..6287256e866 --- /dev/null +++ b/src/test/compile-fail/E0267.rs @@ -0,0 +1,13 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let w = || { break; }; //~ ERROR E0267 +} diff --git a/src/test/compile-fail/E0268.rs b/src/test/compile-fail/E0268.rs new file mode 100644 index 00000000000..41e88e2f492 --- /dev/null +++ b/src/test/compile-fail/E0268.rs @@ -0,0 +1,13 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + break; //~ ERROR E0268 +} diff --git a/src/test/compile-fail/E0306.rs b/src/test/compile-fail/E0306.rs index 61cc8902036..9ffaef7472b 100644 --- a/src/test/compile-fail/E0306.rs +++ b/src/test/compile-fail/E0306.rs @@ -8,9 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const A: [u32; "hello"] = []; //~ ERROR E0306 -const B: [u32; true] = []; //~ ERROR E0306 -const C: [u32; 0.0] = []; //~ ERROR E0306 +const A: [u32; "hello"] = []; +//~^ ERROR expected `usize` for array length, found string literal [E0306] +//~| NOTE expected `usize` + +const B: [u32; true] = []; +//~^ ERROR expected `usize` for array length, found boolean [E0306] +//~| NOTE expected `usize` + +const C: [u32; 0.0] = []; +//~^ ERROR expected `usize` for array length, found float [E0306] +//~| NOTE expected `usize` fn main() { } diff --git a/src/test/compile-fail/bad-bang-ann-3.rs b/src/test/compile-fail/bad-bang-ann-3.rs index de315a41361..1a5496f0551 100644 --- a/src/test/compile-fail/bad-bang-ann-3.rs +++ b/src/test/compile-fail/bad-bang-ann-3.rs @@ -11,7 +11,9 @@ // Tests that a function with a ! annotation always actually fails fn bad_bang(i: usize) -> ! { - return 7; //~ ERROR `return` in a function declared as diverging [E0166] + return 7; + //~^ ERROR `return` in a function declared as diverging [E0166] + //~| NOTE diverging function cannot return } fn main() { bad_bang(5); } diff --git a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs b/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs index 87e40df7663..ec330247f23 100644 --- a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs +++ b/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs @@ -22,4 +22,6 @@ fn main() { let mut books = vec![1,2,3]; spawn(|| books.push(4)); //~^ ERROR E0373 + //~| NOTE `books` is borrowed here + //~| NOTE may outlive borrowed value `books` } diff --git a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs b/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs index 67700be890b..81685c32f2f 100644 --- a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs +++ b/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs @@ -20,6 +20,8 @@ fn foo<'a>(x: &'a i32) -> Box<FnMut()+'a> { let mut books = vec![1,2,3]; Box::new(|| books.push(4)) //~^ ERROR E0373 + //~| NOTE `books` is borrowed here + //~| NOTE may outlive borrowed value `books` } fn main() { } diff --git a/src/test/compile-fail/const-fn-mismatch.rs b/src/test/compile-fail/const-fn-mismatch.rs index d813cf32954..92568b27f7c 100644 --- a/src/test/compile-fail/const-fn-mismatch.rs +++ b/src/test/compile-fail/const-fn-mismatch.rs @@ -20,7 +20,9 @@ trait Foo { } impl Foo for u32 { - const fn f() -> u32 { 22 } //~ ERROR E0379 + const fn f() -> u32 { 22 } + //~^ ERROR E0379 + //~| NOTE trait fns cannot be const } fn main() { } diff --git a/src/test/compile-fail/const-integer-bool-ops.rs b/src/test/compile-fail/const-integer-bool-ops.rs index 5dadd892f83..398dc2f2215 100644 --- a/src/test/compile-fail/const-integer-bool-ops.rs +++ b/src/test/compile-fail/const-integer-bool-ops.rs @@ -25,17 +25,35 @@ const X3: usize = -42 && -39; //~ ERROR E0080 const ARR3: [i32; X3] = [99; 6]; //~ NOTE: for array length here const Y: usize = 42.0 == 42.0; -const ARRR: [i32; Y] = [99; 1]; //~ ERROR: expected usize for array length +const ARRR: [i32; Y] = [99; 1]; +//~^ ERROR: expected `usize` for array length, found boolean [E0306] +//~| NOTE expected `usize` + const Y1: usize = 42.0 >= 42.0; -const ARRR1: [i32; Y] = [99; 1]; //~ ERROR: expected usize for array length +const ARRR1: [i32; Y] = [99; 1]; +//~^ ERROR: expected `usize` for array length, found boolean [E0306] +//~| NOTE expected `usize` + const Y2: usize = 42.0 <= 42.0; -const ARRR2: [i32; Y] = [99; 1]; //~ ERROR: expected usize for array length +const ARRR2: [i32; Y] = [99; 1]; +//~^ ERROR: expected `usize` for array length, found boolean [E0306] +//~| NOTE expected `usize` + const Y3: usize = 42.0 > 42.0; -const ARRR3: [i32; Y] = [99; 0]; //~ ERROR: expected usize for array length +const ARRR3: [i32; Y] = [99; 0]; +//~^ ERROR: expected `usize` for array length, found boolean [E0306] +//~| NOTE expected `usize` + const Y4: usize = 42.0 < 42.0; -const ARRR4: [i32; Y] = [99; 0]; //~ ERROR: expected usize for array length +const ARRR4: [i32; Y] = [99; 0]; +//~^ ERROR: expected `usize` for array length, found boolean [E0306] +//~| NOTE expected `usize` + const Y5: usize = 42.0 != 42.0; -const ARRR5: [i32; Y] = [99; 0]; //~ ERROR: expected usize for array length +const ARRR5: [i32; Y] = [99; 0]; +//~^ ERROR: expected `usize` for array length, found boolean [E0306] +//~| NOTE expected `usize` + fn main() { let _ = ARR; diff --git a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs b/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs index 23401db21d8..d48433ee928 100644 --- a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs +++ b/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs @@ -19,6 +19,7 @@ trait Fun { struct Holder { x: String } impl<'a> Fun for Holder { //~ ERROR E0207 + //~| NOTE unconstrained lifetime parameter type Output = &'a str; fn call<'b>(&'b self) -> &'b str { &self.x[..] diff --git a/src/test/compile-fail/impl-wrong-item-for-trait.rs b/src/test/compile-fail/impl-wrong-item-for-trait.rs index 9b3e28cbc01..6452e50d089 100644 --- a/src/test/compile-fail/impl-wrong-item-for-trait.rs +++ b/src/test/compile-fail/impl-wrong-item-for-trait.rs @@ -12,7 +12,9 @@ trait Foo { fn bar(&self); - const MY_CONST: u32; + //~^ NOTE original trait requirement + //~| NOTE original trait requirement + const MY_CONST: u32; //~ NOTE original trait requirement } pub struct FooConstForMethod; @@ -21,6 +23,7 @@ impl Foo for FooConstForMethod { //~^ ERROR E0046 const bar: u64 = 1; //~^ ERROR E0323 + //~| NOTE does not match trait const MY_CONST: u32 = 1; } @@ -31,6 +34,7 @@ impl Foo for FooMethodForConst { fn bar(&self) {} fn MY_CONST() {} //~^ ERROR E0324 + //~| NOTE does not match trait } pub struct FooTypeForMethod; @@ -39,6 +43,7 @@ impl Foo for FooTypeForMethod { //~^ ERROR E0046 type bar = u64; //~^ ERROR E0325 + //~| NOTE does not match trait const MY_CONST: u32 = 1; } diff --git a/src/test/compile-fail/issue-15524.rs b/src/test/compile-fail/issue-15524.rs index bdf344dcdfe..3d6f224c249 100644 --- a/src/test/compile-fail/issue-15524.rs +++ b/src/test/compile-fail/issue-15524.rs @@ -12,13 +12,18 @@ const N: isize = 1; enum Foo { A = 1, - B = 1, //~ ERROR discriminant value `1isize` already exists - //~^^ NOTE conflicting + //~^ NOTE first use + //~| NOTE first use + //~| NOTE first use + B = 1, //~ ERROR discriminant value + //~^ NOTE enum already C = 0, - D, //~ ERROR discriminant value `1isize` already exists - //~^^^^^ NOTE conflicting - E = N, //~ ERROR discriminant value `1isize` already exists - //~^^^^^^^ NOTE conflicting + D, //~ ERROR discriminant value + //~^ NOTE enum already + + E = N, //~ ERROR discriminant value + //~^ NOTE enum already + } fn main() {} diff --git a/src/test/compile-fail/issue-22886.rs b/src/test/compile-fail/issue-22886.rs index 4aa2571cad0..d258a4a8b33 100644 --- a/src/test/compile-fail/issue-22886.rs +++ b/src/test/compile-fail/issue-22886.rs @@ -21,6 +21,7 @@ fn crash_please() { struct Newtype(Option<Box<usize>>); impl<'a> Iterator for Newtype { //~ ERROR E0207 + //~| NOTE unconstrained lifetime parameter type Item = &'a Box<usize>; fn next(&mut self) -> Option<&Box<usize>> { diff --git a/src/test/compile-fail/issue-23543.rs b/src/test/compile-fail/issue-23543.rs index 4ed44154c47..f1c559b6b88 100644 --- a/src/test/compile-fail/issue-23543.rs +++ b/src/test/compile-fail/issue-23543.rs @@ -16,6 +16,7 @@ pub trait D { fn f<T>(self) where T<Bogus = Foo>: A; //~^ ERROR associated type bindings are not allowed here [E0229] + //~| NOTE associate type not allowed here } fn main() {} diff --git a/src/test/compile-fail/issue-23544.rs b/src/test/compile-fail/issue-23544.rs index 1d7c2187045..3959c22d1d4 100644 --- a/src/test/compile-fail/issue-23544.rs +++ b/src/test/compile-fail/issue-23544.rs @@ -14,6 +14,7 @@ pub trait D { fn f<T>(self) where T<Bogus = Self::AlsoBogus>: A; //~^ ERROR associated type bindings are not allowed here [E0229] + //~| NOTE associate type not allowed here } fn main() {} diff --git a/src/test/compile-fail/issue-27008.rs b/src/test/compile-fail/issue-27008.rs index ee6ec527612..e89bff025e0 100644 --- a/src/test/compile-fail/issue-27008.rs +++ b/src/test/compile-fail/issue-27008.rs @@ -16,5 +16,6 @@ fn main() { //~| expected type `usize` //~| found type `S` //~| expected usize, found struct `S` - //~| ERROR expected usize for repeat count, found struct + //~| ERROR expected `usize` for repeat count, found struct [E0306] + //~| expected `usize` } diff --git a/src/test/compile-fail/issue-35139.rs b/src/test/compile-fail/issue-35139.rs index 67f0e7aaf97..5c4f161a500 100644 --- a/src/test/compile-fail/issue-35139.rs +++ b/src/test/compile-fail/issue-35139.rs @@ -17,6 +17,7 @@ pub trait MethodType { pub struct MTFn; impl<'a> MethodType for MTFn { //~ ERROR E0207 + //~| NOTE unconstrained lifetime parameter type GetProp = fmt::Debug + 'a; } diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/compile-fail/issue-4335.rs index 9a1b5d9b83d..09371fbafcb 100644 --- a/src/test/compile-fail/issue-4335.rs +++ b/src/test/compile-fail/issue-4335.rs @@ -14,7 +14,10 @@ fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. id(Box::new(|| *v)) //~^ ERROR E0373 - //~| ERROR cannot move out of borrowed content + //~| NOTE `v` is borrowed here + //~| NOTE may outlive borrowed value `v` + //~| ERROR E0507 + //~| NOTE cannot move out of borrowed content } fn main() { diff --git a/src/test/compile-fail/non-exhaustive-pattern-witness.rs b/src/test/compile-fail/non-exhaustive-pattern-witness.rs index 0b12a9acbcb..eba61ede8cb 100644 --- a/src/test/compile-fail/non-exhaustive-pattern-witness.rs +++ b/src/test/compile-fail/non-exhaustive-pattern-witness.rs @@ -19,6 +19,7 @@ struct Foo { fn struct_with_a_nested_enum_and_vector() { match (Foo { first: true, second: None }) { //~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered +//~| NOTE pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered Foo { first: true, second: None } => (), Foo { first: true, second: Some(_) } => (), Foo { first: false, second: None } => (), @@ -35,6 +36,7 @@ enum Color { fn enum_with_single_missing_variant() { match Color::Red { //~^ ERROR non-exhaustive patterns: `Red` not covered + //~| NOTE pattern `Red` not covered Color::CustomRGBA { .. } => (), Color::Green => () } @@ -47,6 +49,7 @@ enum Direction { fn enum_with_multiple_missing_variants() { match Direction::North { //~^ ERROR non-exhaustive patterns: `East`, `South` and `West` not covered + //~| NOTE patterns `East`, `South` and `West` not covered Direction::North => () } } @@ -58,6 +61,7 @@ enum ExcessiveEnum { fn enum_with_excessive_missing_variants() { match ExcessiveEnum::First { //~^ ERROR `Second`, `Third`, `Fourth` and 8 more not covered + //~| NOTE patterns `Second`, `Third`, `Fourth` and 8 more not covered ExcessiveEnum::First => () } @@ -66,6 +70,7 @@ fn enum_with_excessive_missing_variants() { fn enum_struct_variant() { match Color::Red { //~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered + //~| NOTE pattern `CustomRGBA { a: true, .. }` not covered Color::Red => (), Color::Green => (), Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (), @@ -82,6 +87,7 @@ fn vectors_with_nested_enums() { let x: &'static [Enum] = &[Enum::First, Enum::Second(false)]; match *x { //~^ ERROR non-exhaustive patterns: `[Second(true), Second(false)]` not covered + //~| NOTE pattern `[Second(true), Second(false)]` not covered [] => (), [_] => (), [Enum::First, _] => (), @@ -95,6 +101,7 @@ fn vectors_with_nested_enums() { fn missing_nil() { match ((), false) { //~^ ERROR non-exhaustive patterns: `((), false)` not covered + //~| NOTE pattern `((), false)` not covered ((), true) => () } } diff --git a/src/test/compile-fail/region-borrow-params-issue-29793-small.rs b/src/test/compile-fail/region-borrow-params-issue-29793-small.rs index 4fda8ec3f38..6be2adbe2a0 100644 --- a/src/test/compile-fail/region-borrow-params-issue-29793-small.rs +++ b/src/test/compile-fail/region-borrow-params-issue-29793-small.rs @@ -16,6 +16,10 @@ fn escaping_borrow_of_closure_params_1() { let g = |x: usize, y:usize| { + //~^ NOTE reference must be valid for the scope of call-site for function + //~| NOTE ...but borrowed value is only valid for the scope of function body + //~| NOTE reference must be valid for the scope of call-site for function + //~| NOTE ...but borrowed value is only valid for the scope of function body let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR `x` does not live long enough //~| ERROR `y` does not live long enough @@ -31,6 +35,10 @@ fn escaping_borrow_of_closure_params_1() { fn escaping_borrow_of_closure_params_2() { let g = |x: usize, y:usize| { + //~^ NOTE reference must be valid for the scope of call-site for function + //~| NOTE ...but borrowed value is only valid for the scope of function body + //~| NOTE reference must be valid for the scope of call-site for function + //~| NOTE ...but borrowed value is only valid for the scope of function body let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR `x` does not live long enough //~| ERROR `y` does not live long enough @@ -64,7 +72,11 @@ fn escaping_borrow_of_fn_params_1() { fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 + //~| NOTE `x` is borrowed here + //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 + //~| NOTE `y` is borrowed here + //~| NOTE may outlive borrowed value `y` return Box::new(f); }; @@ -75,7 +87,11 @@ fn escaping_borrow_of_fn_params_2() { fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 + //~| NOTE `x` is borrowed here + //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 + //~| NOTE `y` is borrowed here + //~| NOTE may outlive borrowed value `y` Box::new(f) }; @@ -99,7 +115,11 @@ fn escaping_borrow_of_method_params_1() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 + //~| NOTE `x` is borrowed here + //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 + //~| NOTE `y` is borrowed here + //~| NOTE may outlive borrowed value `y` return Box::new(f); } } @@ -113,7 +133,11 @@ fn escaping_borrow_of_method_params_2() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 + //~| NOTE `x` is borrowed here + //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 + //~| NOTE `y` is borrowed here + //~| NOTE may outlive borrowed value `y` Box::new(f) } } @@ -141,7 +165,11 @@ fn escaping_borrow_of_trait_impl_params_1() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 + //~| NOTE `x` is borrowed here + //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 + //~| NOTE `y` is borrowed here + //~| NOTE may outlive borrowed value `y` return Box::new(f); } } @@ -156,7 +184,11 @@ fn escaping_borrow_of_trait_impl_params_2() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 + //~| NOTE `x` is borrowed here + //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 + //~| NOTE `y` is borrowed here + //~| NOTE may outlive borrowed value `y` Box::new(f) } } @@ -184,7 +216,11 @@ fn escaping_borrow_of_trait_default_params_1() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 + //~| NOTE `x` is borrowed here + //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 + //~| NOTE `y` is borrowed here + //~| NOTE may outlive borrowed value `y` return Box::new(f); } } @@ -198,7 +234,11 @@ fn escaping_borrow_of_trait_default_params_2() { fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 + //~| NOTE `x` is borrowed here + //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 + //~| NOTE `y` is borrowed here + //~| NOTE may outlive borrowed value `y` Box::new(f) } } diff --git a/src/test/compile-fail/regions-nested-fns-2.rs b/src/test/compile-fail/regions-nested-fns-2.rs index 948dc8cd219..40ba34b26ed 100644 --- a/src/test/compile-fail/regions-nested-fns-2.rs +++ b/src/test/compile-fail/regions-nested-fns-2.rs @@ -13,8 +13,11 @@ fn ignore<F>(_f: F) where F: for<'z> FnOnce(&'z isize) -> &'z isize {} fn nested() { let y = 3; ignore( - |z| { //~ ERROR E0373 + |z| { + //~^ ERROR E0373 + //~| NOTE may outlive borrowed value `y` if false { &y } else { z } + //~^ NOTE `y` is borrowed here }); } diff --git a/src/test/compile-fail/repeat_count.rs b/src/test/compile-fail/repeat_count.rs index 1758b28a324..555dd0f0c39 100644 --- a/src/test/compile-fail/repeat_count.rs +++ b/src/test/compile-fail/repeat_count.rs @@ -20,23 +20,27 @@ fn main() { //~| expected type `usize` //~| found type `()` //~| expected usize, found () - //~| ERROR expected usize for repeat count, found tuple [E0306] + //~| ERROR expected `usize` for repeat count, found tuple [E0306] + //~| expected `usize` let c = [0; true]; //~^ ERROR mismatched types //~| expected usize, found bool - //~| ERROR expected usize for repeat count, found boolean [E0306] + //~| ERROR expected `usize` for repeat count, found boolean [E0306] + //~| expected `usize` let d = [0; 0.5]; //~^ ERROR mismatched types //~| expected type `usize` //~| found type `{float}` //~| expected usize, found floating-point variable - //~| ERROR expected usize for repeat count, found float [E0306] + //~| ERROR expected `usize` for repeat count, found float [E0306] + //~| expected `usize` let e = [0; "foo"]; //~^ ERROR mismatched types //~| expected type `usize` //~| found type `&'static str` //~| expected usize, found &-ptr - //~| ERROR expected usize for repeat count, found string literal [E0306] + //~| ERROR expected `usize` for repeat count, found string literal [E0306] + //~| expected `usize` let f = [0; -4_isize]; //~^ ERROR constant evaluation error //~| expected usize, found isize @@ -55,5 +59,6 @@ fn main() { //~| expected type `usize` //~| found type `main::G` //~| expected usize, found struct `main::G` - //~| ERROR expected usize for repeat count, found struct [E0306] + //~| ERROR expected `usize` for repeat count, found struct [E0306] + //~| expected `usize` } |
