Skip to content

Commit

Permalink
Rollup merge of rust-lang#35366 - medzin:E0282, r=jonathandturner
Browse files Browse the repository at this point in the history
Updated error message E0282

Fixes rust-lang#35312 as part of rust-lang#35233.

r? @GuillaumeGomez
  • Loading branch information
Jonathan Turner authored Aug 5, 2016
2 parents 431eeb0 + ff96b56 commit 2139a0a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-23041.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 2139a0a

Please sign in to comment.