2020-09-14 03:55:06 +00:00
|
|
|
//@ run-rustfix
|
|
|
|
|
|
|
|
#[allow(unused)]
|
|
|
|
use std::fmt::Debug;
|
|
|
|
// Rustfix should add this, or use `std::fmt::Debug` instead.
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
struct ConstrainedStruct<X: Copy> {
|
|
|
|
x: X
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
2024-02-09 12:17:55 +00:00
|
|
|
trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy, X: std::marker::Copy {
|
2020-09-14 03:55:06 +00:00
|
|
|
fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> {
|
|
|
|
//~^ ERROR the trait bound `X: Copy` is not satisfied
|
|
|
|
ConstrainedStruct { x }
|
2024-02-09 12:17:55 +00:00
|
|
|
//~^ ERROR the trait bound `X: Copy` is not satisfied
|
2020-09-14 03:55:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-10 10:35:39 +00:00
|
|
|
// Regression test for #120838
|
|
|
|
#[allow(dead_code)]
|
2024-02-09 12:17:55 +00:00
|
|
|
trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy, X: std::marker::Copy {
|
2024-02-10 10:35:39 +00:00
|
|
|
fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> {
|
|
|
|
//~^ ERROR the trait bound `X: Copy` is not satisfied
|
|
|
|
ConstrainedStruct { x }
|
2024-02-09 12:17:55 +00:00
|
|
|
//~^ ERROR the trait bound `X: Copy` is not satisfied
|
2024-02-10 10:35:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-14 03:55:06 +00:00
|
|
|
pub fn main() { }
|