-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Duplicated implementation is not general enough
error on function pointers
#97997
Comments
searched nightlies: from nightly-2022-06-07 to nightly-2022-06-08 bisected with cargo-bisect-rustc v0.6.3Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start=2022-06-07 --end=2022-06-08 --prompt @TaKO8Ki, are you working on this? I'll probably be investigating this due to it being related to the recent removal of the borrowck migration mode. |
@compiler-errors |
This actually looks like a particularly difficult issue. I think it's either a bug in It may also be notable that we end up going thru a code path that is commented as "unusual" when emitting this error. This issue seems to be out of my area of expertise, so I won't claim it. @TaKO8Ki, if you can't find a solution then it may be best to hand off to someone with mir-borrowck expertise. |
Actually, what I said was totally wrong. This is definitely because we're passing in the wrong cc @TaKO8Ki sorry for all the pings, but don't keep wasting time on this unless you've made significant progress 😛 @rustbot claim |
…span, r=oli-obk Fix erroneous span for borrowck error I am not confident that this is the correct fix, but it does the job. Open to suggestions for a real fix instead. Fixes rust-lang#97997 The issue is that we pass a [dummy location](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/mir/visit.rs.html#302) when type-checking the ["required consts"](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Body.html#structfield.required_consts) that are needed by the MIR body during borrowck. This means that when we fail to evaluate the constant, we use the span of `bb0[0]`, instead of the actual span of the constant. There are quite a few other places that use `START_BLOCK.start_location()`, `Location::START`, etc. when calling for a random/unspecified `Location` value. This is because, unlike (for example) `Span`, we don't have a dummy/miscellaneous value to use instead. I would appreciate guidance (either in this PR, or a follow-up) on what needs to be done to clean this up in general.
Given the following code (playground link):
The current (
nightly
ec55c612022-06-10
, regressed in the past week) output is:Ideally the output should look like:
The desired result can be achieved by swapping the order of the two statements
<fn(&u8) as Foo>::ASSOC;
andimpls_foo(foo as fn(i32));
.The text was updated successfully, but these errors were encountered: