-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Compiling the code below with nightly produces an unstable_name_collision warning. However the code works after enabling the feature gate, I presume because the unstable method is inherent and takes precedence over trait methods. In this particular case, it can still be worth warning that the behaviour of the standard library method can be different, but the current “warning: once this method is added to the standard library, there will be ambiguity here, which will cause a hard error!” is incorrect.
//#![feature(euclidean_division)]
trait DivEuc {
fn div_euc(self, rhs: Self) -> Self;
}
impl DivEuc for u32 {
fn div_euc(self, rhs: Self) -> Self { self / rhs }
}
fn main() {
println!("{}", 12u32.div_euc(3));
}
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.