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

Rewrite the `UnconditionalRecursion` lint to use MIR #54490

Merged
merged 1 commit into from Oct 25, 2018

Conversation

Projects
None yet
7 participants
@wesleywiser
Member

wesleywiser commented Sep 22, 2018

Part of #51002

r? @eddyb

@rust-highfive

This comment was marked as resolved.

Collaborator

rust-highfive commented Sep 22, 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:13:29]    Compiling rustc_allocator v0.0.0 (file:///checkout/src/librustc_allocator)
[00:13:30] error[E0432]: unresolved import `rustc_data_structures::bitvec`
[00:13:30]  --> librustc_mir/lints.rs:1:28
[00:13:30]   |
[00:13:30] 1 | use rustc_data_structures::bitvec::BitArray;
[00:13:30]   |                            ^^^^^^ Could not find `bitvec` in `rustc_data_structures`
[00:13:41] error: aborting due to previous error
[00:13:41] 
[00:13:41] For more information about this error, try `rustc --explain E0432`.
[00:13:41] error: Could not compile `rustc_mir`.

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)

Show resolved Hide resolved src/librustc_mir/lints.rs Outdated
Show resolved Hide resolved src/librustc_mir/lints.rs Outdated
//is this a self call?
let is_self_call =
if let Some(Def::Method(_)) = tcx.describe_def(def_id) {

This comment has been minimized.

@eddyb

eddyb Sep 24, 2018

Member

Do you need this describe_def check? I'd suspect that if you have issues with the substs, you'd rather normalize them somehow. Polymorphic recursion wouldn't compile anyway.

This comment has been minimized.

@wesleywiser

wesleywiser Sep 24, 2018

Member

Just doing the substs check missed a few cases which the old lint caught. For example:

fn test<T: Copy>() {
  test::<usize>();
}

The old lint caught this. With the additional check for "are we in a trait method", all the existing tests pass for the new lint.

This comment has been minimized.

@eddyb

eddyb Sep 24, 2018

Member

Ah, that is unfortunate, since it's not polymorphic recursion, and doesn't involve traits. I don't like describe_def though - can you use some functionality on tcx to check whether the function is a trait-associated item? Inherent methods, or methods in impls, need to behave like ordinary functions, it's only trait impls that care about dispatch.

Furthermore, only the part of the substs that corresponds to the trait, is relevant here, e.g. if the method has generics, they should probably be ignored.

@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Sep 27, 2018

Hey @eddyb, I think I resolved most of your feedback except for this bit:

Furthermore, only the part of the substs that corresponds to the trait, is relevant here, e.g. if the method has generics, they should probably be ignored.

I'm not really sure how to go about doing that. Do you have any pointers?

Show resolved Hide resolved src/librustc_mir/build/mod.rs Outdated
Show resolved Hide resolved src/librustc_mir/lints.rs Outdated
@eddyb

This comment has been minimized.

Member

eddyb commented Sep 27, 2018

@wesleywiser You can slice both substs with ..tcx.generics_of(trait_def_id).count().

Show resolved Hide resolved src/librustc_mir/lints.rs Outdated
@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Sep 28, 2018

Thanks @eddyb! I think all of your feedback is resolved now.

Show resolved Hide resolved src/librustc_mir/lints.rs Outdated
@bors

This comment was marked as resolved.

Contributor

bors commented Oct 3, 2018

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

@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Oct 4, 2018

Rebased and ready for review.

@TimNN

This comment has been minimized.

Contributor

TimNN commented Oct 16, 2018

Ping from triage @eddyb: This PR requires your review.

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Oct 25, 2018

@bors r+

I have nothing more to add, lgtm

@bors

This comment has been minimized.

Contributor

bors commented Oct 25, 2018

📌 Commit f81d1dd has been approved by oli-obk

@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Oct 25, 2018

Thanks @oli-obk!

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Oct 25, 2018

Rollup merge of rust-lang#54490 - wesleywiser:rewrite_it_in_mir, r=ol…
…i-obk

Rewrite the `UnconditionalRecursion` lint to use MIR

Part of rust-lang#51002

r? @eddyb

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #55357 - pietroalbini:rollup, r=pietroalbini
Rollup of 15 pull requests

Successful merges:

 - #54490 (Rewrite the `UnconditionalRecursion` lint to use MIR)
 - #54626 (rustc: Tweak filenames encoded into metadata)
 - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`)
 - #54921 (Add line numbers option to rustdoc)
 - #54965 (update tcp stream documentation)
 - #55010 (Add template parameter debuginfo to generic types)
 - #55150 (Do not allow moving out of thread local under ast borrowck)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55221 (Don't emit cannot move errors twice in migrate mode)
 - #55238 (Remove the `alloc_jemalloc` crate)
 - #55244 (Don't rerun MIR passes when inlining)
 - #55257 (Allow extern statics with an extern type)
 - #55269 (fix typos in various places)
 - #55301 (List allowed tokens after macro fragments)
 - #55325 (Fix link to macros chapter)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #55357 - pietroalbini:rollup, r=pietroalbini
Rollup of 15 pull requests

Successful merges:

 - #54490 (Rewrite the `UnconditionalRecursion` lint to use MIR)
 - #54626 (rustc: Tweak filenames encoded into metadata)
 - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`)
 - #54921 (Add line numbers option to rustdoc)
 - #54965 (update tcp stream documentation)
 - #55010 (Add template parameter debuginfo to generic types)
 - #55150 (Do not allow moving out of thread local under ast borrowck)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55221 (Don't emit cannot move errors twice in migrate mode)
 - #55238 (Remove the `alloc_jemalloc` crate)
 - #55244 (Don't rerun MIR passes when inlining)
 - #55257 (Allow extern statics with an extern type)
 - #55269 (fix typos in various places)
 - #55301 (List allowed tokens after macro fragments)
 - #55325 (Fix link to macros chapter)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Contributor

