Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update E0207 to use struct_span_err, add span_label #35368

Merged
merged 2 commits into from
Aug 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2314,8 +2314,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();

}
1 change: 1 addition & 0 deletions src/test/compile-fail/E0207.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
struct Foo;

impl<T: Default> Foo { //~ ERROR E0207
//~| NOTE unconstrained lifetime parameter
fn get(&self) -> T {
<T as Default>::default()
}
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/impl-unused-rps-in-assoc-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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[..]
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-22886.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>> {
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-35139.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down