Rollup merge of #35368 - shantanuraj:master, r=jonathandturner

Update E0207 to use struct_span_err, add span_label

Fixes #35302 part of #35233

r? @jonathandturner
This commit is contained in:
Eduard-Mihai Burtescu 2016-08-06 15:01:22 +03:00 committed by GitHub
commit 8747b5bc61
5 changed files with 12 additions and 4 deletions

View File

@ -2317,8 +2317,12 @@ fn report_unused_parameter(ccx: &CrateCtxt,
kind: &str,
name: &str)
{
span_err!(ccx.tcx.sess, span, E0207,
"the {} parameter `{}` is not constrained by the \
impl trait, self type, or predicates",
kind, name);
struct_span_err!(
ccx.tcx.sess, span, E0207,
"the {} parameter `{}` is not constrained by the \
impl trait, self type, or predicates",
kind, name)
.span_label(span, &format!("unconstrained lifetime parameter"))
.emit();
}

View File

@ -11,6 +11,7 @@
struct Foo;
impl<T: Default> Foo { //~ ERROR E0207
//~| NOTE unconstrained lifetime parameter
fn get(&self) -> T {
<T as Default>::default()
}

View File

@ -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[..]

View File

@ -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>> {

View File

@ -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;
}