From ef5acdecebb48a02cb34d19fa17d1bd59e41a4d3 Mon Sep 17 00:00:00 2001 From: Mathias Blikstad Date: Tue, 8 Jan 2019 22:14:04 +0100 Subject: RFC 2027: "first draft" of implementation These are a squashed series of commits. --- ...rbitrary-self-types-not-object-safe.curr.stderr | 24 ++++++++++++++++++++++ ...not-object-safe.object_safe_for_dispatch.stderr | 15 ++++++++++++++ .../self/arbitrary-self-types-not-object-safe.rs | 8 ++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr create mode 100644 src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr (limited to 'src/test/ui/self') diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr new file mode 100644 index 00000000000..cdffc1d86ed --- /dev/null +++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr @@ -0,0 +1,24 @@ +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/arbitrary-self-types-not-object-safe.rs:34:32 + | +LL | fn foo(self: &Rc) -> usize; + | --- method `foo`'s `self` parameter cannot be dispatched on +... +LL | let x = Rc::new(5usize) as Rc; + | ^^^^^^^^^^^ the trait `Foo` cannot be made into an object + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/arbitrary-self-types-not-object-safe.rs:34:13 + | +LL | fn foo(self: &Rc) -> usize; + | --- method `foo`'s `self` parameter cannot be dispatched on +... +LL | let x = Rc::new(5usize) as Rc; + | ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object + | + = note: required because of the requirements on the impl of `std::ops::CoerceUnsized>` for `std::rc::Rc` + = note: required by cast to type `std::rc::Rc` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr new file mode 100644 index 00000000000..725632a1212 --- /dev/null +++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr @@ -0,0 +1,15 @@ +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/arbitrary-self-types-not-object-safe.rs:34:13 + | +LL | fn foo(self: &Rc) -> usize; + | --- method `foo`'s `self` parameter cannot be dispatched on +... +LL | let x = Rc::new(5usize) as Rc; + | ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object + | + = note: required because of the requirements on the impl of `std::ops::CoerceUnsized>` for `std::rc::Rc` + = note: required by cast to type `std::rc::Rc` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.rs b/src/test/ui/self/arbitrary-self-types-not-object-safe.rs index 7443d888c9e..2eeabad28db 100644 --- a/src/test/ui/self/arbitrary-self-types-not-object-safe.rs +++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.rs @@ -1,3 +1,6 @@ +// revisions: curr object_safe_for_dispatch + +#![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))] #![feature(arbitrary_self_types)] use std::rc::Rc; @@ -29,8 +32,9 @@ impl Bar for usize { fn make_foo() { let x = Rc::new(5usize) as Rc; - //~^ ERROR E0038 - //~| ERROR E0038 + //[curr]~^ ERROR E0038 + //[curr]~| ERROR E0038 + //[object_safe_for_dispatch]~^^^ ERROR E0038 } fn make_bar() { -- cgit 1.4.1-3-g733a5