Skip to content

Commit

Permalink
Rollup merge of rust-lang#35356 - Tiwalun:fix-err-msg-e0106, r=jonath…
Browse files Browse the repository at this point in the history
…andturner

Update E0106 error message to new format.

This fixes rust-lang#35245, as part of the big error message update in rust-lang#35233

r? @jonathandturner
  • Loading branch information
eddyb committed Aug 6, 2016
2 parents b9c5fa4 + c61cfb0 commit 75c86ca
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 75c86ca

Please sign in to comment.