bors commented Oct 25, 2018

⌛️ Testing commit f81d1dd with merge a4d1ac8...

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #54490 - wesleywiser:rewrite_it_in_mir, r=oli-obk
Rewrite the `UnconditionalRecursion` lint to use MIR

Part of #51002

r? @eddyb
@bors

This comment has been minimized.

Contributor

bors commented Oct 25, 2018

💔 Test failed - status-travis

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Oct 25, 2018

The job x86_64-gnu-distcheck 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:05:36] Caused by:
[00:05:36]   failed to download package from registry
[00:05:36] 
[00:05:36] Caused by:
[00:05:36]   failed to get 200 response from `https://crates.io/api/v1/crates/openssl-src/111.0.1+1.1.1/download`, got 403
[00:05:36] 
[00:05:36] 
[00:05:36] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "vendor"
[00:05:36] 
[00:05:36] 
[00:05:36] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test distcheck
[00:05:36] Build completed unsuccessfully in 0:02:08
---
travis_time:end:044c5b6a:start=1540499353942303725,finish=1540499353951328642,duration=9024917
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:19d56c28
$ 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 --batch -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:05e00bc0
travis_time:start:05e00bc0
$ 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:07ccdffe
$ 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)

@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Oct 25, 2018

Looks like a spurious crates.io download failure?

@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Oct 25, 2018

@bors retry

@bors

This comment has been minimized.

Contributor

bors commented Oct 25, 2018

⌛️ Testing commit f81d1dd with merge 4bd4e41...

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #54490 - wesleywiser:rewrite_it_in_mir, r=oli-obk
Rewrite the `UnconditionalRecursion` lint to use MIR

Part of #51002

r? @eddyb
@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Oct 25, 2018

yea this has been going around, I think most of the queue has been hit by it

@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Oct 25, 2018

Should we open a tracking issue for that?

@oli-obk

This comment has been minimized.

Contributor

oli-obk commented Oct 25, 2018

nah, infra is already ahead of it on discord

@bors

This comment has been minimized.

Contributor

bors commented Oct 25, 2018

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

bors added a commit that referenced this pull request Oct 25, 2018

Auto merge of #55357 - pietroalbini:rollup, r=pietroalbini
Rollup of 15 pull requests

Successful merges:

 - #54490 (Rewrite the `UnconditionalRecursion` lint to use MIR)
 - #54626 (rustc: Tweak filenames encoded into metadata)
 - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`)
 - #54921 (Add line numbers option to rustdoc)
 - #54965 (update tcp stream documentation)
 - #55010 (Add template parameter debuginfo to generic types)
 - #55150 (Do not allow moving out of thread local under ast borrowck)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55221 (Don't emit cannot move errors twice in migrate mode)
 - #55238 (Remove the `alloc_jemalloc` crate)
 - #55244 (Don't rerun MIR passes when inlining)
 - #55257 (Allow extern statics with an extern type)
 - #55269 (fix typos in various places)
 - #55301 (List allowed tokens after macro fragments)
 - #55325 (Fix link to macros chapter)

Failed merges:

r? @ghost

@bors bors merged commit f81d1dd into rust-lang:master Oct 25, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment