rust/tests/ui/sized-hierarchy/pretty-print-no-feat-dep-has-feat.rs
David Wood 9044b78c0d
trait_sel: print {Meta,Pointee}Sized impl headers
When printing impl headers in a diagnostic, the compiler has to account
for `?Sized` implying `MetaSized` and new `MetaSized` and `PointeeSized`
bounds.
2025-06-16 23:04:34 +00:00

27 lines
1.0 KiB
Rust

//@ aux-build:pretty-print-dep.rs
//@ compile-flags: --crate-type=lib
extern crate pretty_print_dep;
use pretty_print_dep::{SizedTr, NegSizedTr, MetaSizedTr, PointeeSizedTr};
// Test that printing the sizedness trait bounds in the conflicting impl error without enabling
// `sized_hierarchy` will continue to print `?Sized`, even if the dependency is compiled with
// `sized_hierarchy`.
//
// It isn't possible to write a test that matches the multiline note containing the important
// diagnostic output being tested - so check the stderr changes carefully!
struct X<T>(T);
impl<T: Sized> SizedTr for X<T> {}
//~^ ERROR conflicting implementations of trait `SizedTr` for type `X<_>`
impl<T: ?Sized> NegSizedTr for X<T> {}
//~^ ERROR conflicting implementations of trait `NegSizedTr` for type `X<_>`
impl<T: ?Sized> MetaSizedTr for X<T> {}
//~^ ERROR conflicting implementations of trait `MetaSizedTr` for type `X<_>`
impl<T: ?Sized> PointeeSizedTr for X<T> {}
//~^ ERROR conflicting implementations of trait `PointeeSizedTr` for type `X<_>`