Skip to content

Commit

Permalink
Update E0106 error message to new format.
Browse files Browse the repository at this point in the history
This fixes rust/rust-lang#35245
  • Loading branch information
Tiwalun committed Aug 5, 2016
1 parent a0b4e67 commit c61cfb0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
None => match rscope.anon_regions(default_span, 1) {
Ok(rs) => rs[0],
Err(params) => {
let mut err = struct_span_err!(self.tcx().sess, default_span, E0106,
"missing lifetime specifier");
let ampersand_span = Span { hi: default_span.lo, ..default_span};

let mut err = struct_span_err!(self.tcx().sess, ampersand_span, E0106,
"missing lifetime specifier");
err.span_label(ampersand_span, &format!("expected lifetime parameter"));

if let Some(params) = params {
report_elision_failure(&mut err, params);
}
Expand Down
12 changes: 9 additions & 3 deletions src/test/compile-fail/E0106.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}

0 comments on commit c61cfb0

Please sign in to comment.