-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Better error message on duplicate trait implementation #3512
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
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-trait-system
Area: Trait system
P-medium
Medium priority
Milestone
Comments
Reproduced as of eed2ca6 |
Bumping to 0.7, though. |
Not critical for 0.7. Nominating for milestone 5, production-ready. |
accepted for production-ready milestone |
Still reproduces: use std::hashmap::HashMap;
use std::to_bytes::{IterBytes, Cb};
impl IterBytes for char {
pub fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
(self as i32).iter_bytes(lsb0, f)
}
}
fn main() {
let h = HashMap::new();
h.insert('a', ());
println(h.contains_key('a').to_str());
} It has a bunch of other non-bug errors too, but it still exhibits this bug. |
Accepted for P-high. |
Merged
bors
pushed a commit
to rust-lang-ci/rust
that referenced
this issue
May 15, 2021
exit integration test successfully if the crate build failed before applying rustfmt
RalfJung
pushed a commit
to RalfJung/rust
that referenced
this issue
Apr 25, 2024
make miri-script a workspace root This is needed to make miri-script build on stable (as is done by the `./miri` script) when the parent package uses unstable cargo features.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-trait-system
Area: Trait system
P-medium
Medium priority
Some days ago, I wrote some code involving char as HashMap key. At that time, char didn't implement the IterBytes trait, so I implemented it locally myself. After updating rust, my code failed to compile with a somewhat less than obvious error.
Example:
Produces the following errors:
Note that there is no way to know that the problem is the duplicate implementation of IterBytes.
The text was updated successfully, but these errors were encountered: