Sort trait names before printing
This commit is contained in:
parent
a1f20f17c8
commit
56de9da1f8
@ -897,10 +897,15 @@ fn check_ptr_ptr_cast(
|
||||
self.span,
|
||||
errors::PtrCastAddAutoToObject {
|
||||
traits_len: added.len(),
|
||||
traits: added
|
||||
.into_iter()
|
||||
.map(|trait_did| tcx.def_path_str(trait_did))
|
||||
.collect(),
|
||||
traits: {
|
||||
let mut traits: Vec<_> = added
|
||||
.into_iter()
|
||||
.map(|trait_did| tcx.def_path_str(trait_did))
|
||||
.collect();
|
||||
|
||||
traits.sort();
|
||||
traits.into()
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ fn add_auto<'a>(x: *mut dyn Trait<'a>) -> *mut (dyn Trait<'a> + Send) {
|
||||
// (to test diagnostic list formatting)
|
||||
fn add_multiple_auto<'a>(x: *mut dyn Trait<'a>) -> *mut (dyn Trait<'a> + Send + Sync + Unpin) {
|
||||
x as _
|
||||
//~^ warning: adding auto traits `Sync`, `Send`, and `Unpin` to a trait object in a pointer cast may cause UB later on
|
||||
//~^ warning: adding auto traits `Send`, `Sync`, and `Unpin` 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!
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ LL | x as _
|
||||
= note: for more information, see issue #127323 <https://github.com/rust-lang/rust/issues/127323>
|
||||
= note: `#[warn(ptr_cast_add_auto_to_object)]` on by default
|
||||
|
||||
warning: adding auto traits `Sync`, `Send`, and `Unpin` to a trait object in a pointer cast may cause UB later on
|
||||
warning: adding auto traits `Send`, `Sync`, and `Unpin` to a trait object in a pointer cast may cause UB later on
|
||||
--> $DIR/ptr-to-trait-obj-add-auto.rs:13:5
|
||||
|
|
||||
LL | x as _
|
||||
@ -31,7 +31,7 @@ LL | x as _
|
||||
= note: `#[warn(ptr_cast_add_auto_to_object)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
warning: adding auto traits `Sync`, `Send`, and `Unpin` to a trait object in a pointer cast may cause UB later on
|
||||
warning: adding auto traits `Send`, `Sync`, and `Unpin` to a trait object in a pointer cast may cause UB later on
|
||||
--> $DIR/ptr-to-trait-obj-add-auto.rs:13:5
|
||||
|
|
||||
LL | x as _
|
||||
|
Loading…
Reference in New Issue
Block a user