2025-07-18 12:24:56 +02:00
|
|
|
// Test that we emit a correct structured suggestions for dynamically sized ("maybe unsized")
|
|
|
|
|
// function parameters.
|
|
|
|
|
// We used to emit a butchered suggestion if duplicate relaxed `Sized` bounds were present.
|
|
|
|
|
// issue: <https://github.com/rust-lang/rust/issues/127441>.
|
2024-07-14 17:46:25 +05:30
|
|
|
|
|
|
|
|
use std::fmt::Debug;
|
|
|
|
|
|
|
|
|
|
fn foo1<T: ?Sized>(a: T) {}
|
2025-07-18 12:24:56 +02:00
|
|
|
//~^ ERROR the size for values of type `T` cannot be known at compilation time
|
2024-07-14 17:46:25 +05:30
|
|
|
|
|
|
|
|
fn foo2<T: ?Sized + ?Sized>(a: T) {}
|
2025-07-18 12:24:56 +02:00
|
|
|
//~^ ERROR duplicate relaxed `Sized` bounds
|
2024-07-14 17:46:25 +05:30
|
|
|
//~| ERROR the size for values of type `T` cannot be known at compilation time
|
|
|
|
|
|
|
|
|
|
fn foo3<T: ?Sized + ?Sized + Debug>(a: T) {}
|
2025-07-18 12:24:56 +02:00
|
|
|
//~^ ERROR duplicate relaxed `Sized` bounds
|
|
|
|
|
//~| ERROR the size for values of type `T` cannot be known at compilation time
|
2024-07-14 17:46:25 +05:30
|
|
|
|
|
|
|
|
fn foo4<T: ?Sized + Debug + ?Sized >(a: T) {}
|
2025-07-18 12:24:56 +02:00
|
|
|
//~^ ERROR duplicate relaxed `Sized` bounds
|
2024-07-14 17:46:25 +05:30
|
|
|
//~| ERROR the size for values of type `T` cannot be known at compilation time
|
|
|
|
|
|
|
|
|
|
fn foo5(_: impl ?Sized) {}
|
|
|
|
|
//~^ ERROR the size for values of type `impl ?Sized` cannot be known at compilation time
|
|
|
|
|
|
|
|
|
|
fn foo6(_: impl ?Sized + ?Sized) {}
|
2025-07-18 12:24:56 +02:00
|
|
|
//~^ ERROR duplicate relaxed `Sized` bounds
|
2024-07-14 17:46:25 +05:30
|
|
|
//~| ERROR the size for values of type `impl ?Sized + ?Sized` cannot be known at compilation tim
|
|
|
|
|
|
|
|
|
|
fn foo7(_: impl ?Sized + ?Sized + Debug) {}
|
2025-07-18 12:24:56 +02:00
|
|
|
//~^ ERROR duplicate relaxed `Sized` bounds
|
2024-07-14 17:46:25 +05:30
|
|
|
//~| ERROR the size for values of type `impl ?Sized + ?Sized + Debug` cannot be known at compilation time
|
|
|
|
|
|
|
|
|
|
fn foo8(_: impl ?Sized + Debug + ?Sized ) {}
|
2025-07-18 12:24:56 +02:00
|
|
|
//~^ ERROR duplicate relaxed `Sized` bounds
|
2024-07-14 17:46:25 +05:30
|
|
|
//~| ERROR the size for values of type `impl ?Sized + Debug + ?Sized` cannot be known at compilation time
|
|
|
|
|
|
|
|
|
|
fn main() {}
|