-
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
code suggestions for non-shorthand field pattern, no-mangle lints #45232
Conversation
src/librustc_lint/builtin.rs
Outdated
it.name); | ||
let mut err = cx.struct_span_lint(PRIVATE_NO_MANGLE_STATICS, it.span, &msg); | ||
let insertion_span = it.span.with_hi(BytePos(it.span.lo().0)); | ||
err.span_suggestion(insertion_span, "try making public", "pub ".to_owned()); |
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.
nit: "try making it public"
src/librustc_lint/builtin.rs
Outdated
if let Some(no_mangle_attr) = attr::find_by_name(&it.attrs, "no_mangle") { | ||
if attr::contains_name(&it.attrs, "linkage") { | ||
return; | ||
} | ||
if !cx.access_levels.is_reachable(it.id) { | ||
let msg = format!("function {} is marked #[no_mangle], but not exported", |
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.
drive by fix: can you remove the function names? Most diagnostics pointing to a definition don't mention the name again.
src/librustc_lint/builtin.rs
Outdated
let msg = format!("static {} is marked #[no_mangle], but not exported", | ||
it.name); | ||
cx.span_lint(PRIVATE_NO_MANGLE_STATICS, it.span, &msg); | ||
let msg = format!("static {} is marked #[no_mangle], but not exported", |
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 (wrt name repetition in diagnostics)
src/librustc_lint/builtin.rs
Outdated
let msg = format!("static {} is marked #[no_mangle], but not exported", | ||
it.name); | ||
let mut err = cx.struct_span_lint(PRIVATE_NO_MANGLE_STATICS, it.span, &msg); | ||
let insertion_span = it.span.with_hi(BytePos(it.span.lo().0)); |
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 should be it.span.with_hi(it.span.lo())
ac9c719
to
7b51b58
Compare
(force-push addresses @oli-obk's comments) |
7b51b58
to
64020f0
Compare
(and the ensuing compile-fail failures reported by our mutual friend Travis) |
☔ The latest upstream changes (presumably #45283) made this pull request unmergeable. Please resolve the merge conflicts. |
R=me once the merge conflict is fixed |
This comment made sense when it was introduced in fbef241. It does not make sense in its current context, where the referred-to guard is no longer present. This being an item under the fabulous metabug rust-lang#44366.
We also edit the lint description to clarify that this is different from the struct field init shorthand.
At reviewer's suggestion, we remove the function/static name from the main lint message. While we're correspondingly adjusting the expectations of a compile-fail test, we remove an obsolete FIXME comment, another quantum of progress towards resolving the fabulous metabug rust-lang#44366.
64020f0
to
8e6ed12
Compare
(and @bors's treachery) |
@bors r+ |
📌 Commit 8e6ed12 has been approved by |
⌛ Testing commit 8e6ed12 with merge a2a91d797d872a0c98d9c632965e26d2ce9e8f19... |
💔 Test failed - status-travis |
Unrelated and spurious?
Segfault looks bad though |
|
code suggestions for non-shorthand field pattern, no-mangle lints continuing in the spirit of #44942 ![moar_lint_suggestions](https://user-images.githubusercontent.com/1076988/31485011-3b20cc80-aee7-11e7-993d-81267ab77732.png) r? @estebank
💔 Test failed - status-travis |
@bors retry blame Travis. |
code suggestions for non-shorthand field pattern, no-mangle lints continuing in the spirit of #44942 ![moar_lint_suggestions](https://user-images.githubusercontent.com/1076988/31485011-3b20cc80-aee7-11e7-993d-81267ab77732.png) r? @estebank
💔 Test failed - status-travis |
@bors retry
|
code suggestions for non-shorthand field pattern, no-mangle lints continuing in the spirit of #44942 ![moar_lint_suggestions](https://user-images.githubusercontent.com/1076988/31485011-3b20cc80-aee7-11e7-993d-81267ab77732.png) r? @estebank
It looks to me that travis/mac will timeout again :-/ |
☀️ Test successful - status-appveyor, status-travis |
continuing in the spirit of #44942
r? @estebank