Rewrite the UnconditionalRecursion lint to use MIR#54490
Rewrite the UnconditionalRecursion lint to use MIR#54490bors merged 1 commit intorust-lang:masterfrom
UnconditionalRecursion lint to use MIR#54490Conversation
This comment has been minimized.
This comment has been minimized.
a2d81b1 to
ad980e8
Compare
src/librustc_mir/lints.rs
Outdated
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
ad980e8 to
d6acdda
Compare
|
Hey @eddyb, I think I resolved most of your feedback except for this bit:
I'm not really sure how to go about doing that. Do you have any pointers? |
|
@wesleywiser You can slice both substs with |
d6acdda to
6b94d50
Compare
|
Thanks @eddyb! I think all of your feedback is resolved now. |
6b94d50 to
a2831df
Compare
This comment has been minimized.
This comment has been minimized.
a2831df to
f81d1dd
Compare
|
Rebased and ready for review. |
|
Ping from triage @eddyb: This PR requires your review. |
|
@bors r+ I have nothing more to add, lgtm |
|
📌 Commit f81d1dd has been approved by |
|
Thanks @oli-obk! |
…i-obk Rewrite the `UnconditionalRecursion` lint to use MIR Part of rust-lang#51002 r? @eddyb
|
⌛ Testing commit f81d1dd with merge a4d1ac8e4337a605ee45ae8e706a550ceaa509ae... |
|
💔 Test failed - status-travis |
|
The job Click to expand the log.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 |
|
Looks like a spurious crates.io download failure? |
|
@bors retry |
|
yea this has been going around, I think most of the queue has been hit by it |
|
Should we open a tracking issue for that? |
|
nah, infra is already ahead of it on discord |
|
☀️ Test successful - status-appveyor, status-travis |
dropping the param-env on the floor is obviously the wrong thing to do. The ICE was probably exposed by rust-lang#54490 adding the problem-exposing use of `traits::find_associated_item`. Fixes rust-lang#55380.
…=nikomatsakis pass the parameter environment to `traits::find_associated_item` dropping the param-env on the floor is obviously the wrong thing to do. The ICE was probably exposed by rust-lang#54490 adding the problem-exposing use of `traits::find_associated_item`. Fixes rust-lang#55380. r? @nikomatsakis
…=nikomatsakis pass the parameter environment to `traits::find_associated_item` dropping the param-env on the floor is obviously the wrong thing to do. The ICE was probably exposed by rust-lang#54490 adding the problem-exposing use of `traits::find_associated_item`. Fixes rust-lang#55380. r? @nikomatsakis
Part of #51002
r? @eddyb