diff options
| author | bors <bors@rust-lang.org> | 2015-12-16 12:16:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-12-16 12:16:43 +0000 |
| commit | 785a8a6681963ff389b5902e7d6bd30006fafe0a (patch) | |
| tree | 60b51ca2c9f0efd343f24eb564f90b5697a74c87 /src/test | |
| parent | ce7bc51933e2facb4eca029ac17b398f372f5b41 (diff) | |
| parent | f0361a05028ec9bf8ef256432c212f1d7f3bc115 (diff) | |
Auto merge of #30410 - Manishearth:rollup, r=Manishearth
- Successful merges: #30320, #30368, #30372, #30376, #30388, #30392 - Failed merges: #30354, #30389
Diffstat (limited to 'src/test')
31 files changed, 92 insertions, 45 deletions
diff --git a/src/test/compile-fail-fulldeps/qquote.rs b/src/test/compile-fail-fulldeps/qquote.rs index 7ffbbe69c3d..3e153a21e5d 100644 --- a/src/test/compile-fail-fulldeps/qquote.rs +++ b/src/test/compile-fail-fulldeps/qquote.rs @@ -23,7 +23,8 @@ fn main() { let ps = syntax::parse::ParseSess::new(); let mut cx = syntax::ext::base::ExtCtxt::new( &ps, vec![], - syntax::ext::expand::ExpansionConfig::default("qquote".to_string())); + syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), + &mut Vec::new()); cx.bt_push(syntax::codemap::ExpnInfo { call_site: DUMMY_SP, callee: syntax::codemap::NameAndSpan { diff --git a/src/test/compile-fail/associated-types-coherence-failure.rs b/src/test/compile-fail/associated-types-coherence-failure.rs index 915cb077787..6d68da54112 100644 --- a/src/test/compile-fail/associated-types-coherence-failure.rs +++ b/src/test/compile-fail/associated-types-coherence-failure.rs @@ -32,13 +32,13 @@ impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned { impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned { //~^ ERROR E0119 fn into_cow(self) -> Cow<'a, B> { - Cow + Cow(PhantomData) } } impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned { fn into_cow(self) -> Cow<'a, B> { - Cow + Cow(PhantomData) } } diff --git a/src/test/compile-fail/bogus-tag.rs b/src/test/compile-fail/bogus-tag.rs index 704d856f106..a1021500be3 100644 --- a/src/test/compile-fail/bogus-tag.rs +++ b/src/test/compile-fail/bogus-tag.rs @@ -9,14 +9,12 @@ // except according to those terms. -// error-pattern: unresolved - enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), } fn main() { - let red: color = rgb(255, 0, 0); + let red: color = color::rgb(255, 0, 0); match red { - rgb(r, g, b) => { println!("rgb"); } - hsl(h, s, l) => { println!("hsl"); } + color::rgb(r, g, b) => { println!("rgb"); } + color::hsl(h, s, l) => { println!("hsl"); } //~ ERROR no associated } } diff --git a/src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs b/src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs index ce6baeb204c..b08e4bad1e9 100644 --- a/src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs +++ b/src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs @@ -13,7 +13,9 @@ // If the trait is not object-safe, we give a more tailored message // because we're such schnuckels: -trait NotObjectSafe { fn eq(&self, other: Self); } -impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0372 +trait NotObjectSafe { fn eq(&self, other: &Self); } +impl NotObjectSafe for NotObjectSafe { //~ ERROR E0372 + fn eq(&self, other: &Self) { panic!(); } +} fn main() { } diff --git a/src/test/compile-fail/coherence-impls-copy.rs b/src/test/compile-fail/coherence-impls-copy.rs index 1be606c3546..9c210c132a3 100644 --- a/src/test/compile-fail/coherence-impls-copy.rs +++ b/src/test/compile-fail/coherence-impls-copy.rs @@ -28,8 +28,6 @@ impl Copy for MyType {} impl Copy for &'static mut MyType {} //~^ ERROR E0206 -//~| ERROR E0277 -//~| ERROR E0277 impl Clone for MyType { fn clone(&self) -> Self { *self } } impl Copy for (MyType, MyType) {} @@ -42,8 +40,6 @@ impl Copy for &'static NotSync {} impl Copy for [MyType] {} //~^ ERROR E0206 //~| ERROR E0117 -//~| ERROR E0277 -//~| ERROR E0277 impl Copy for &'static [NotSync] {} //~^ ERROR E0206 diff --git a/src/test/compile-fail/coherence-impls-sized.rs b/src/test/compile-fail/coherence-impls-sized.rs index 2ac4bb0492b..167067cb5fc 100644 --- a/src/test/compile-fail/coherence-impls-sized.rs +++ b/src/test/compile-fail/coherence-impls-sized.rs @@ -30,7 +30,6 @@ impl Sized for (MyType, MyType) {} //~ ERROR E0117 impl Sized for &'static NotSync {} //~ ERROR E0322 impl Sized for [MyType] {} //~ ERROR E0117 -//~^ ERROR E0277 impl Sized for &'static [NotSync] {} //~ ERROR E0117 diff --git a/src/test/compile-fail/duplicate-type-parameter.rs b/src/test/compile-fail/duplicate-type-parameter.rs index 42b67337c64..3b0f8ee5bda 100644 --- a/src/test/compile-fail/duplicate-type-parameter.rs +++ b/src/test/compile-fail/duplicate-type-parameter.rs @@ -33,6 +33,7 @@ trait Qux<T,T> {} impl<T,T> Qux<T,T> for Option<T> {} //~^ ERROR the name `T` is already used +//~^^ ERROR the type parameter `T` is not constrained fn main() { } diff --git a/src/test/compile-fail/inner-static-type-parameter.rs b/src/test/compile-fail/inner-static-type-parameter.rs index cf2a70deee5..56b681378cc 100644 --- a/src/test/compile-fail/inner-static-type-parameter.rs +++ b/src/test/compile-fail/inner-static-type-parameter.rs @@ -10,7 +10,7 @@ // see #9186 -enum Bar<T> { What } +enum Bar<T> { What } //~ ERROR parameter `T` is never used fn foo<T>() { static a: Bar<T> = Bar::What; diff --git a/src/test/compile-fail/issue-12796.rs b/src/test/compile-fail/issue-12796.rs index 2249741cdaa..33fbdce4ee2 100644 --- a/src/test/compile-fail/issue-12796.rs +++ b/src/test/compile-fail/issue-12796.rs @@ -9,8 +9,8 @@ // except according to those terms. trait Trait { - fn outer(self) { - fn inner(_: Self) { + fn outer(&self) { + fn inner(_: &Self) { //~^ ERROR can't use type parameters from outer function //~^^ ERROR use of `Self` outside of an impl or trait } diff --git a/src/test/compile-fail/issue-14254.rs b/src/test/compile-fail/issue-14254.rs index ce5fa1f1fe1..5f8ccd0b063 100644 --- a/src/test/compile-fail/issue-14254.rs +++ b/src/test/compile-fail/issue-14254.rs @@ -11,7 +11,7 @@ trait Foo { fn bar(&self); fn baz(&self) { } - fn bah(_: Option<Self>) { } + fn bah(_: Option<&Self>) { } } struct BarTy { diff --git a/src/test/compile-fail/issue-19883.rs b/src/test/compile-fail/issue-19883.rs index c6ff82364b3..7ec3093a6e0 100644 --- a/src/test/compile-fail/issue-19883.rs +++ b/src/test/compile-fail/issue-19883.rs @@ -14,7 +14,7 @@ trait From<Src> { fn from(src: Src) -> <Self as From<Src>>::Output; } -trait To { +trait To: Sized { fn to<Dst: From<Self>>(self) -> <Dst as From<Self>>::Dst //~^ ERROR use of undeclared associated type `From::Dst` diff --git a/src/test/compile-fail/issue-20427.rs b/src/test/compile-fail/issue-20427.rs index a4b25ab9e56..99dd22a888c 100644 --- a/src/test/compile-fail/issue-20427.rs +++ b/src/test/compile-fail/issue-20427.rs @@ -62,7 +62,7 @@ fn usize<'usize>(usize: &'usize usize) -> &'usize usize { usize } fn main() { let bool = true; match bool { - str @ true => if str { i32 as i64 } else { 0 }, + str @ true => if str { i32 as i64 } else { i64 }, false => i64, - } + }; } diff --git a/src/test/compile-fail/issue-23305.rs b/src/test/compile-fail/issue-23305.rs index 4b1010781ff..68f053c357b 100644 --- a/src/test/compile-fail/issue-23305.rs +++ b/src/test/compile-fail/issue-23305.rs @@ -13,5 +13,6 @@ pub trait ToNbt<T> { } impl ToNbt<Self> {} //~ ERROR use of `Self` outside of an impl or trait +//~^ WARNING the trait `ToNbt` cannot be made into an object fn main() {} diff --git a/src/test/compile-fail/issue-2356.rs b/src/test/compile-fail/issue-2356.rs index 48cc27e2289..6b81afe13c6 100644 --- a/src/test/compile-fail/issue-2356.rs +++ b/src/test/compile-fail/issue-2356.rs @@ -9,7 +9,7 @@ // except according to those terms. trait Groom { - fn shave(); + fn shave(other: usize); } pub struct cat { @@ -30,7 +30,7 @@ impl MaybeDog { } impl Groom for cat { - fn shave(&self, other: usize) { + fn shave(other: usize) { whiskers -= other; //~^ ERROR: unresolved name `whiskers`. Did you mean `self.whiskers`? shave(4); diff --git a/src/test/compile-fail/issue-28109.rs b/src/test/compile-fail/issue-28109.rs index 73163caa455..0d372d30015 100644 --- a/src/test/compile-fail/issue-28109.rs +++ b/src/test/compile-fail/issue-28109.rs @@ -11,10 +11,12 @@ // Make sure that label for continue and break is spanned correctly fn main() { - continue - 'b //~ ERROR use of undeclared label - ; - break - 'c //~ ERROR use of undeclared label - ; + loop { + continue + 'b //~ ERROR use of undeclared label + ; + break + 'c //~ ERROR use of undeclared label + ; + } } diff --git a/src/test/compile-fail/issue-3021-d.rs b/src/test/compile-fail/issue-3021-d.rs index 594f68e1812..ecc8ac34ecf 100644 --- a/src/test/compile-fail/issue-3021-d.rs +++ b/src/test/compile-fail/issue-3021-d.rs @@ -13,13 +13,13 @@ trait siphash { fn reset(&self); } -fn siphash(k0 : u64, k1 : u64) -> siphash { +fn siphash(k0 : u64, k1 : u64) { struct SipState { v0: u64, v1: u64, } - fn mk_result(st : SipState) -> u64 { + fn mk_result(st : &SipState) -> u64 { let v0 = st.v0; let v1 = st.v1; diff --git a/src/test/compile-fail/issue-3021.rs b/src/test/compile-fail/issue-3021.rs index 719eef1b63d..7cf772b0728 100644 --- a/src/test/compile-fail/issue-3021.rs +++ b/src/test/compile-fail/issue-3021.rs @@ -12,7 +12,7 @@ trait SipHash { fn reset(&self); } -fn siphash(k0 : u64) -> SipHash { +fn siphash(k0 : u64) { struct SipState { v0: u64, } diff --git a/src/test/compile-fail/issue-3214.rs b/src/test/compile-fail/issue-3214.rs index be49ca1fe06..27b7fb75275 100644 --- a/src/test/compile-fail/issue-3214.rs +++ b/src/test/compile-fail/issue-3214.rs @@ -15,6 +15,8 @@ fn foo<T>() { } impl<T> Drop for foo<T> { + //~^ ERROR wrong number of type arguments + //~^^ ERROR the type parameter `T` is not constrained fn drop(&mut self) {} } } diff --git a/src/test/compile-fail/issue-3521.rs b/src/test/compile-fail/issue-3521.rs index f06aa45ac38..34cd8cae2de 100644 --- a/src/test/compile-fail/issue-3521.rs +++ b/src/test/compile-fail/issue-3521.rs @@ -16,6 +16,7 @@ fn main() { Bar = foo //~^ ERROR attempt to use a non-constant value in a constant //~| ERROR unresolved name `foo` + //~^^^ ERROR constant evaluation error: non-constant path in constant expression } println!("{}", Stuff::Bar); diff --git a/src/test/compile-fail/issue-3973.rs b/src/test/compile-fail/issue-3973.rs index 2652fb5dfc2..1fda423e9ee 100644 --- a/src/test/compile-fail/issue-3973.rs +++ b/src/test/compile-fail/issue-3973.rs @@ -30,5 +30,7 @@ impl ToString_ for Point { fn main() { let p = Point::new(0.0, 0.0); + //~^ ERROR no associated item named `new` found for type `Point` in the current scope println!("{}", p.to_string()); + //~^ ERROR the type of this value must be known in this context } diff --git a/src/test/compile-fail/issue-5927.rs b/src/test/compile-fail/issue-5927.rs index 0359248b36a..e5f091d873d 100644 --- a/src/test/compile-fail/issue-5927.rs +++ b/src/test/compile-fail/issue-5927.rs @@ -9,12 +9,10 @@ // except according to those terms. - -// error-pattern:unresolved enum variant - fn main() { let z = match 3 { - x(1) => x(1) + x(1) => x(1) //~ ERROR unresolved enum variant + //~^ ERROR unresolved name `x` }; - assert_eq!(z,3); + assert!(z == 3); } diff --git a/src/test/compile-fail/issue-9725.rs b/src/test/compile-fail/issue-9725.rs index 1a3c926ba38..f53122d19c1 100644 --- a/src/test/compile-fail/issue-9725.rs +++ b/src/test/compile-fail/issue-9725.rs @@ -13,4 +13,5 @@ struct A { foo: isize } fn main() { let A { foo, foo } = A { foo: 3 }; //~^ ERROR: identifier `foo` is bound more than once in the same pattern + //~^^ ERROR: field `foo` bound multiple times } diff --git a/src/test/compile-fail/macro-parameter-span.rs b/src/test/compile-fail/macro-parameter-span.rs new file mode 100644 index 00000000000..2ef69759128 --- /dev/null +++ b/src/test/compile-fail/macro-parameter-span.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! foo { + ($id: ident) => { + $id + } +} + +// Testing that the error span points to the parameter 'x' in the callsite, +// not to the macro variable '$id' +fn main() { + foo!( + x //~ ERROR unresolved name `x` + ); +} diff --git a/src/test/compile-fail/mod_file_correct_spans.rs b/src/test/compile-fail/mod_file_correct_spans.rs index 3b794da1053..f8ea5dda183 100644 --- a/src/test/compile-fail/mod_file_correct_spans.rs +++ b/src/test/compile-fail/mod_file_correct_spans.rs @@ -13,5 +13,5 @@ mod mod_file_aux; fn main() { - assert_eq!(mod_file_aux::bar(), 10); //~ ERROR unresolved name + assert!(mod_file_aux::bar() == 10); //~ ERROR unresolved name } diff --git a/src/test/compile-fail/opt-in-copy.rs b/src/test/compile-fail/opt-in-copy.rs index be321b62903..bc18b52a0c1 100644 --- a/src/test/compile-fail/opt-in-copy.rs +++ b/src/test/compile-fail/opt-in-copy.rs @@ -16,7 +16,6 @@ struct IWantToCopyThis { impl Copy for IWantToCopyThis {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| ERROR E0277 enum CantCopyThisEither { A, @@ -29,6 +28,5 @@ enum IWantToCopyThisToo { impl Copy for IWantToCopyThisToo {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| ERROR E0277 fn main() {} diff --git a/src/test/compile-fail/resolve-inconsistent-binding-mode.rs b/src/test/compile-fail/resolve-inconsistent-binding-mode.rs index cdb81279048..284c08ef09b 100644 --- a/src/test/compile-fail/resolve-inconsistent-binding-mode.rs +++ b/src/test/compile-fail/resolve-inconsistent-binding-mode.rs @@ -16,6 +16,7 @@ fn matcher1(x: opts) { match x { opts::a(ref i) | opts::b(i) => {} //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 + //~^^ ERROR mismatched types opts::c(_) => {} } } @@ -24,6 +25,7 @@ fn matcher2(x: opts) { match x { opts::a(ref i) | opts::b(i) => {} //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 + //~^^ ERROR mismatched types opts::c(_) => {} } } @@ -32,6 +34,7 @@ fn matcher4(x: opts) { match x { opts::a(ref mut i) | opts::b(ref i) => {} //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 + //~^^ ERROR mismatched types opts::c(_) => {} } } diff --git a/src/test/compile-fail/resolve-type-param-in-item-in-trait.rs b/src/test/compile-fail/resolve-type-param-in-item-in-trait.rs index 341fe173a03..88f09233d10 100644 --- a/src/test/compile-fail/resolve-type-param-in-item-in-trait.rs +++ b/src/test/compile-fail/resolve-type-param-in-item-in-trait.rs @@ -15,6 +15,7 @@ trait TraitA<A> { fn outer(self) { enum Foo<B> { + //~^ ERROR parameter `B` is never used Variance(A) //~^ ERROR can't use type parameters from outer function //~^^ ERROR use of undeclared type name `A` @@ -27,6 +28,7 @@ trait TraitB<A> { struct Foo<B>(A); //~^ ERROR can't use type parameters from outer function //~^^ ERROR use of undeclared type name `A` + //~^^^ ERROR parameter `B` is never used } } @@ -35,6 +37,7 @@ trait TraitC<A> { struct Foo<B> { a: A } //~^ ERROR can't use type parameters from outer function //~^^ ERROR use of undeclared type name `A` + //~^^^ ERROR parameter `B` is never used } } diff --git a/src/test/compile-fail/syntax-extension-minor.rs b/src/test/compile-fail/syntax-extension-minor.rs index 506aed6b2ee..38a6834a9c4 100644 --- a/src/test/compile-fail/syntax-extension-minor.rs +++ b/src/test/compile-fail/syntax-extension-minor.rs @@ -14,7 +14,7 @@ pub fn main() { let asdf_fdsa = "<.<".to_string(); - assert_eq!(concat_idents!(asd, f_f, dsa), "<.<".to_string()); + assert!(concat_idents!(asd, f_f, dsa) == "<.<".to_string()); //~^ ERROR: unresolved name `asdf_fdsa` assert_eq!(stringify!(use_mention_distinction), "use_mention_distinction"); diff --git a/src/test/compile-fail/trait-safety-trait-impl-cc.rs b/src/test/compile-fail/trait-safety-trait-impl-cc.rs index 6050b549b65..f30c8f521bd 100644 --- a/src/test/compile-fail/trait-safety-trait-impl-cc.rs +++ b/src/test/compile-fail/trait-safety-trait-impl-cc.rs @@ -18,7 +18,7 @@ extern crate trait_safety_lib as lib; struct Bar; impl lib::Foo for Bar { //~ ERROR requires an `unsafe impl` declaration fn foo(&self) -> isize { - *self as isize + panic!(); } } diff --git a/src/test/compile-fail/trait-safety-trait-impl.rs b/src/test/compile-fail/trait-safety-trait-impl.rs index 1bd6d763607..e846b660c2a 100644 --- a/src/test/compile-fail/trait-safety-trait-impl.rs +++ b/src/test/compile-fail/trait-safety-trait-impl.rs @@ -12,11 +12,11 @@ // impls cannot be unsafe. trait SafeTrait { - fn foo(self) { } + fn foo(&self) { } } unsafe trait UnsafeTrait { - fn foo(self) { } + fn foo(&self) { } } unsafe impl UnsafeTrait for u8 { } // OK diff --git a/src/test/rustdoc/issue-30252.rs b/src/test/rustdoc/issue-30252.rs new file mode 100644 index 00000000000..11d161fe188 --- /dev/null +++ b/src/test/rustdoc/issue-30252.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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:--test --cfg feature="bar" + +/// ```rust +/// assert_eq!(cfg!(feature = "bar"), true); +/// ``` +pub fn foo() {} |
