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

Send/Sync transitive analysis lost in stored associated types #22828

Closed
alexcrichton opened this issue Feb 26, 2015 · 7 comments · Fixed by #22851
Closed

Send/Sync transitive analysis lost in stored associated types #22828

alexcrichton opened this issue Feb 26, 2015 · 7 comments · Fixed by #22851
Assignees
Labels
A-associated-items Area: Associated items such as associated types and consts.

Comments

@alexcrichton
Copy link
Member

For example, this code does not compile:

trait Foo {
    type A;
    fn foo(&self) {}
}

impl Foo for usize {
    type A = usize;
}

struct Bar<T: Foo> { inner: T::A }

fn is_send<T: Send>() {}

fn main() {
    is_send::<Bar<usize>>();
}
foo.rs:15:5: 15:26 error: the trait `core::marker::Send` is not implemented for the type `<usize as Foo>::A` [E0277]
foo.rs:15     is_send::<Bar<usize>>();
              ^~~~~~~~~~~~~~~~~~~~~
foo.rs:15:5: 15:26 note: `<usize as Foo>::A` cannot be sent between threads safely
foo.rs:15     is_send::<Bar<usize>>();
              ^~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

cc @nikomatsakis, @pnkfelix

@alexcrichton alexcrichton added the A-associated-items Area: Associated items such as associated types and consts. label Feb 26, 2015
@pnkfelix
Copy link
Member

I think this may be another instance of #22815

@alexcrichton
Copy link
Member Author

Trusting @pnkfelix's analysis, closing in favor of #22815 but adding test case there as well.

@pnkfelix
Copy link
Member

(it of course would be good to confirm that this actually is an instance of #22815 -- my initial reaction when I saw it was "they might be related ... but wait, wasn't part of the opt-in-builtin-bounds work to be able to move the special case handling of Send / Sync out into library code...?"; I've only done some rough skimming that makes me think the hypothesis remains plausible.)

@alexcrichton
Copy link
Member Author

Ah either way is fine by me, I personally like fewer issues :). We can reopen once #22815 is addressed one way or another if necessary (or if you'd like to reopen now that's also fine by me!)

@pnkfelix
Copy link
Member

@alexcrichton oh that was really just a note to myself as much as anything else, not a comment on your choice to close this ticket. :)

@nikomatsakis nikomatsakis reopened this Feb 26, 2015
@nikomatsakis
Copy link
Contributor

I don't think this code uses type-contents. If it does, that is itself a bug! Either way, we should keep this open for the time being.

@flaper87
Copy link
Contributor

cc @flaper87

@flaper87 flaper87 self-assigned this Feb 26, 2015
flaper87 added a commit to flaper87/rust that referenced this issue Feb 27, 2015
edwardw added a commit to edwardw/rust that referenced this issue Feb 28, 2015
These implementations were temporary workaround. Now rust-lang#22828 has been
fixed, they can be removed.
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 28, 2015
 These implementations were temporary workaround. Now rust-lang#22828 has been
fixed, they can be removed.
bors added a commit that referenced this issue Mar 1, 2015
These implementations were temporary workaround. Now #22828 has been
fixed, they can be removed.
Manishearth added a commit to Manishearth/rust that referenced this issue Mar 1, 2015
 These implementations were temporary workaround. Now rust-lang#22828 has been
fixed, they can be removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items such as associated types and consts.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants