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

rustc: Disallow machine applicability in foreign macros #52756

Merged
merged 1 commit into from Aug 1, 2018

Conversation

Projects
None yet
6 participants
@alexcrichton
Copy link
Member

alexcrichton commented Jul 26, 2018

Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be MachineApplicable. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jul 26, 2018

r? @eddyb

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

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Jul 26, 2018

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jul 26, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

[00:03:49] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:49] tidy error: /checkout/src/tools/compiletest/src/header.rs:404: line longer than 100 chars
[00:03:50] some tidy checks failed
[00:03:50] 
[00:03:50] 
[00:03:50] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:50] 
[00:03:50] 
[00:03:50] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:50] Build completed unsuccessfully in 0:00:47
[00:03:50] Build completed unsuccessfully in 0:00:47
[00:03:50] Makefile:79: recipe for target 'tidy' failed
[00:03:50] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:012b5d34
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:27c58248:start=1532643126543659449,finish=1532643126550463924,duration=6804475
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:21049e30
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0ce4e9f5
travis_time:start:0ce4e9f5
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:3b2b62cd
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

--> $DIR/suggestions-not-always-applicable.rs:27:5
|
LL | #[foo] //~ WARN: absolute paths must start with
| ^^^^^^ help: use `crate`: `crate::#[foo]`

This comment has been minimized.

Copy link
@oli-obk

oli-obk Jul 30, 2018

Contributor

Since the suggestions still show up for the users, but are just ignored by rustfix, maybe we should rather not produce any suggestions in case of future incompatibility lints from external macros.

You already have the field in place in the Diagnostic type, this can be used to just not add any suggestions

This comment has been minimized.

Copy link
@alexcrichton

alexcrichton Jul 30, 2018

Author Member

Sounds good t ome!

DiagnosticBuilder {
handler,
diagnostic,
allow_machine_applicable: false,

This comment has been minimized.

Copy link
@oli-obk

oli-obk Jul 30, 2018

Contributor

shouldn't this be true? I don't see any code that ever sets it to true, only to false, so the default should probably true

This comment has been minimized.

Copy link
@alexcrichton

alexcrichton Jul 30, 2018

Author Member

Ah yes, this is indeed a mistake

rustc: Disallow machine applicability in foreign macros
Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be `MachineApplicable`. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799

@alexcrichton alexcrichton force-pushed the alexcrichton:cap-applicable branch from bb785c7 to ca762ba Jul 30, 2018

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Jul 30, 2018

Updated!

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Jul 30, 2018

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jul 30, 2018

📌 Commit ca762ba has been approved by oli-obk

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jul 30, 2018

Rollup merge of rust-lang#52756 - alexcrichton:cap-applicable, r=oli-obk
rustc: Disallow machine applicability in foreign macros

Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be `MachineApplicable`. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799

bors added a commit that referenced this pull request Jul 31, 2018

Auto merge of #52882 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 22 pull requests

Successful merges:

 - #50267 (inner_deref PR)
 - #52340 (Document From trait implementations for OsStr, OsString, CString, and CStr)
 - #52514 (Fix a few AMDGPU related issues)
 - #52630 (Delete unused code in rustdoc)
 - #52732 (Remove unstable and deprecated APIs)
 - #52745 (Update clippy to latest master)
 - #52756 (rustc: Disallow machine applicability in foreign macros)
 - #52771 (Clarify thread::park semantics)
 - #52821 (pretty print for std::collections::vecdeque)
 - #52822 (Fix From<LocalWaker>)
 - #52824 (Fix -Wpessimizing-move warnings in rustllvm/PassWrapper)
 - #52825 (Make sure #47772 does not regress)
 - #52831 (remove references to AUTHORS.txt file)
 - #52835 (Fix Alias intra doc ICE)
 - #52842 (update comment)
 - #52846 (Add timeout to use of `curl` in bootstrap.py.)
 - #52850 (Revert "Stabilize to_bytes and from_bytes for integers.")
 - #52853 (Improve bootstrap help on stages)
 - #52863 (update books for new release)
 - #52867 (releases.md: fix 2 typos)
 - #52870 (Implement Unpin for FutureObj and LocalFutureObj)
 - #52878 (Fix wrong issue number in the test name)

Failed merges:

 - #52800 (rustdoc: refactor how passes are structured, and turn intra-doc-link collection into a pass)

r? @ghost

@alexcrichton alexcrichton added this to the Rust 2018 Preview 2 milestone Jul 31, 2018

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Jul 31, 2018

@bors: p=1

needed for the edition preview!

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jul 31, 2018

⌛️ Testing commit ca762ba with merge 4edb9b3...

bors added a commit that referenced this pull request Jul 31, 2018

Auto merge of #52756 - alexcrichton:cap-applicable, r=oli-obk
rustc: Disallow machine applicability in foreign macros

Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be `MachineApplicable`. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jul 31, 2018

💔 Test failed - status-travis

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jul 31, 2018

The job dist-various-2 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_fold:end:dpl_0
travis_time:start:1807540f
travis_fold:start:dpl.1
Installing deploy dependencies
ERROR:  Could not find a valid gem 'aws-sdk-core' (= 2.11.98) in any repository
ERROR:  Possible alternatives: aws-sdk-core
/home/travis/.rvm/rubies/ruby-2.2.7/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- dpl/provider/s3 (LoadError)
 from /home/travis/.rvm/rubies/ruby-2.2.7/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require'
 from /home/travis/.rvm/gems/ruby-2.2.7/gems/dpl-1.9.8/lib/dpl/provider.rb:93:in `rescue in block in new'
 from /home/travis/.rvm/gems/ruby-2.2.7/gems/dpl-1.9.8/lib/dpl/provider.rb:68:in `block in new'
 from /home/travis/.rvm/gems/ruby-2.2.7/gems/dpl-1.9.8/lib/dpl/cli.rb:41:in `fold'
 from /home/travis/.rvm/gems/ruby-2.2.7/gems/dpl-1.9.8/lib/dpl/provider.rb:67:in `new'
 from /home/travis/.rvm/gems/ruby-2.2.7/gems/dpl-1.9.8/lib/dpl/cli.rb:31:in `run'
 from /home/travis/.rvm/gems/ruby-2.2.7/gems/dpl-1.9.8/lib/dpl/cli.rb:7:in `run'
 from /home/travis/.rvm/gems/ruby-2.2.7/gems/dpl-1.9.8/bin/dpl:5:in `<top (required)>'
 from /home/travis/.rvm/gems/ruby-2.2.7/bin/dpl:23:in `load'
 from /home/travis/.rvm/gems/ruby-2.2.7/bin/dpl:23:in `<main>'
failed to deploy

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Jul 31, 2018

@bors: retry #44159

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Aug 1, 2018

⌛️ Testing commit ca762ba with merge a1be95d...

bors added a commit that referenced this pull request Aug 1, 2018

Auto merge of #52756 - alexcrichton:cap-applicable, r=oli-obk
rustc: Disallow machine applicability in foreign macros

Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be `MachineApplicable`. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Aug 1, 2018

💔 Test failed - status-travis

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Aug 1, 2018

The job dist-x86_64-freebsd of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[01:12:23] [TIMING] Std { compiler: Compiler { stage: 2, host: "x86_64-unknown-linux-gnu" }, target: "x86_64-unknown-freebsd" } -- 62.916
[01:12:23] Dist analysis
[01:12:23] image_src: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-freebsd/release/deps/save-analysis", dst: "/checkout/obj/build/tmp/dist/rust-analysis-nightly-x86_64-unknown-freebsd-image/lib/rustlib/x86_64-unknown-freebsd/analysis"

Broadcast message from root@travis-job-435ec36e-e0d3-4f78-8c41-f3ee3ea7013c
 (unknown) at 1:22 ...
The system is going down for power off NOW!
[01:12:24] 
[01:12:24] Session terminated, terminating shell... ...terminated.

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 143.
travis_time:start:0179f751
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Aug 1, 2018

@bors: retry

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Aug 1, 2018

Rollup merge of rust-lang#52756 - alexcrichton:cap-applicable, r=oli-obk
rustc: Disallow machine applicability in foreign macros

Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be `MachineApplicable`. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799

bors added a commit that referenced this pull request Aug 1, 2018

Auto merge of #52931 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 31 pull requests

Successful merges:

 - #52332 (dead-code lint: say "constructed" for structs)
 - #52340 (Document From trait implementations for OsStr, OsString, CString, and CStr)
 - #52628 (Cleanup some rustdoc code)
 - #52732 (Remove unstable and deprecated APIs)
 - #52745 (Update clippy to latest master)
 - #52756 (rustc: Disallow machine applicability in foreign macros)
 - #52771 (Clarify thread::park semantics)
 - #52810 ([NLL] Don't make "fake" match variables mutable)
 - #52821 (pretty print for std::collections::vecdeque)
 - #52822 (Fix From<LocalWaker>)
 - #52824 (Fix -Wpessimizing-move warnings in rustllvm/PassWrapper)
 - #52831 (remove references to AUTHORS.txt file)
 - #52835 (Fix Alias intra doc ICE)
 - #52842 (update comment)
 - #52846 (Add timeout to use of `curl` in bootstrap.py.)
 - #52851 (Make the tool_lints actually usable)
 - #52853 (Improve bootstrap help on stages)
 - #52859 (Use Vec::extend in SmallVec::extend when applicable)
 - #52861 (Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and port libstd to it.)
 - #52867 (releases.md: fix 2 typos)
 - #52870 (Implement Unpin for FutureObj and LocalFutureObj)
 - #52876 (run-pass/const-endianness: negate before to_le())
 - #52878 (Fix wrong issue number in the test name)
 - #52883 (Include lifetime in mutability suggestion in NLL messages)
 - #52904 (NLL: sort diagnostics by span)
 - #52905 (Fix a typo in unsize.rs)
 - #52907 (NLL: On "cannot move out of type" error, print original before rewrite)
 - #52908 (Use SetLenOnDrop in Vec::truncate())
 - #52914 (Only run the sparc-abi test on sparc)
 - #52918 (Backport 1.27.2 release notes)
 - #52929 (Update compatibility note for 1.28.0 to be correct)

Failed merges:

 - #52758 (Cleanup for librustc::session)
 - #52799 (Use BitVector for global sets of AttrId)

r? @ghost
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Aug 1, 2018

⌛️ Testing commit ca762ba with merge 752e6a4...

bors added a commit that referenced this pull request Aug 1, 2018

Auto merge of #52756 - alexcrichton:cap-applicable, r=oli-obk
rustc: Disallow machine applicability in foreign macros

Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be `MachineApplicable`. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Aug 1, 2018

💔 Test failed - status-travis

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Aug 1, 2018

The job wasm32-unknown of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:56:46] test [run-pass] run-pass/generic-temporary.rs ... ok
[00:56:47] test [run-pass] run-pass/generic-tup.rs ... ok
[00:56:47] test [run-pass] run-pass/generic-type-synonym.rs ... ok

Broadcast message from root@travis-job-0572b7bc-19da-4f33-a4e9-398943060518
 (unknown) at 5:00 ...
The system is going down for power off NOW!
[00:56:47] 
[00:56:47] Session terminated, terminating shell... ...terminated.

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 143.
travis_time:start:0e195088
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Aug 1, 2018

@bors: retry

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Aug 1, 2018

⌛️ Testing commit ca762ba with merge c63bb1d...

bors added a commit that referenced this pull request Aug 1, 2018

Auto merge of #52756 - alexcrichton:cap-applicable, r=oli-obk
rustc: Disallow machine applicability in foreign macros

Recent changes to lints disallowed lints from being emitted against code located
in foreign macros, except for future-incompatible lints. For a future
incompatible lint, however, the automatic suggestions may not be applicable!

This commit updates this code path to force all applicability suggestions made
to foreign macros to never be `MachineApplicable`. This should avoid rustfix
actually attempting fixing these suggestions, causing non-compiling code to be
produced.

Closes rust-lang/cargo#5799
@phansch

This comment has been minimized.

Copy link
Contributor

phansch commented Aug 1, 2018

cc travis-ci/travis-ci#4924 for the travis hosts shutting down

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Aug 1, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: oli-obk
Pushing c63bb1d to master...

@bors bors merged commit ca762ba into rust-lang:master Aug 1, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@alexcrichton alexcrichton deleted the alexcrichton:cap-applicable branch Aug 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.