-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Some tweaks to "type parameters from outer function" diagnostic #49007
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with comments addressed
@@ -11,7 +11,7 @@ | |||
trait Baz<T> {} | |||
|
|||
fn foo<T>(x: T) { | |||
fn bar<U, V: Baz<U>, W: Fn()>(y: T) { //~ ERROR E0401 | |||
fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) { //~ ERROR E0401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is called below, so you need to rename the call, too. Or just undo the rename
src/librustc_resolve/lib.rs
Outdated
@@ -61,6 +61,7 @@ use syntax::feature_gate::{feature_err, emit_feature_err, GateIssue}; | |||
use syntax::parse::token; | |||
use syntax::ptr::P; | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line
src/librustc_resolve/lib.rs
Outdated
fn generate_fn_name_span(cm: &CodeMap, span: Span) -> Option<Span> { | ||
let prev_span = cm.span_extend_to_prev_str(span, "fn", true); | ||
cm.span_to_snippet(prev_span).map(|snippet| { | ||
let len: usize = snippet.chars() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be snippet.find(|c| !c.is_alphanumeric() && *c != '_').expect("no label after
fn")
src/librustc_resolve/lib.rs
Outdated
*c == '_') { | ||
offset += c.len_utf8(); | ||
} | ||
let mut offset = snippet.chars() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
e75da69
to
7cacfd2
Compare
7cacfd2
to
16d424f
Compare
@bors r=oli-obk rollup |
📌 Commit 16d424f has been approved by |
Some tweaks to "type parameters from outer function" diagnostic Follow up to rust-lang#47574.
Follow up to #47574.