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

Some tweaks to "type parameters from outer function" diagnostic #49007

Merged
merged 1 commit into from
Mar 16, 2018

Conversation

estebank
Copy link
Contributor

Follow up to #47574.

@rust-highfive
Copy link
Collaborator

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 14, 2018
Copy link
Contributor

@oli-obk oli-obk left a 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
Copy link
Contributor

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

@@ -61,6 +61,7 @@ use syntax::feature_gate::{feature_err, emit_feature_err, GateIssue};
use syntax::parse::token;
use syntax::ptr::P;


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line

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()
Copy link
Contributor

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")

*c == '_') {
offset += c.len_utf8();
}
let mut offset = snippet.chars()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@estebank estebank force-pushed the follow-up-47574 branch 3 times, most recently from e75da69 to 7cacfd2 Compare March 14, 2018 18:07
@estebank
Copy link
Contributor Author

@bors r=oli-obk rollup

@bors
Copy link
Contributor

bors commented Mar 14, 2018

📌 Commit 16d424f has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 14, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Mar 15, 2018
Some tweaks to "type parameters from outer function" diagnostic

Follow up to rust-lang#47574.
bors added a commit that referenced this pull request Mar 16, 2018
Rollup of 17 pull requests

- Successful merges: #48706, #48875, #48892, #48922, #48957, #48959, #48961, #48965, #49007, #49024, #49042, #49050, #48853, #48990, #49037, #49049, #48972
- Failed merges:
@bors bors merged commit 16d424f into rust-lang:master Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants