-
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
Nonsensical help message in error E0277 #113447
Comments
For the
Could you try to bump your |
Thanks for the notice. I just bumped
Unfortunately the exact same misleading help message still appears.
I managed to reproduce it here: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=138ae39d401a51710bb27978cf730f49 The |
Smaller repro but still requires use bytes::Bytes;
fn main() {
&[0u8] == [0xAA];
} Am investigating how to get rid of the |
Repro without dependencies: pub struct Bytes;
impl Bytes {
pub fn as_slice(&self) -> &[u8] {
todo!()
}
}
impl PartialEq<[u8]> for Bytes {
fn eq(&self, other: &[u8]) -> bool {
self.as_slice() == other
}
}
impl PartialEq<Bytes> for &[u8] {
fn eq(&self, other: &Bytes) -> bool {
*other == **self
}
}
fn main() {
&[0u8] == [0xAA];
} |
…-2, r=cjgillot Fix wrong span for trait selection failure error reporting Fixes rust-lang#113447
…-2, r=cjgillot Fix wrong span for trait selection failure error reporting Fixes rust-lang#113447
…-2, r=cjgillot Fix wrong span for trait selection failure error reporting Fixes rust-lang#113447
I tried this code (while debugging):
Where
Uuid
is the corresponding type from theuuid
crate (and everything else is my types). It has an associated functionas_bytes
, which returns a 16-byte slice containing the UUID. Because the right-hand-side of the comparison is not a byte slice but an array, the two expressions can't be compared and I get error E0277, shown below. Of interest is the help message at the end, which has the correct solution, but proposes a fix with invalid syntax. It should suggest placing&
before[0xaa,...
.Meta
rustc --version --verbose
:I could not test on nightly, as I got a different compile error, apparently related to procedural macros:
Error
The text was updated successfully, but these errors were encountered: