提交 3575812e 编写于 作者: O Omer Sheikh

Update E0107 message to new format

上级 4c023638
......@@ -2266,9 +2266,25 @@ fn check_type_argument_count(tcx: TyCtxt, span: Span, supplied: usize,
}
fn report_lifetime_number_error(tcx: TyCtxt, span: Span, number: usize, expected: usize) {
span_err!(tcx.sess, span, E0107,
"wrong number of lifetime parameters: expected {}, found {}",
expected, number);
let label = if number < expected {
if expected == 1 {
format!("expected {} lifetime parameter", expected)
} else {
format!("expected {} lifetime parameters", expected)
}
} else {
let additional = number - expected;
if additional == 1 {
"unexpected lifetime parameter".to_string()
} else {
format!("{} unexpected lifetime parameters", additional)
}
};
struct_span_err!(tcx.sess, span, E0107,
"wrong number of lifetime parameters: expected {}, found {}",
expected, number)
.span_label(span, &label)
.emit();
}
// A helper struct for conveniently grouping a set of bounds which we pass to
......
......@@ -17,8 +17,12 @@ enum Bar {
}
struct Baz<'a> {
foo: Foo, //~ ERROR E0107
bar: Bar<'a>, //~ ERROR E0107
foo: Foo,
//~^ ERROR E0107
//~| expected 1 lifetime parameter
bar: Bar<'a>,
//~^ ERROR E0107
//~| unexpected lifetime parameter
}
fn main() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册