mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-14 13:06:49 +00:00
remove feature(trait_upcasting)
from tests and bless them
This commit is contained in:
parent
a970a0d77e
commit
e9d5d1113f
@ -2,7 +2,6 @@
|
||||
//@ compile-flags: -C no-prepopulate-passes -Copt-level=0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
pub trait Base {
|
||||
fn base(&self);
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ known-bug: #131886
|
||||
//@ compile-flags: -Zvalidate-mir --crate-type=lib
|
||||
#![feature(trait_upcasting, type_alias_impl_trait)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Tait = impl Sized;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@ build-pass
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
pub trait A {}
|
||||
pub trait B {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![feature(dyn_star, trait_upcasting)]
|
||||
//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
#![expect(incomplete_features)]
|
||||
#![feature(dyn_star)]
|
||||
|
||||
trait A: B {}
|
||||
trait B {}
|
||||
|
@ -1,12 +1,3 @@
|
||||
warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/no-unsize-coerce-dyn-trait.rs:1:12
|
||||
|
|
||||
LL | #![feature(dyn_star, trait_upcasting)]
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/no-unsize-coerce-dyn-trait.rs:11:26
|
||||
|
|
||||
@ -18,6 +9,6 @@ LL | let y: Box<dyn* B> = x;
|
||||
= note: expected struct `Box<dyn* B>`
|
||||
found struct `Box<dyn* A>`
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -1,6 +1,6 @@
|
||||
//@ known-bug: #104800
|
||||
|
||||
#![feature(dyn_star, trait_upcasting)]
|
||||
#![feature(dyn_star)]
|
||||
|
||||
trait Foo: Bar {
|
||||
fn hello(&self);
|
||||
|
@ -1,7 +1,7 @@
|
||||
warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/upcast.rs:3:12
|
||||
|
|
||||
LL | #![feature(dyn_star, trait_upcasting)]
|
||||
LL | #![feature(dyn_star)]
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
|
||||
|
@ -1,13 +0,0 @@
|
||||
trait Foo {}
|
||||
|
||||
trait Bar: Foo {}
|
||||
|
||||
impl Foo for () {}
|
||||
|
||||
impl Bar for () {}
|
||||
|
||||
fn main() {
|
||||
let bar: &dyn Bar = &();
|
||||
let foo: &dyn Foo = bar;
|
||||
//~^ ERROR trait upcasting coercion is experimental [E0658]
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
error[E0658]: cannot cast `dyn Bar` to `dyn Foo`, trait upcasting coercion is experimental
|
||||
--> $DIR/feature-gate-trait_upcasting.rs:11:25
|
||||
|
|
||||
LL | let foo: &dyn Foo = bar;
|
||||
| ^^^
|
||||
|
|
||||
= note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information
|
||||
= help: add `#![feature(trait_upcasting)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: required when coercing `&dyn Bar` into `&dyn Foo`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,5 +1,5 @@
|
||||
error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time
|
||||
--> $DIR/unsized_coercion5.rs:17:32
|
||||
--> $DIR/unsized_coercion5.rs:15:32
|
||||
|
|
||||
LL | let y: Box<dyn Send> = x as Box<dyn Trait + Send>;
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
@ -5,8 +5,6 @@
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
//@[next] check-pass
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Trait {}
|
||||
|
||||
impl Trait for u32 {}
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(trait_upcasting)]
|
||||
// Check that super-traits are callable.
|
||||
|
||||
//@ revisions: cfi kcfi
|
||||
|
@ -1,6 +1,5 @@
|
||||
//@ compile-flags: -Znext-solver
|
||||
//@ check-pass
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait A {}
|
||||
trait B: A {}
|
||||
|
@ -1,6 +1,5 @@
|
||||
//@ check-pass
|
||||
//@ compile-flags: -Znext-solver
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
pub trait A {}
|
||||
pub trait B: A {}
|
||||
|
@ -1,6 +1,5 @@
|
||||
//@ compile-flags: -Znext-solver
|
||||
//@ check-pass
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo: Bar<i32> + Bar<u32> {}
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Target {}
|
||||
trait Source: Send + Target {}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(trait_upcasting)]
|
||||
#![feature(trait_alias)]
|
||||
|
||||
// Although we *elaborate* `T: Alias` to `i32: B`, we should
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/alias-where-clause-isnt-supertrait.rs:27:5
|
||||
--> $DIR/alias-where-clause-isnt-supertrait.rs:26:5
|
||||
|
|
||||
LL | fn test(x: &dyn C) -> &dyn B {
|
||||
| ------ expected `&dyn B` because of return type
|
||||
|
@ -1,7 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync {
|
||||
fn a(&self) -> i32 {
|
||||
10
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@ run-pass
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo<T: Default + ToString>: Bar<i32> + Bar<T> {}
|
||||
trait Bar<T: Default + ToString> {
|
||||
|
@ -1,35 +0,0 @@
|
||||
#![deny(deref_into_dyn_supertrait)]
|
||||
use std::ops::Deref;
|
||||
|
||||
trait Bar<T> {}
|
||||
impl<T, U> Bar<U> for T {}
|
||||
|
||||
trait Foo: Bar<i32> {
|
||||
fn as_dyn_bar_u32<'a>(&self) -> &(dyn Bar<u32> + 'a);
|
||||
}
|
||||
|
||||
impl Foo for () {
|
||||
fn as_dyn_bar_u32<'a>(&self) -> &(dyn Bar<u32> + 'a) {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for dyn Foo + 'a {
|
||||
//~^ ERROR this `Deref` implementation is covered by an implicit supertrait coercion
|
||||
//~| WARN this will change its meaning in a future release!
|
||||
type Target = dyn Bar<u32> + 'a;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.as_dyn_bar_u32()
|
||||
}
|
||||
}
|
||||
|
||||
fn take_dyn<T>(x: &dyn Bar<T>) -> T {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: &dyn Foo = &();
|
||||
let y = take_dyn(x);
|
||||
let z: u32 = y;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
error: this `Deref` implementation is covered by an implicit supertrait coercion
|
||||
--> $DIR/deref-upcast-behavioral-change.rs:17:1
|
||||
|
|
||||
LL | impl<'a> Deref for dyn Foo + 'a {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Foo` implements `Deref<Target = dyn Bar<u32>>` which conflicts with supertrait `Bar<i32>`
|
||||
...
|
||||
LL | type Target = dyn Bar<u32> + 'a;
|
||||
| -------------------------------- target type is a supertrait of `dyn Foo`
|
||||
|
|
||||
= warning: this will change its meaning in a future release!
|
||||
= note: for more information, see issue #89460 <https://github.com/rust-lang/rust/issues/89460>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/deref-upcast-behavioral-change.rs:1:9
|
||||
|
|
||||
LL | #![deny(deref_into_dyn_supertrait)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -1,7 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync {
|
||||
fn a(&self) -> i32 {
|
||||
10
|
||||
|
@ -4,8 +4,6 @@
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait A: B {
|
||||
type Assoc;
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Check that we are able to instantiate a binder during trait upcasting,
|
||||
// and that it doesn't cause any issues with codegen either.
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Supertrait<'a, 'b> {}
|
||||
trait Subtrait<'a, 'b>: Supertrait<'a, 'b> {}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
// We previously wrongly instantiated binders during trait upcasting,
|
||||
// allowing the super trait to be more generic than the sub trait.
|
||||
// This was unsound.
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Supertrait<'a, 'b> {
|
||||
fn cast(&self, x: &'a str) -> &'b str;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/illegal-upcast-from-impl.rs:17:66
|
||||
--> $DIR/illegal-upcast-from-impl.rs:15:66
|
||||
|
|
||||
LL | fn illegal(x: &dyn Sub<Assoc = ()>) -> &dyn Super<Assoc = i32> { x }
|
||||
| ----------------------- ^ expected trait `Super`, found trait `Sub`
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/illegal-upcast-from-impl.rs:17:66
|
||||
--> $DIR/illegal-upcast-from-impl.rs:15:66
|
||||
|
|
||||
LL | fn illegal(x: &dyn Sub<Assoc = ()>) -> &dyn Super<Assoc = i32> { x }
|
||||
| ----------------------- ^ expected trait `Super`, found trait `Sub`
|
||||
|
@ -2,8 +2,6 @@
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Super {
|
||||
type Assoc;
|
||||
}
|
||||
|
@ -9,8 +9,6 @@
|
||||
//@[next] rustc-env:RUST_BACKTRACE=0
|
||||
//@ check-pass
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Super {
|
||||
type Assoc;
|
||||
}
|
||||
|
@ -1,6 +1,3 @@
|
||||
#![deny(deref_into_dyn_supertrait)]
|
||||
#![feature(trait_upcasting)] // remove this and the test compiles
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
trait Bar<T> {}
|
||||
@ -32,5 +29,5 @@ fn main() {
|
||||
let x: &dyn Foo = &();
|
||||
let y = take_dyn(x);
|
||||
let z: u32 = y;
|
||||
//~^ ERROR mismatched types
|
||||
//~^ error: mismatched types
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/inference-behavior-change-deref.rs:34:18
|
||||
--> $DIR/inference-behavior-change-deref.rs:31:18
|
||||
|
|
||||
LL | let z: u32 = y;
|
||||
| --- ^ expected `u32`, found `i32`
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo {
|
||||
fn a(&self) -> i32 {
|
||||
10
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:53:35
|
||||
--> $DIR/invalid-upcast.rs:51:35
|
||||
|
|
||||
LL | let _: &dyn std::fmt::Debug = baz;
|
||||
| -------------------- ^^^ expected trait `Debug`, found trait `Baz`
|
||||
@ -10,7 +10,7 @@ LL | let _: &dyn std::fmt::Debug = baz;
|
||||
found reference `&dyn Baz`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:55:24
|
||||
--> $DIR/invalid-upcast.rs:53:24
|
||||
|
|
||||
LL | let _: &dyn Send = baz;
|
||||
| --------- ^^^ expected trait `Send`, found trait `Baz`
|
||||
@ -21,7 +21,7 @@ LL | let _: &dyn Send = baz;
|
||||
found reference `&dyn Baz`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:57:24
|
||||
--> $DIR/invalid-upcast.rs:55:24
|
||||
|
|
||||
LL | let _: &dyn Sync = baz;
|
||||
| --------- ^^^ expected trait `Sync`, found trait `Baz`
|
||||
@ -32,7 +32,7 @@ LL | let _: &dyn Sync = baz;
|
||||
found reference `&dyn Baz`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:60:25
|
||||
--> $DIR/invalid-upcast.rs:58:25
|
||||
|
|
||||
LL | let bar: &dyn Bar = baz;
|
||||
| -------- ^^^ expected trait `Bar`, found trait `Baz`
|
||||
@ -43,7 +43,7 @@ LL | let bar: &dyn Bar = baz;
|
||||
found reference `&dyn Baz`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:62:35
|
||||
--> $DIR/invalid-upcast.rs:60:35
|
||||
|
|
||||
LL | let _: &dyn std::fmt::Debug = bar;
|
||||
| -------------------- ^^^ expected trait `Debug`, found trait `Bar`
|
||||
@ -54,7 +54,7 @@ LL | let _: &dyn std::fmt::Debug = bar;
|
||||
found reference `&dyn Bar`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:64:24
|
||||
--> $DIR/invalid-upcast.rs:62:24
|
||||
|
|
||||
LL | let _: &dyn Send = bar;
|
||||
| --------- ^^^ expected trait `Send`, found trait `Bar`
|
||||
@ -65,7 +65,7 @@ LL | let _: &dyn Send = bar;
|
||||
found reference `&dyn Bar`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:66:24
|
||||
--> $DIR/invalid-upcast.rs:64:24
|
||||
|
|
||||
LL | let _: &dyn Sync = bar;
|
||||
| --------- ^^^ expected trait `Sync`, found trait `Bar`
|
||||
@ -76,7 +76,7 @@ LL | let _: &dyn Sync = bar;
|
||||
found reference `&dyn Bar`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:69:25
|
||||
--> $DIR/invalid-upcast.rs:67:25
|
||||
|
|
||||
LL | let foo: &dyn Foo = baz;
|
||||
| -------- ^^^ expected trait `Foo`, found trait `Baz`
|
||||
@ -87,7 +87,7 @@ LL | let foo: &dyn Foo = baz;
|
||||
found reference `&dyn Baz`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:71:35
|
||||
--> $DIR/invalid-upcast.rs:69:35
|
||||
|
|
||||
LL | let _: &dyn std::fmt::Debug = foo;
|
||||
| -------------------- ^^^ expected trait `Debug`, found trait `Foo`
|
||||
@ -98,7 +98,7 @@ LL | let _: &dyn std::fmt::Debug = foo;
|
||||
found reference `&dyn Foo`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:73:24
|
||||
--> $DIR/invalid-upcast.rs:71:24
|
||||
|
|
||||
LL | let _: &dyn Send = foo;
|
||||
| --------- ^^^ expected trait `Send`, found trait `Foo`
|
||||
@ -109,7 +109,7 @@ LL | let _: &dyn Send = foo;
|
||||
found reference `&dyn Foo`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:75:24
|
||||
--> $DIR/invalid-upcast.rs:73:24
|
||||
|
|
||||
LL | let _: &dyn Sync = foo;
|
||||
| --------- ^^^ expected trait `Sync`, found trait `Foo`
|
||||
@ -120,7 +120,7 @@ LL | let _: &dyn Sync = foo;
|
||||
found reference `&dyn Foo`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:78:25
|
||||
--> $DIR/invalid-upcast.rs:76:25
|
||||
|
|
||||
LL | let foo: &dyn Foo = bar;
|
||||
| -------- ^^^ expected trait `Foo`, found trait `Bar`
|
||||
@ -131,7 +131,7 @@ LL | let foo: &dyn Foo = bar;
|
||||
found reference `&dyn Bar`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:80:35
|
||||
--> $DIR/invalid-upcast.rs:78:35
|
||||
|
|
||||
LL | let _: &dyn std::fmt::Debug = foo;
|
||||
| -------------------- ^^^ expected trait `Debug`, found trait `Foo`
|
||||
@ -142,7 +142,7 @@ LL | let _: &dyn std::fmt::Debug = foo;
|
||||
found reference `&dyn Foo`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:82:24
|
||||
--> $DIR/invalid-upcast.rs:80:24
|
||||
|
|
||||
LL | let _: &dyn Send = foo;
|
||||
| --------- ^^^ expected trait `Send`, found trait `Foo`
|
||||
@ -153,7 +153,7 @@ LL | let _: &dyn Send = foo;
|
||||
found reference `&dyn Foo`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid-upcast.rs:84:24
|
||||
--> $DIR/invalid-upcast.rs:82:24
|
||||
|
|
||||
LL | let _: &dyn Sync = foo;
|
||||
| --------- ^^^ expected trait `Sync`, found trait `Foo`
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@ run-pass
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
struct Test {
|
||||
func: Box<dyn FnMut() + 'static>,
|
||||
|
@ -1,14 +0,0 @@
|
||||
error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental
|
||||
--> $DIR/issue-11515.rs:11:38
|
||||
|
|
||||
LL | let test = Box::new(Test { func: closure });
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information
|
||||
= help: add `#![feature(trait_upcasting)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: required when coercing `Box<(dyn Fn() + 'static)>` into `Box<(dyn FnMut() + 'static)>`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,14 +0,0 @@
|
||||
error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental
|
||||
--> $DIR/issue-11515.rs:11:38
|
||||
|
|
||||
LL | let test = Box::new(Test { func: closure });
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information
|
||||
= help: add `#![feature(trait_upcasting)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: required when coercing `Box<(dyn Fn() + 'static)>` into `Box<(dyn FnMut() + 'static)>`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,3 +1,4 @@
|
||||
//@ check-pass
|
||||
//@ revisions: current next
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
@ -8,5 +9,5 @@ struct Test {
|
||||
|
||||
fn main() {
|
||||
let closure: Box<dyn Fn() + 'static> = Box::new(|| ());
|
||||
let test = Box::new(Test { func: closure }); //~ ERROR trait upcasting coercion is experimental [E0658]
|
||||
let test = Box::new(Test { func: closure });
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync {
|
||||
fn a(&self) -> i32 {
|
||||
10
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: methods `z` and `y` are never used
|
||||
--> $DIR/lifetime.rs:10:8
|
||||
--> $DIR/lifetime.rs:8:8
|
||||
|
|
||||
LL | trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync {
|
||||
| --- methods in this trait
|
||||
@ -13,7 +13,7 @@ LL | fn y(&self) -> i32 {
|
||||
= note: `#[warn(dead_code)]` on by default
|
||||
|
||||
warning: method `w` is never used
|
||||
--> $DIR/lifetime.rs:24:8
|
||||
--> $DIR/lifetime.rs:22:8
|
||||
|
|
||||
LL | trait Bar: Foo {
|
||||
| --- method in this trait
|
||||
|
@ -1,7 +1,5 @@
|
||||
//@ build-pass
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Supertrait<T> {
|
||||
fn method(&self) {}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
//@ check-fail
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Bar<T> {
|
||||
fn bar(&self, _: T) {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/multiple-occurrence-ambiguousity.rs:20:26
|
||||
--> $DIR/multiple-occurrence-ambiguousity.rs:19:26
|
||||
|
|
||||
LL | let t: &dyn Bar<_> = s;
|
||||
| ----------- ^ expected trait `Bar`, found trait `Foo`
|
||||
|
@ -1,10 +1,8 @@
|
||||
// Test for <https://github.com/rust-lang/rust/issues/135316>.
|
||||
//
|
||||
//@ run-pass
|
||||
//@ check-run-results
|
||||
|
||||
// Test for <https://github.com/rust-lang/rust/issues/135316>.
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Supertrait<T> {
|
||||
fn _print_numbers(&self, mem: &[usize; 100]) {
|
||||
println!("{mem:?}");
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
// Test for <https://github.com/rust-lang/rust/issues/135315>.
|
||||
|
||||
|
@ -5,7 +5,7 @@ error: vtable entries: [
|
||||
Method(<() as Supertrait<()>>::_print_numbers),
|
||||
Method(<() as Middle<()>>::say_hello),
|
||||
]
|
||||
--> $DIR/multiple-supertraits-modulo-normalization-vtable.rs:30:1
|
||||
--> $DIR/multiple-supertraits-modulo-normalization-vtable.rs:29:1
|
||||
|
|
||||
LL | impl Trait for () {}
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
@ -17,7 +17,7 @@ error: vtable entries: [
|
||||
Method(<dyn Middle<()> as Supertrait<()>>::_print_numbers - shim(reify)),
|
||||
Method(<dyn Middle<()> as Middle<()>>::say_hello - shim(reify)),
|
||||
]
|
||||
--> $DIR/multiple-supertraits-modulo-normalization-vtable.rs:34:1
|
||||
--> $DIR/multiple-supertraits-modulo-normalization-vtable.rs:33:1
|
||||
|
|
||||
LL | type Virtual = dyn Middle<()>;
|
||||
| ^^^^^^^^^^^^
|
||||
|
@ -1,10 +1,8 @@
|
||||
// Test for <https://github.com/rust-lang/rust/issues/135315>.
|
||||
//
|
||||
//@ run-pass
|
||||
//@ check-run-results
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
// Test for <https://github.com/rust-lang/rust/issues/135315>.
|
||||
|
||||
trait Supertrait<T> {
|
||||
fn _print_numbers(&self, mem: &[usize; 100]) {
|
||||
println!("{mem:?}");
|
||||
|
@ -4,8 +4,6 @@
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Mirror {
|
||||
type Assoc;
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Ensure we don't have ambiguity when upcasting to two supertraits
|
||||
// that are identical modulo normalization.
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Supertrait<T> {
|
||||
fn method(&self) {}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait A {
|
||||
fn foo_a(&self); //~ WARN method `foo_a` is never used
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: method `foo_a` is never used
|
||||
--> $DIR/replace-vptr.rs:6:8
|
||||
--> $DIR/replace-vptr.rs:4:8
|
||||
|
|
||||
LL | trait A {
|
||||
| - method in this trait
|
||||
@ -9,7 +9,7 @@ LL | fn foo_a(&self);
|
||||
= note: `#[warn(dead_code)]` on by default
|
||||
|
||||
warning: method `foo_c` is never used
|
||||
--> $DIR/replace-vptr.rs:14:8
|
||||
--> $DIR/replace-vptr.rs:12:8
|
||||
|
|
||||
LL | trait C: A + B {
|
||||
| - method in this trait
|
||||
|
@ -1,7 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync {
|
||||
fn a(&self) -> i32 {
|
||||
10
|
||||
|
@ -1,12 +1,12 @@
|
||||
error[E0599]: no method named `c` found for reference `&dyn Bar` in the current scope
|
||||
--> $DIR/subtrait-method.rs:55:9
|
||||
--> $DIR/subtrait-method.rs:53:9
|
||||
|
|
||||
LL | bar.c();
|
||||
| ^
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
note: `Baz` defines an item `c`, perhaps you need to implement it
|
||||
--> $DIR/subtrait-method.rs:27:1
|
||||
--> $DIR/subtrait-method.rs:25:1
|
||||
|
|
||||
LL | trait Baz: Bar {
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -16,14 +16,14 @@ LL | bar.a();
|
||||
| ~
|
||||
|
||||
error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope
|
||||
--> $DIR/subtrait-method.rs:59:9
|
||||
--> $DIR/subtrait-method.rs:57:9
|
||||
|
|
||||
LL | foo.b();
|
||||
| ^
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
note: `Bar` defines an item `b`, perhaps you need to implement it
|
||||
--> $DIR/subtrait-method.rs:17:1
|
||||
--> $DIR/subtrait-method.rs:15:1
|
||||
|
|
||||
LL | trait Bar: Foo {
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -33,14 +33,14 @@ LL | foo.a();
|
||||
| ~
|
||||
|
||||
error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope
|
||||
--> $DIR/subtrait-method.rs:61:9
|
||||
--> $DIR/subtrait-method.rs:59:9
|
||||
|
|
||||
LL | foo.c();
|
||||
| ^
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
note: `Baz` defines an item `c`, perhaps you need to implement it
|
||||
--> $DIR/subtrait-method.rs:27:1
|
||||
--> $DIR/subtrait-method.rs:25:1
|
||||
|
|
||||
LL | trait Baz: Bar {
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -50,14 +50,14 @@ LL | foo.a();
|
||||
| ~
|
||||
|
||||
error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope
|
||||
--> $DIR/subtrait-method.rs:65:9
|
||||
--> $DIR/subtrait-method.rs:63:9
|
||||
|
|
||||
LL | foo.b();
|
||||
| ^
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
note: `Bar` defines an item `b`, perhaps you need to implement it
|
||||
--> $DIR/subtrait-method.rs:17:1
|
||||
--> $DIR/subtrait-method.rs:15:1
|
||||
|
|
||||
LL | trait Bar: Foo {
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -67,14 +67,14 @@ LL | foo.a();
|
||||
| ~
|
||||
|
||||
error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope
|
||||
--> $DIR/subtrait-method.rs:67:9
|
||||
--> $DIR/subtrait-method.rs:65:9
|
||||
|
|
||||
LL | foo.c();
|
||||
| ^
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
note: `Baz` defines an item `c`, perhaps you need to implement it
|
||||
--> $DIR/subtrait-method.rs:27:1
|
||||
--> $DIR/subtrait-method.rs:25:1
|
||||
|
|
||||
LL | trait Baz: Bar {
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
@ -1,7 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Super<U> {
|
||||
fn call(&self)
|
||||
where
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0605]: non-primitive cast: `&dyn Foo` as `&dyn Bar<_>`
|
||||
--> $DIR/type-checking-test-1.rs:20:13
|
||||
--> $DIR/type-checking-test-1.rs:18:13
|
||||
|
|
||||
LL | let _ = x as &dyn Bar<_>; // Ambiguous
|
||||
| ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0605]: non-primitive cast: `&dyn Foo` as `&dyn Bar<_>`
|
||||
--> $DIR/type-checking-test-1.rs:20:13
|
||||
--> $DIR/type-checking-test-1.rs:18:13
|
||||
|
|
||||
LL | let _ = x as &dyn Bar<_>; // Ambiguous
|
||||
| ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
||||
|
@ -2,8 +2,6 @@
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo: Bar<i32> + Bar<u32> {}
|
||||
trait Bar<T> {
|
||||
fn bar(&self) -> Option<T> {
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo<T>: Bar<i32> + Bar<T> {}
|
||||
trait Bar<T> {
|
||||
fn bar(&self) -> Option<T> {
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0605]: non-primitive cast: `&dyn Foo<i32>` as `&dyn Bar<u32>`
|
||||
--> $DIR/type-checking-test-2.rs:19:13
|
||||
--> $DIR/type-checking-test-2.rs:17:13
|
||||
|
|
||||
LL | let _ = x as &dyn Bar<u32>; // Error
|
||||
| ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
||||
|
||||
error[E0605]: non-primitive cast: `&dyn Foo<u32>` as `&dyn Bar<_>`
|
||||
--> $DIR/type-checking-test-2.rs:24:13
|
||||
--> $DIR/type-checking-test-2.rs:22:13
|
||||
|
|
||||
LL | let a = x as &dyn Bar<_>; // Ambiguous
|
||||
| ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo<'a>: Bar<'a> {}
|
||||
trait Bar<'a> {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/type-checking-test-3.rs:11:13
|
||||
--> $DIR/type-checking-test-3.rs:9:13
|
||||
|
|
||||
LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) {
|
||||
| -- lifetime `'a` defined here
|
||||
@ -7,7 +7,7 @@ LL | let _ = x as &dyn Bar<'a>; // Error
|
||||
| ^^^^^^^^^^^^^^^^^ cast requires that `'a` must outlive `'static`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/type-checking-test-3.rs:16:18
|
||||
--> $DIR/type-checking-test-3.rs:14:18
|
||||
|
|
||||
LL | fn test_wrong2<'a>(x: &dyn Foo<'a>) {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Foo<'a>: Bar<'a, 'a> {}
|
||||
trait Bar<'a, 'b> {
|
||||
fn get_b(&self) -> Option<&'a u32> {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/type-checking-test-4.rs:19:13
|
||||
--> $DIR/type-checking-test-4.rs:17:13
|
||||
|
|
||||
LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) {
|
||||
| -- lifetime `'a` defined here
|
||||
@ -7,7 +7,7 @@ LL | let _ = x as &dyn Bar<'static, 'a>; // Error
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'a` must outlive `'static`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/type-checking-test-4.rs:24:18
|
||||
--> $DIR/type-checking-test-4.rs:22:18
|
||||
|
|
||||
LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) {
|
||||
| -- lifetime `'a` defined here
|
||||
@ -15,7 +15,7 @@ LL | let _ = x as &dyn Bar<'a, 'static>; // Error
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/type-checking-test-4.rs:30:5
|
||||
--> $DIR/type-checking-test-4.rs:28:5
|
||||
|
|
||||
LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
|
||||
| -- lifetime `'a` defined here
|
||||
@ -24,7 +24,7 @@ LL | y.get_b() // ERROR
|
||||
| ^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/type-checking-test-4.rs:35:5
|
||||
--> $DIR/type-checking-test-4.rs:33:5
|
||||
|
|
||||
LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
|
||||
| -- lifetime `'a` defined here
|
||||
@ -32,7 +32,7 @@ LL | <_ as Bar>::get_b(x) // ERROR
|
||||
| ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/type-checking-test-4.rs:40:5
|
||||
--> $DIR/type-checking-test-4.rs:38:5
|
||||
|
|
||||
LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
|
||||
| -- lifetime `'a` defined here
|
||||
@ -40,7 +40,7 @@ LL | <_ as Bar<'_, '_>>::get_b(x) // ERROR
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/type-checking-test-4.rs:48:5
|
||||
--> $DIR/type-checking-test-4.rs:46:5
|
||||
|
|
||||
LL | fn test_wrong6<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(trait_upcasting, type_alias_impl_trait)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
//@ check-pass
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@check-pass
|
||||
|
||||
#![feature(trait_upcasting, type_alias_impl_trait)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
trait Super {
|
||||
type Assoc;
|
||||
|
@ -1,14 +0,0 @@
|
||||
error[E0658]: cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental
|
||||
--> $DIR/upcast-through-struct-tail.rs:11:5
|
||||
|
|
||||
LL | x
|
||||
| ^
|
||||
|
|
||||
= note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information
|
||||
= help: add `#![feature(trait_upcasting)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: required when coercing `Box<Wrapper<(dyn A + 'a)>>` into `Box<Wrapper<(dyn B + 'a)>>`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,14 +0,0 @@
|
||||
error[E0658]: cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental
|
||||
--> $DIR/upcast-through-struct-tail.rs:11:5
|
||||
|
|
||||
LL | x
|
||||
| ^
|
||||
|
|
||||
= note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information
|
||||
= help: add `#![feature(trait_upcasting)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: required when coercing `Box<Wrapper<(dyn A + 'a)>>` into `Box<Wrapper<(dyn B + 'a)>>`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -1,3 +1,4 @@
|
||||
//@ check-pass
|
||||
//@ revisions: current next
|
||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
@ -9,7 +10,6 @@ trait B {}
|
||||
|
||||
fn test<'a>(x: Box<Wrapper<dyn A + 'a>>) -> Box<Wrapper<dyn B + 'a>> {
|
||||
x
|
||||
//~^ ERROR cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -2,8 +2,6 @@
|
||||
//
|
||||
// issue: <https://github.com/rust-lang/rust/issues/131813>
|
||||
|
||||
#![feature(trait_upcasting)]
|
||||
|
||||
trait Pollable {
|
||||
#[allow(unused)]
|
||||
fn poll(&self) {}
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(trait_upcasting)]
|
||||
//@ check-fail
|
||||
//
|
||||
// issue: <https://github.com/rust-lang/rust/pull/120222>
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0606]: casting `*const dyn Trait<u8, u8>` as `*const dyn Trait<u8, u16>` is invalid
|
||||
--> $DIR/upcast_soundness_bug.rs:59:13
|
||||
--> $DIR/upcast_soundness_bug.rs:58:13
|
||||
|
|
||||
LL | let p = p as *const dyn Trait<u8, u16>; // <- this is bad!
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user