2024-06-23 12:55:17 -05:00
|
|
|
//@ check-pass
|
2024-01-22 13:08:19 -06:00
|
|
|
|
|
|
|
trait Trait<'a> {}
|
|
|
|
|
|
|
|
fn add_auto<'a>(x: *mut dyn Trait<'a>) -> *mut (dyn Trait<'a> + Send) {
|
2024-06-23 12:55:17 -05:00
|
|
|
x as _
|
|
|
|
//~^ warning: adding an auto trait `Send` to a trait object in a pointer cast may cause UB later on
|
|
|
|
//~| warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
2024-01-22 13:08:19 -06:00
|
|
|
}
|
|
|
|
|
2024-07-04 09:46:00 -05:00
|
|
|
// (to test diagnostic list formatting)
|
|
|
|
fn add_multiple_auto<'a>(x: *mut dyn Trait<'a>) -> *mut (dyn Trait<'a> + Send + Sync + Unpin) {
|
|
|
|
x as _
|
2024-07-04 11:38:18 -05:00
|
|
|
//~^ warning: adding auto traits `Send`, `Sync`, and `Unpin` to a trait object in a pointer cast may cause UB later on
|
2024-07-04 09:46:00 -05:00
|
|
|
//~| warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
|
|
}
|
|
|
|
|
2024-01-22 13:08:19 -06:00
|
|
|
fn main() {}
|