Skip to content

Rollup of 14 pull requests #35441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 29 commits into from
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2f5294e
Fixes #35304
mikhail-m1 Aug 5, 2016
e7e5cfe
Merge branch 'master' of https://github.com/rust-lang/rust
mikhail-m1 Aug 5, 2016
9f09ee5
Updates compiler error E0046 with new format
shri3k Aug 5, 2016
e5a4a7a
Updates compiler error E0040 with new format
shri3k Aug 5, 2016
5bab0e6
Update E0206 message to new format
KiChjang Aug 5, 2016
065c685
Update E0223 to the new format
KiChjang Aug 6, 2016
c9e9d42
Update compiler error 0027 to use new error format.
silenuss Aug 6, 2016
1d25e2e
Update compiler error 0029 to use new error format.
silenuss Aug 6, 2016
f4dd1f9
Updated error message E0252
Aug 5, 2016
eb469d6
Updated E0225 to new format.
razielgn Aug 6, 2016
6eba89e
Fixing compiler error E0121
intrepion Aug 6, 2016
95cce86
Indicate tracking issue for `exact_size_is_empty` unstability.
frewsxcv Aug 6, 2016
19e4579
Updated error message E0282
Aug 5, 2016
0a6b862
Add doc example for `std::ffi::NulError::into_vec`.
frewsxcv Aug 6, 2016
5e06da2
E0131 updated to new format
Aug 6, 2016
31f0204
Rollup merge of #35355 - shri3k:E0046, r=jonathandturner
Aug 7, 2016
ef75709
Rollup merge of #35357 - shri3k:E0040, r=GuillaumeGomez
Aug 7, 2016
7794eb6
Rollup merge of #35362 - medzin:E0252, r=GuillaumeGomez
Aug 7, 2016
4985246
Rollup merge of #35366 - medzin:E0282, r=jonathandturner
Aug 7, 2016
61ce47a
Rollup merge of #35394 - mikhail-m1:master, r=jonathandturner
Aug 7, 2016
c67a142
Rollup merge of #35402 - KiChjang:e0206-new-msg, r=GuillaumeGomez
Aug 7, 2016
d25e47c
Rollup merge of #35410 - silenuss:e0027-formatting, r=jonathandturner
Aug 7, 2016
8b5f384
Rollup merge of #35411 - KiChjang:e0223-new-format, r=jonathandturner
Aug 7, 2016
06a217d
Rollup merge of #35413 - silenuss:e0029-formatting, r=jonathandturner
Aug 7, 2016
85bf1b6
Rollup merge of #35417 - Limeth:master, r=jonathandturner
Aug 7, 2016
6a720fb
Rollup merge of #35421 - razielgn:updated-e0225-to-new-format, r=jona…
Aug 7, 2016
1c203e3
Rollup merge of #35429 - frewsxcv:tracking-is-empty, r=apasel422
Aug 7, 2016
c150ce6
Rollup merge of #35434 - intrepion:fix-compile-fail-e0121, r=jonathan…
Aug 7, 2016
d9e6bbd
Rollup merge of #35436 - frewsxcv:into-vec, r=GuillaumeGomez
Aug 7, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libcore/iter/traits.rs
Original file line number Diff line number Diff line change
@@ -548,7 +548,7 @@ pub trait ExactSizeIterator: Iterator {
/// assert_eq!(one_element.next(), None);
/// ```
#[inline]
#[unstable(feature = "exact_size_is_empty", issue = "0")]
#[unstable(feature = "exact_size_is_empty", issue = "35428")]
fn is_empty(&self) -> bool {
self.len() == 0
}
10 changes: 6 additions & 4 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
@@ -870,10 +870,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {


fn need_type_info(&self, span: Span, ty: Ty<'tcx>) {
span_err!(self.tcx.sess, span, E0282,
"unable to infer enough type information about `{}`; \
type annotations or generic parameter binding required",
ty);
let mut err = struct_span_err!(self.tcx.sess, span, E0282,
"unable to infer enough type information about `{}`",
ty);
err.note("type annotations or generic parameter binding required");
err.span_label(span, &format!("cannot infer type for `{}`", ty));
err.emit()
}

fn note_obligation_cause<T>(&self,
6 changes: 5 additions & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
@@ -3375,7 +3375,11 @@ impl<'a> Resolver<'a> {
(true, _) | (_, true) => struct_span_err!(self.session, span, E0260, "{}", msg),
_ => match (old_binding.is_import(), binding.is_import()) {
(false, false) => struct_span_err!(self.session, span, E0428, "{}", msg),
(true, true) => struct_span_err!(self.session, span, E0252, "{}", msg),
(true, true) => {
let mut e = struct_span_err!(self.session, span, E0252, "{}", msg);
e.span_label(span, &format!("already imported"));
e
},
_ => {
let mut e = struct_span_err!(self.session, span, E0255, "{}", msg);
e.span_label(span, &format!("`{}` was already imported", name));
17 changes: 11 additions & 6 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
@@ -1215,10 +1215,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
type_str: &str,
trait_str: &str,
name: &str) {
span_err!(self.tcx().sess, span, E0223,
"ambiguous associated type; specify the type using the syntax \
`<{} as {}>::{}`",
type_str, trait_str, name);
struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type")
.span_label(span, &format!("ambiguous associated type"))
.note(&format!("specify the type using the syntax `<{} as {}>::{}`",
type_str, trait_str, name))
.emit();

}

// Search for a bound on a type parameter which includes the associated item
@@ -2095,8 +2097,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {

if !trait_bounds.is_empty() {
let b = &trait_bounds[0];
span_err!(self.tcx().sess, b.trait_ref.path.span, E0225,
"only the builtin traits can be used as closure or object bounds");
let span = b.trait_ref.path.span;
struct_span_err!(self.tcx().sess, span, E0225,
"only the builtin traits can be used as closure or object bounds")
.span_label(span, &format!("non-builtin trait used as bounds"))
.emit();
}

let region_bound =
21 changes: 11 additions & 10 deletions src/librustc_typeck/check/_match.rs
Original file line number Diff line number Diff line change
@@ -93,13 +93,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
end.span
};

// Note: spacing here is intentional, we want a space before "start" and "end".
span_err!(tcx.sess, span, E0029,
"only char and numeric types are allowed in range patterns\n \
start type: {}\n end type: {}",
self.ty_to_string(lhs_ty),
self.ty_to_string(rhs_ty)
);
struct_span_err!(tcx.sess, span, E0029,
"only char and numeric types are allowed in range patterns")
.span_label(span, &format!("ranges require char or numeric types"))
.note(&format!("start type: {}", self.ty_to_string(lhs_ty)))
.note(&format!("end type: {}", self.ty_to_string(rhs_ty)))
.emit();
return;
}

@@ -700,9 +699,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
for field in variant.fields
.iter()
.filter(|field| !used_fields.contains_key(&field.name)) {
span_err!(tcx.sess, span, E0027,
"pattern does not mention field `{}`",
field.name);
struct_span_err!(tcx.sess, span, E0027,
"pattern does not mention field `{}`",
field.name)
.span_label(span, &format!("missing field `{}`", field.name))
.emit();
}
}
}
4 changes: 3 additions & 1 deletion src/librustc_typeck/check/callee.rs
Original file line number Diff line number Diff line change
@@ -28,7 +28,9 @@ use rustc::hir;
/// method that is called)
pub fn check_legal_trait_for_method_call(ccx: &CrateCtxt, span: Span, trait_id: DefId) {
if ccx.tcx.lang_items.drop_trait() == Some(trait_id) {
span_err!(ccx.tcx.sess, span, E0040, "explicit use of destructor method");
struct_span_err!(ccx.tcx.sess, span, E0040, "explicit use of destructor method")
.span_label(span, &format!("call to destructor method"))
.emit();
}
}

7 changes: 6 additions & 1 deletion src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
@@ -1136,11 +1136,16 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
}

if !missing_items.is_empty() {
span_err!(tcx.sess, impl_span, E0046,
struct_span_err!(tcx.sess, impl_span, E0046,
"not all trait items implemented, missing: `{}`",
missing_items.iter()
.map(|name| name.to_string())
.collect::<Vec<_>>().join("`, `"))
.span_label(impl_span, &format!("missing `{}` in implementation",
missing_items.iter()
.map(|name| name.to_string())
.collect::<Vec<_>>().join("`, `"))
).emit();
}

if !invalidated_items.is_empty() {
15 changes: 11 additions & 4 deletions src/librustc_typeck/coherence/mod.rs
Original file line number Diff line number Diff line change
@@ -325,10 +325,17 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
name)
}
Err(CopyImplementationError::NotAnAdt) => {
span_err!(tcx.sess, span, E0206,
"the trait `Copy` may not be implemented \
for this type; type is not a structure or \
enumeration")
let item = tcx.map.expect_item(impl_node_id);
let span = if let ItemImpl(_, _, _, _, ref ty, _) = item.node {
ty.span
} else {
span
};

struct_span_err!(tcx.sess, span, E0206,
"the trait `Copy` may not be implemented for this type")
.span_label(span, &format!("type is not a structure or enumeration"))
.emit();
}
Err(CopyImplementationError::HasDestructor) => {
span_err!(tcx.sess, span, E0184,
16 changes: 11 additions & 5 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
@@ -367,8 +367,13 @@ impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx> {
_substs: Option<&mut Substs<'tcx>>,
_space: Option<ParamSpace>,
span: Span) -> Ty<'tcx> {
span_err!(self.tcx().sess, span, E0121,
"the type placeholder `_` is not allowed within types on item signatures");
struct_span_err!(
self.tcx().sess,
span,
E0121,
"the type placeholder `_` is not allowed within types on item signatures"
).span_label(span, &format!("not allowed in type signatures"))
.emit();
self.tcx().types.err
}

@@ -770,9 +775,10 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
let mut err = struct_span_err!(tcx.sess, impl_item.span, E0201,
"duplicate definitions with name `{}`:",
impl_item.name);
span_note!(&mut err, *entry.get(),
"previous definition of `{}` here",
impl_item.name);
err.span_label(*entry.get(),
&format!("previous definition of `{}` here",
impl_item.name));
err.span_label(impl_item.span, &format!("duplicate definition"));
err.emit();
}
Vacant(entry) => {
14 changes: 9 additions & 5 deletions src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
@@ -211,11 +211,15 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
match tcx.map.find(main_id) {
Some(hir_map::NodeItem(it)) => {
match it.node {
hir::ItemFn(_, _, _, _, ref ps, _)
if ps.is_parameterized() => {
span_err!(ccx.tcx.sess, main_span, E0131,
"main function is not allowed to have type parameters");
return;
hir::ItemFn(_, _, _, _, ref generics, _) => {
if let Some(gen_span) = generics.span() {
struct_span_err!(ccx.tcx.sess, gen_span, E0131,
"main function is not allowed to have type parameters")
.span_label(gen_span,
&format!("main cannot have type parameters"))
.emit();
return;
}
}
_ => ()
}
9 changes: 9 additions & 0 deletions src/libstd/ffi/c_str.rs
Original file line number Diff line number Diff line change
@@ -373,6 +373,15 @@ impl NulError {

/// Consumes this error, returning the underlying vector of bytes which
/// generated the error in the first place.
///
/// # Examples
///
/// ```
/// use std::ffi::CString;
///
/// let nul_error = CString::new("foo\0bar").unwrap_err();
/// assert_eq!(nul_error.into_vec(), b"foo\0bar");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn into_vec(self) -> Vec<u8> { self.1 }
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0027.rs
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ fn main() {
let d = Dog { name: "Rusty".to_string(), age: 8 };

match d {
Dog { age: x } => {} //~ ERROR E0027
Dog { age: x } => {}
//~^ ERROR pattern does not mention field `name`
//~| NOTE missing field `name`
}
}
6 changes: 5 additions & 1 deletion src/test/compile-fail/E0029.rs
Original file line number Diff line number Diff line change
@@ -12,7 +12,11 @@ fn main() {
let s = "hoho";

match s {
"hello" ... "world" => {} //~ ERROR E0029
"hello" ... "world" => {}
//~^ ERROR only char and numeric types are allowed in range patterns
//~| NOTE ranges require char or numeric types
//~| NOTE start type: &'static str
//~| NOTE end type: &'static str
_ => {}
}
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0040.rs
Original file line number Diff line number Diff line change
@@ -20,5 +20,7 @@ impl Drop for Foo {

fn main() {
let mut x = Foo { x: -7 };
x.drop(); //~ ERROR E0040
x.drop();
//~^ ERROR E0040
//~| NOTE call to destructor method
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0046.rs
Original file line number Diff line number Diff line change
@@ -14,7 +14,9 @@ trait Foo {

struct Bar;

impl Foo for Bar {} //~ ERROR E0046
impl Foo for Bar {}
//~^ ERROR E0046
//~| NOTE missing `foo` in implementation

fn main() {
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0131.rs
Original file line number Diff line number Diff line change
@@ -8,5 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main<T>() { //~ ERROR E0131
fn main<T>() {
//~^ ERROR E0131
//~| NOTE main cannot have type parameters
}
10 changes: 7 additions & 3 deletions src/test/compile-fail/E0206.rs
Original file line number Diff line number Diff line change
@@ -10,13 +10,17 @@

type Foo = i32;

impl Copy for Foo { } //~ ERROR E0206
//~^ ERROR E0117
impl Copy for Foo { }
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| NOTE type is not a structure or enumeration
//~| ERROR E0117

#[derive(Copy, Clone)]
struct Bar;

impl Copy for &'static Bar { } //~ ERROR E0206
impl Copy for &'static Bar { }
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| NOTE type is not a structure or enumeration

fn main() {
}
5 changes: 4 additions & 1 deletion src/test/compile-fail/E0223.rs
Original file line number Diff line number Diff line change
@@ -11,5 +11,8 @@
trait MyTrait { type X; }

fn main() {
let foo: MyTrait::X; //~ ERROR E0223
let foo: MyTrait::X;
//~^ ERROR ambiguous associated type
//~| NOTE ambiguous associated type
//~| NOTE specify the type using the syntax `<Type as MyTrait>::X`
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0225.rs
Original file line number Diff line number Diff line change
@@ -9,5 +9,7 @@
// except according to those terms.

fn main() {
let _: Box<std::io::Read + std::io::Write>; //~ ERROR E0225
let _: Box<std::io::Read + std::io::Write>;
//~^ ERROR only the builtin traits can be used as closure or object bounds [E0225]
//~| NOTE non-builtin trait used as bounds
}
Original file line number Diff line number Diff line change
@@ -15,15 +15,21 @@ trait Get {

fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}
//~^ ERROR ambiguous associated type
//~| NOTE ambiguous associated type
//~| NOTE specify the type using the syntax `<Type as Get>::Value`

trait Grab {
type Value;
fn grab(&self) -> Grab::Value;
//~^ ERROR ambiguous associated type
//~| NOTE ambiguous associated type
//~| NOTE specify the type using the syntax `<Type as Grab>::Value`
}

type X = std::ops::Deref::Target;
//~^ ERROR ambiguous associated type
//~| NOTE ambiguous associated type
//~| NOTE specify the type using the syntax `<Type as std::ops::Deref>::Target`

fn main() {
}
15 changes: 10 additions & 5 deletions src/test/compile-fail/coherence-impls-copy.rs
Original file line number Diff line number Diff line change
@@ -27,22 +27,27 @@ impl Clone for TestE { fn clone(&self) -> Self { *self } }
impl Copy for MyType {}

impl Copy for &'static mut MyType {}
//~^ ERROR E0206
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| NOTE type is not a structure or enumeration
impl Clone for MyType { fn clone(&self) -> Self { *self } }

impl Copy for (MyType, MyType) {}
//~^ ERROR E0206
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| NOTE type is not a structure or enumeration
//~| ERROR E0117

impl Copy for &'static NotSync {}
//~^ ERROR E0206
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| NOTE type is not a structure or enumeration

impl Copy for [MyType] {}
//~^ ERROR E0206
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| NOTE type is not a structure or enumeration
//~| ERROR E0117

impl Copy for &'static [NotSync] {}
//~^ ERROR E0206
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| NOTE type is not a structure or enumeration
//~| ERROR E0117

fn main() {
3 changes: 1 addition & 2 deletions src/test/compile-fail/double-import.rs
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@
// <LICENSE-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(no_core)]
#![no_core]

// This tests that conflicting imports shows both `use` lines
// when reporting the error.
@@ -23,5 +21,6 @@ mod sub2 {

use sub1::foo; //~ NOTE previous import of `foo` here
use sub2::foo; //~ ERROR a value named `foo` has already been imported in this module [E0252]
//~| NOTE already imported

fn main() {}
4 changes: 3 additions & 1 deletion src/test/compile-fail/impl-duplicate-methods.rs
Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@ struct Foo;

impl Foo {
fn orange(&self) {} //~ NOTE previous definition of `orange` here
fn orange(&self) {} //~ ERROR duplicate definitions with name `orange`
fn orange(&self) {}
//~^ ERROR duplicate definition
//~| NOTE duplicate definition
}

fn main() {}
3 changes: 3 additions & 0 deletions src/test/compile-fail/impl-wrong-item-for-trait.rs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ pub struct FooConstForMethod;

impl Foo for FooConstForMethod {
//~^ ERROR E0046
//~| NOTE missing `bar` in implementation
const bar: u64 = 1;
//~^ ERROR E0323
//~| NOTE does not match trait
@@ -31,6 +32,7 @@ pub struct FooMethodForConst;

impl Foo for FooMethodForConst {
//~^ ERROR E0046
//~| NOTE missing `MY_CONST` in implementation
fn bar(&self) {}
fn MY_CONST() {}
//~^ ERROR E0324
@@ -41,6 +43,7 @@ pub struct FooTypeForMethod;

impl Foo for FooTypeForMethod {
//~^ ERROR E0046
//~| NOTE missing `bar` in implementation
type bar = u64;
//~^ ERROR E0325
//~| NOTE does not match trait
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-12187-1.rs
Original file line number Diff line number Diff line change
@@ -14,5 +14,7 @@ fn new<T>() -> &'static T {

fn main() {
let &v = new();
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-12187-2.rs
Original file line number Diff line number Diff line change
@@ -14,5 +14,7 @@ fn new<'r, T>() -> &'r T {

fn main() {
let &v = new();
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-23041.rs
Original file line number Diff line number Diff line change
@@ -14,4 +14,6 @@ fn main()
fn bar(x:i32) ->i32 { 3*x };
let b:Box<Any> = Box::new(bar as fn(_)->_);
b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding required
}
3 changes: 2 additions & 1 deletion src/test/compile-fail/issue-23729.rs
Original file line number Diff line number Diff line change
@@ -18,7 +18,8 @@ fn main() {
}

impl Iterator for Recurrence {
//~^ ERROR not all trait items implemented, missing: `Item` [E0046]
//~^ ERROR E0046
//~| NOTE missing `Item` in implementation
#[inline]
fn next(&mut self) -> Option<u64> {
if self.pos < 2 {
3 changes: 2 additions & 1 deletion src/test/compile-fail/issue-23827.rs
Original file line number Diff line number Diff line change
@@ -34,7 +34,8 @@ impl<C: Component> FnMut<(C,)> for Prototype {
}

impl<C: Component> FnOnce<(C,)> for Prototype {
//~^ ERROR not all trait items implemented, missing: `Output` [E0046]
//~^ ERROR E0046
//~| NOTE missing `Output` in implementation
extern "rust-call" fn call_once(self, (comp,): (C,)) -> Prototype {
Fn::call(&self, (comp,))
}
3 changes: 2 additions & 1 deletion src/test/compile-fail/issue-24356.rs
Original file line number Diff line number Diff line change
@@ -28,7 +28,8 @@ fn main() {

// Causes ICE
impl Deref for Thing {
//~^ ERROR not all trait items implemented, missing: `Target` [E0046]
//~^ ERROR E0046
//~| NOTE missing `Target` in implementation
fn deref(&self) -> i8 { self.0 }
}

2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-26886.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,9 @@
use std::sync::{self, Arc}; //~ NOTE previous import
//~^ NOTE previous import
use std::sync::Arc; //~ ERROR a type named
//~| NOTE already imported
use std::sync; //~ ERROR a module named
//~| NOTE already imported

fn main() {
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-34209.rs
Original file line number Diff line number Diff line change
@@ -15,7 +15,9 @@ enum S {
fn bug(l: S) {
match l {
S::B{ } => { },
//~^ ERROR ambiguous associated type; specify the type using the syntax `<S as Trait>::B`
//~^ ERROR ambiguous associated type
//~| NOTE ambiguous associated type
//~| NOTE specify the type using the syntax `<S as Trait>::B`
}
}

2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-5062.rs
Original file line number Diff line number Diff line change
@@ -9,4 +9,4 @@
// except according to those terms.

fn main() { format!("{:?}", None); }
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-6458-2.rs
Original file line number Diff line number Diff line change
@@ -11,5 +11,5 @@
fn main() {
// Unconstrained type:
format!("{:?}", None);
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-6458-3.rs
Original file line number Diff line number Diff line change
@@ -12,5 +12,7 @@ use std::mem;

fn main() {
mem::transmute(0);
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-6458-4.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,9 @@

fn foo(b: bool) -> Result<bool,String> {
Err("bar".to_string());
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}

fn main() {
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-6458.rs
Original file line number Diff line number Diff line change
@@ -17,7 +17,9 @@ pub fn foo<State>(_: TypeWithState<State>) {}

pub fn bar() {
foo(TypeWithState(marker::PhantomData));
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}

fn main() {
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-7813.rs
Original file line number Diff line number Diff line change
@@ -10,5 +10,7 @@

fn main() {
let v = &[];
let it = v.iter(); //~ ERROR type annotations or generic parameter binding required
let it = v.iter(); //~ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ impl foo for Vec<isize> {
fn m1() {
// we couldn't infer the type of the vector just based on calling foo()...
let mut x = Vec::new();
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
x.foo();
}

8 changes: 6 additions & 2 deletions src/test/compile-fail/qualified-path-params-2.rs
Original file line number Diff line number Diff line change
@@ -25,7 +25,11 @@ impl S {
fn f<T>() {}
}

type A = <S as Tr>::A::f<u8>; //~ ERROR type parameters are not allowed on this type
//~^ ERROR ambiguous associated type; specify the type using the syntax `<<S as Tr>::A as Trait>::f`
type A = <S as Tr>::A::f<u8>;
//~^ ERROR type parameters are not allowed on this type
//~| NOTE type parameter not allowed
//~| ERROR ambiguous associated type
//~| NOTE ambiguous associated type
//~| NOTE specify the type using the syntax `<<S as Tr>::A as Trait>::f`

fn main() {}
8 changes: 6 additions & 2 deletions src/test/compile-fail/self-impl.rs
Original file line number Diff line number Diff line change
@@ -31,9 +31,13 @@ impl SuperFoo for Bar {
impl Bar {
fn f() {
let _: <Self>::Baz = true;
//~^ERROR: ambiguous associated type; specify the type using the syntax `<Bar as Trait>::Baz`
//~^ ERROR ambiguous associated type
//~| NOTE ambiguous associated type
//~| NOTE specify the type using the syntax `<Bar as Trait>::Baz`
let _: Self::Baz = true;
//~^ERROR: ambiguous associated type; specify the type using the syntax `<Bar as Trait>::Baz`
//~^ ERROR ambiguous associated type
//~| NOTE ambiguous associated type
//~| NOTE specify the type using the syntax `<Bar as Trait>::Baz`
}
}

Original file line number Diff line number Diff line change
@@ -34,7 +34,9 @@ where T : Convert<U>

fn a() {
test(22, std::default::Default::default());
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}

fn main() {}
34 changes: 34 additions & 0 deletions src/test/compile-fail/typeck_type_placeholder_item.rs
Original file line number Diff line number Diff line change
@@ -13,107 +13,141 @@

fn test() -> _ { 5 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn test2() -> (_, _) { (5, 5) }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures

static TEST3: _ = "test";
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

static TEST4: _ = 145;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

static TEST5: (_, _) = (1, 2);
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures

fn test6(_: _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn test7(x: _) { let _x: usize = x; }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn test8(_f: fn() -> _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

struct Test9;

impl Test9 {
fn test9(&self) -> _ { () }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn test10(&self, _x : _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
}

impl Clone for Test9 {
fn clone(&self) -> _ { Test9 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn clone_from(&mut self, other: _) { *self = Test9; }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
}

struct Test10 {
a: _,
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
b: (_, _),
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures
}

pub fn main() {
fn fn_test() -> _ { 5 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn fn_test2() -> (_, _) { (5, 5) }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures

static FN_TEST3: _ = "test";
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

static FN_TEST4: _ = 145;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

static FN_TEST5: (_, _) = (1, 2);
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures

fn fn_test6(_: _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn fn_test7(x: _) { let _x: usize = x; }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn fn_test8(_f: fn() -> _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

struct FnTest9;

impl FnTest9 {
fn fn_test9(&self) -> _ { () }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn fn_test10(&self, _x : _) { }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
}

impl Clone for FnTest9 {
fn clone(&self) -> _ { FnTest9 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures

fn clone_from(&mut self, other: _) { *self = FnTest9; }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
}

struct FnTest10 {
a: _,
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
b: (_, _),
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~| NOTE not allowed in type signatures
//~| NOTE not allowed in type signatures
}

}
4 changes: 3 additions & 1 deletion src/test/compile-fail/unconstrained-none.rs
Original file line number Diff line number Diff line change
@@ -11,5 +11,7 @@
// Issue #5062

fn main() {
None; //~ ERROR type annotations or generic parameter binding required
None; //~ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/unconstrained-ref.rs
Original file line number Diff line number Diff line change
@@ -13,5 +13,7 @@ struct S<'a, T:'a> {
}

fn main() {
S { o: &None }; //~ ERROR type annotations or generic parameter binding required
S { o: &None }; //~ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
3 changes: 2 additions & 1 deletion src/test/compile-fail/use-mod.rs
Original file line number Diff line number Diff line change
@@ -15,7 +15,8 @@ use foo::bar::{
Bar,
self
//~^ NOTE another `self` import appears here
//~^^ ERROR a module named `bar` has already been imported in this module
//~| ERROR a module named `bar` has already been imported in this module
//~| NOTE already imported
};

use {self};
4 changes: 3 additions & 1 deletion src/test/compile-fail/vector-no-ann.rs
Original file line number Diff line number Diff line change
@@ -11,5 +11,7 @@

fn main() {
let _foo = Vec::new();
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}