-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.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
use std::ops::Mul;
struct BoxedValue<T: Mul> {
value: T
}
impl<T: Mul<Output=T>> Mul for BoxedValue<T> {
type Output = Self;
fn mul(self, rhs: Self) -> Self {
BoxedValue{value: self.value*rhs.value}
}
}
fn width<T: Mul>(value: T) -> BoxedValue<T> {
BoxedValue{value}
}
fn height<T: Mul>(value: T) -> BoxedValue<T> {
BoxedValue{value}
}
fn foo(s1: f64, s2: f64) -> BoxedValue<f64> {
(width(s1) * height(s1)) + (width(s2) * height(s2))
}
fn main() {
}
When compiled produces error which only highlights whole expression - offending operator is not marked in any way.
Newest gcc is capable of much nicer diagnostics in similar situation: https://developers.redhat.com/blog/2019/03/08/usability-improvements-in-gcc-9/ - similar diagnostics should be added to rustc.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.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.