-
Notifications
You must be signed in to change notification settings - Fork 13k
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
internal compiler error: &mut ! was a subtype of &mut std::cell::RefMut<,<generic #8>> but now is not? #13847
Comments
This may be a fairly easy problem to track down for a new compiler hacker. Tagging as |
Smaller test case: fn main() {
return.is_failure
} Slightly more illuminating test case: fn main() {
(fail!("bottom")).foo
} |
And yes, this appears to be a dupe of #13202. The same issue is in play in both cases, which is attempting to call a method on |
My preferred fix is to remove ty_bot from the set of types and instead instantiate a fresh type variable. This may cause a slight change in the set of programs we accept, but not much of one, and it should simplify a number of bits of code that must currently consider |
There seems to be a discrepancy between subtyping rules for mutable references (where invariance is required?) and method lookup, which happily accepts covariance. |
@jakub- can you produce a specific example where that occurs? (the examples in this bug don't see to be examples of mutable references and method lookup interacting in that way) |
@nikomatsakis Sorry, I was just describing what I'd inferred from looking at the code. Specifically rust/src/librustc/middle/typeck/check/method.rs Line 1455 in 655600b
I understand the Sub combiner will only combine &mut T and &mut U if T == U. For method lookup T <: U are accepted (where T is the type of self). Not familiar enough with the codebase to say how useful that information is. |
@nikomatsakis #17033 seems to be the same issue and offers a better example of what I meant. |
We now instead use a fresh variable for expressions that diverge. Closes #14973. Closes #13847. [Work in progress] cc @nikomatsakis
It is related to rust-lang/rust-clippy#13099 What was done: - removed `@no-rustfix` from `tests/ui/unnecessary_to_owned.rs` - checked for suggestions in `src/methods/unnecessary_to_owned.rs` (there is already one multipart_suggestion, and I don't see any other) - ran `cargo uibless` I am new to Rust, and this is my first PR. changelog: none
Seen using rustc from Apr 28 on Ubuntu 14.04 on x86-64
Might be the same as issue #13202
The text was updated successfully, but these errors were encountered: