Closed
Description
This test fails to compile:
unsafe trait MySend {
fn dummy(&self) { }
}
unsafe impl MySend for .. { }
unsafe impl<T: MySend + ?Sized> MySend for Unique<T> { }
pub struct Unique<T:?Sized> {
pointer: *const T,
}
pub struct Node<V> {
vals: V,
edges: Unique<Node<V>>,
}
fn is_send<T: MySend>() {}
fn main() {
is_send::<Node<&'static ()>>();
}
the output is of the form:
...
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required because of the requirements on the impl of `MySend` for `Node<&'static ()>`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nmatsakis/tmp/22655b.rs:21:5: 21:33 note: required by `is_send`
/home/nmatsakis/tmp/22655b.rs:21 is_send::<Node<&'static ()>>();
This bug is branched off of #22655. It represents the underlying problem that caused #22655.