Skip to content
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

trivial_bounds doesn't see associated type as implementing a trait #51044

Closed
kornelski opened this issue May 24, 2018 · 2 comments
Closed

trivial_bounds doesn't see associated type as implementing a trait #51044

kornelski opened this issue May 24, 2018 · 2 comments
Assignees
Labels
P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kornelski
Copy link
Contributor

kornelski commented May 24, 2018

Regression in rustc 1.27.0-nightly (2f2a11d 2018-05-16), still present in rustc 1.28.0-nightly (29ffe51 2018-05-23). Previous day's nightly, and stable, compile fine.

#![allow(dead_code)]
struct Foo<T>(T);
struct Duck;
struct Quack;

trait Hello<A> where A: Animal {
}

trait Animal {
    type Noise;
}

trait Loud<R>  {
}

impl Loud<Quack> for f32 {
}

impl Animal for Duck {
    type Noise = Quack;
}

impl Hello<Duck> for Foo<f32> where f32: Loud<<Duck as Animal>::Noise> {
}

// impl Hello<Duck> for Foo<f32> where f32: Loud<Quack> // builds fine

On rustc 1.27.0-nightly (f0fdaba 2018-05-15) it builds fine.
On rustc 1.27.0-nightly (2f2a11d 2018-05-16) it fails with:

 error[E0277]: the trait bound `f32: Loud<<Duck as Animal>::Noise>` is not satisfied
  --> src/lib.rs:23:1
   |
23 | / impl Hello<Duck> for Foo<f32> where f32: Loud<<Duck as Animal>::Noise> {
24 | | }
   | |_^ the trait `Loud<<Duck as Animal>::Noise>` is not implemented for `f32`
   |
   = help: consider adding a `where f32: Loud<<Duck as Animal>::Noise>` bound
   = help: see issue #48214
   = help: add #![feature(trivial_bounds)] to the crate attributes to enable
barzamin added a commit to rustodon/rustodon that referenced this issue Jun 2, 2018
@nikomatsakis nikomatsakis added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. P-high High priority labels Jun 7, 2018
@RalfJung
Copy link
Member

RalfJung commented Jun 9, 2018

Diesel v1.3.0 seems to be affected by this issue, see #50825 (comment)

@matthewjasper
Copy link
Contributor

Fixed by #51042

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants