Skip to content

#[derive] picks incorrect bounds when associated types are involved #23574

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

Closed
lambda-fairy opened this issue Mar 21, 2015 · 1 comment
Closed

Comments

@lambda-fairy
Copy link
Contributor

Minimal example:

trait Foo {
    type T;
}

#[derive(Copy)]
struct PairFoo<F: Foo>(pub F::T, pub F::T);

fn main() {}

rustc -Z unstable-options --pretty=expanded yields:

#![feature(no_std)]
#![no_std]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate "std" as std;
trait Foo {
    type
    T;
}

struct PairFoo<F: Foo>(pub F::T, pub F::T);
#[automatically_derived]
impl <F: ::std::marker::Copy + Foo> ::std::marker::Copy for PairFoo<F> { }

fn main() { }

This is wrong, because the bound shouldn't be F: Copy but <F as Foo>::T: Copy instead.

@lambda-fairy
Copy link
Contributor Author

Duplicate of #23575, whoopsies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant