-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: no ref #11450
Comments
So, the easy fix for this (as seen above) is to correct the signature of the The reason for the ICE is because for operators I don't think we should ICE in this case since we do catch the mismatched trait/impl method and hence provide a better error message that way. (As you can see if you move the |
From my comment on #11450: The reason for the ICE is because for operators `rustc` does a little bit of magic. Notice that while you implement the `Mul` trait for some type `&T` (i.e a reference to some T), you can simply do `Vec2 {..} * 2.0f32`. That is, `2.0f32` is `f32` and not `&f32`. This works because `rustc` will automatically take a reference. So what's happening is that with `foo * T`, the compiler is expecting the `mul` method to take some `&U` and then it can compare to make sure `T == U` (or more specifically that `T` coerces to `U`). But in this case, the argument of the `mul` method is not a reference and hence the "no ref" error. I don't think we should ICE in this case since we do catch the mismatched trait/impl method and hence provide a better error message that way. Fixes #11450
`never_loop` catches `loop { panic!() }` * Depends on: rust-lang#11447 This is an outgrowth of rust-lang#11447 which I felt would best be done as a separate PR because it yields significant new results. This uses typecheck results to determine divergence, meaning we can now detect cases like `loop { std::process::abort() }` or `loop { panic!() }`. A downside is that `loop { unimplemented!() }` is also being linted, which is arguably a false positive. I'm not really sure how to check this from HIR though, and it seems best to leave this epicycle for a later PR. changelog: [`never_loop`]: Now lints on `loop { panic!() }` and similar constructs
skip `todo!()` in `never_loop` As promised in rust-lang#11450, here is an implementation which skips occurrences of the `todo!()` macro. changelog: [`never_loop`]: skip loops containing `todo!()`
Compiling the following file:
Leads to the following error message:
Rust version:
Please note that moving the test function into the top-level module reveals what seems to be the root cause of the problem.
New file:
New compiler error:
This fixed version compiles without any errors:
The text was updated successfully, but these errors were encountered: