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

RFC 1214 warnings with recursive associated traits #29981

Open
Popog opened this Issue Nov 22, 2015 · 2 comments

Comments

Projects
None yet
5 participants
@Popog
Copy link

Popog commented Nov 22, 2015

use std::ops::{Index};

trait Trait: Index<usize>
where <Self as Index<usize>>::Output: Sized {
    type Associated: Trait;
}

Incorrectly generates E0277 warning.

<anon>:3:1: 7:2 warning: the trait `core::marker::Sized` is not implemented for the type `<<<Self as Trait>::Associated as Trait>::Associated as core::ops::Index<usize>>::Output` [E0277]
<anon>:3 trait Trait: Index<usize>
<anon>:4 where <Self as Index<usize>>::Output: Sized,
<anon>:5 <Self::Associated as Index<usize>>::Output: Sized {
<anon>:6     type Associated: Trait;
<anon>:7 }
@brson

This comment has been minimized.

Copy link
Contributor

brson commented May 4, 2017

Currently generates an error



rustc 1.17.0 (56124baa9 2017-04-24)

error[E0277]: the trait bound `<<Self as Trait>::Associated as std::ops::Index<usize>>::Output: std::marker::Sized` is not satisfied
 --> <anon>:3:1
  |
3 |   trait Trait: Index<usize>
  |  _^ starting here...
4 | | where <Self as Index<usize>>::Output: Sized {
5 | |     type Associated: Trait;
6 | | }
  | |_^ ...ending here: the trait `std::marker::Sized` is not implemented for `<<Self as Trait>::Associated as std::ops::Index<usize>>::Output`
  |
  = help: consider adding a `where <<Self as Trait>::Associated as std::ops::Index<usize>>::Output: std::marker::Sized` bound
  = note: required by `Trait`

error: aborting due to previous error

@brson brson added I-wrong P-low A-traits and removed A-traits labels May 4, 2017

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented May 4, 2017

I think this is effectively a dup -- or at least a variant of -- #20671. The problem, I believe, is that the trait checker doesn't "elaboate" the requirement that type Assocated: Trait into the requirement that Output will be sized as well.

@Mark-Simulacrum Mark-Simulacrum added C-bug and removed I-wrong labels Jul 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.