-
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
Warning shown despite --cap-lints=allow: E0122 "trait bounds are not (yet) enforced in type definitions" #43134
Comments
Nominating for discussion. Not sure if compiler team or lang team is best, though, so tagging both... |
From the lang team's point of view: definitely a bug. |
Couple of bugs here: First off, we should not be ignoring the bounds in types. And sometimes they are needed. I'd like to fix this by not ignoring them, but I worry about the backcompat issues. Unknown risk there. Second, if we must warn, we should be emitting a regular lint that can be silenced. Plausibly, we should just remove the warning (eliminating the immediate problem), and prioritize trying to do a proper fix here. |
Somewhat related to not ignoring bounds (but in the other direction): #44075. |
After some discussion in compiler team, decided to move this to a "future compatibility" lint, one that we will hopefully make more precise over time. Right now the check is not very good. At least this means you won't have to see it. We need some mentoring instructions though! |
Some tips here: https://forge.rust-lang.org/rustc-bug-fix-procedure.html |
triage: P-medium |
I've hit this recently. Example code:
trait Foo {
type A;
}
struct StructA;
struct StructB;
impl Foo for StructA {
type A = ();
}
// Warning about not enforced trait bounds
type B<A: Foo> = A::A;
// Error with the message: associated type `A` not found for `A`
// -> Trait bound is required
//type C<A> = A::A
type D = B<StructA>;
// As the warning says this works
type E = B<StructB>; |
Agreed, this is poor. There just hasn't been a lot of energy to try and improve the situation. |
Fixed in @rustbot label E-needs-test |
…ompiler-errors Add regression test for `--cap-lints allow` and trait bounds warning Closes rust-lang#43134 I have verified that the test fails if stderr begins to contain output by making sure the test fails when I add eprintln!("some output on stderr"); to the compiler (I added it to `fn build_session()`).
Test case:
With rustc 1.20.0-nightly (696412d 2017-07-06), output when compiling with
--cap-lints=allow
:--cap-lints=allow
correctly stops the dead code / unused type alias warning from being shown, but the trait bounds not enforced warning is shown anyway.Per #34596 and #40640 (comment), this might be on purpose. I think this is the wrong decision. The point of
cap-lints
is to allow Cargo to inhibit warnings in external dependencies. When building Servo it is not useful to spam the console with many warnings, future-proofing or not, about code that Servo has not direct control over.CC @nikomatsakis @aturon
The text was updated successfully, but these errors were encountered: