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

code suggestions for non-shorthand field pattern, no-mangle lints #45232

Merged
merged 4 commits into from
Oct 19, 2017

Conversation

zackmdavis
Copy link
Member

continuing in the spirit of #44942

moar_lint_suggestions

r? @estebank

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

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"

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",
Copy link
Contributor

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.

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",
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 (wrt name repetition in diagnostics)

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

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

@kennytm kennytm added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 13, 2017
@zackmdavis
Copy link
Member Author

(force-push addresses @oli-obk's comments)

@zackmdavis
Copy link
Member Author

(and the ensuing compile-fail failures reported by our mutual friend Travis)

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 16, 2017
@bors
Copy link
Contributor

bors commented Oct 16, 2017

☔ The latest upstream changes (presumably #45283) made this pull request unmergeable. Please resolve the merge conflicts.

@estebank
Copy link
Contributor

R=me once the merge conflict is fixed

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 16, 2017
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.
@zackmdavis
Copy link
Member Author

(and @bors's treachery)

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Oct 17, 2017

📌 Commit 8e6ed12 has been approved by estebank

@bors
Copy link
Contributor

bors commented Oct 17, 2017

⌛ Testing commit 8e6ed12 with merge a2a91d797d872a0c98d9c632965e26d2ce9e8f19...

@bors
Copy link
Contributor

bors commented Oct 17, 2017

💔 Test failed - status-travis

@oli-obk
Copy link
Contributor

oli-obk commented Oct 17, 2017

Unrelated and spurious?

[00:17:26] [ 98%] Building CXX object tools/obj2yaml/CMakeFiles/obj2yaml.dir/coff2yaml.cpp.o
[00:17:26] clang: error: unable to execute command: Segmentation fault: 11
[00:17:26] clang: error: linker command failed due to signal (use -v to see invocation)

Segfault looks bad though

@kennytm
Copy link
Member

kennytm commented Oct 17, 2017

@bors retry #38878

[00:17:25] Scanning dependencies of target obj2yaml
[00:17:25] [ 98%] Building CXX object tools/obj2yaml/CMakeFiles/obj2yaml.dir/obj2yaml.cpp.o
[00:17:26] [ 98%] Linking CXX executable ../../bin/llvm-symbolizer
[00:17:26] [ 98%] Building CXX object tools/obj2yaml/CMakeFiles/obj2yaml.dir/coff2yaml.cpp.o
[00:17:26] clang: error: unable to execute command: Segmentation fault: 11
[00:17:26] clang: error: linker command failed due to signal (use -v to see invocation)
[00:17:26] make[3]: *** [bin/llvm-symbolizer] Error 254
[00:17:26] make[2]: *** [tools/llvm-symbolizer/CMakeFiles/llvm-symbolizer.dir/all] Error 2
[00:17:26] make[2]: *** Waiting for unfinished jobs....
[00:17:26] [ 98%] Building CXX object tools/obj2yaml/CMakeFiles/obj2yaml.dir/dwarf2yaml.cpp.o
[00:17:26] [ 98%] Building CXX object tools/obj2yaml/CMakeFiles/obj2yaml.dir/elf2yaml.cpp.o
[00:17:26] [ 98%] Building CXX object tools/obj2yaml/CMakeFiles/obj2yaml.dir/macho2yaml.cpp.o
[00:17:26] [ 98%] Building CXX object tools/obj2yaml/CMakeFiles/obj2yaml.dir/Error.cpp.o
[00:17:27] [ 98%] Linking CXX executable ../../bin/obj2yaml
[00:17:27] [ 98%] Built target obj2yaml
[00:17:27] make[1]: *** [all] Error 2
[00:17:27] thread 'main' panicked at '
[00:17:27] command did not execute successfully, got: exit code: 2
[00:17:27] 
[00:17:27] build script failed, must exit now', /Users/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.26/src/lib.rs:599:4
[00:17:27] note: Run with `RUST_BACKTRACE=1` for a backtrace.

@bors
Copy link
Contributor

bors commented Oct 18, 2017

⌛ Testing commit 8e6ed12 with merge ff33ecb...

bors added a commit that referenced this pull request Oct 18, 2017
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
@kennytm kennytm 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 18, 2017
@bors
Copy link
Contributor

bors commented Oct 18, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Oct 18, 2017

@bors retry blame Travis.

@bors
Copy link
Contributor

bors commented Oct 18, 2017

⌛ Testing commit 8e6ed12 with merge 395388b...

bors added a commit that referenced this pull request Oct 18, 2017
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
@bors
Copy link
Contributor

bors commented Oct 19, 2017

💔 Test failed - status-travis

@zackmdavis
Copy link
Member Author

goddamit @bors I really wanted that T-shirt

@kennytm
Copy link
Member

kennytm commented Oct 19, 2017

@bors retry

  • The macs 6.5-hour timed out. Still Travis's issue.

@bors
Copy link
Contributor

bors commented Oct 19, 2017

⌛ Testing commit 8e6ed12 with merge e3fb84e...

bors added a commit that referenced this pull request Oct 19, 2017
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
@estebank
Copy link
Contributor

It looks to me that travis/mac will timeout again :-/

@bors
Copy link
Contributor

bors commented Oct 19, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: estebank
Pushing e3fb84e to master...

@bors bors merged commit 8e6ed12 into rust-lang:master Oct 19, 2017
@zackmdavis zackmdavis deleted the moar_lint_suggestions branch January 13, 2018 07:40
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.

None yet

5 participants