-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Work around rust-analyzer
false-positive type errors
#111121
Conversation
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
I'm not sure it's a good idea to work around bugs in our tools, but I'm not against it on principle. |
Looking again at these call sites, I don’t think there’s any particular reason why the argument has to be the number zero, so it may be preferable to replace it with some opaque string instead. |
7539e32
to
5494eec
Compare
How do people feel about this patch? Trying to figure out if we want to land this or rather should be tackled by r-a. thanks! |
A few other pieces of context:
|
Honestly, this is such a small, semantically equivalent change that ultimately doesn't hurt readability, so I'm going to r+ it. In general though, I agree with oli that we shouldn't try to work around tooling issues, particularly if they impact readability or maintainability. @bors r+ rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#111121 (Work around `rust-analyzer` false-positive type errors) - rust-lang#111759 (Leverage the interval property to precompute borrow kill points.) - rust-lang#111841 (Run AST validation on match guards correctly) - rust-lang#111862 (Split out opaque collection from from `type_of`) - rust-lang#111863 (Don't skip mir typeck if body has errors) - rust-lang#111903 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
rust-analyzer incorrectly reports two type errors in
debug.rs
:This is due to a known bug in r-a: (rust-lang/rust-analyzer#11847).
In these particular cases, changing
&0
to&0i32
seems to be enough to avoid the bug.