mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
32 lines
985 B
Rust
32 lines
985 B
Rust
//@ 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)]
|
|
trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy, X: std::marker::Copy {
|
|
fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> {
|
|
//~^ ERROR the trait bound `X: Copy` is not satisfied
|
|
ConstrainedStruct { x }
|
|
//~^ ERROR the trait bound `X: Copy` is not satisfied
|
|
}
|
|
}
|
|
|
|
// Regression test for #120838
|
|
#[allow(dead_code)]
|
|
trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy, X: std::marker::Copy {
|
|
fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> {
|
|
//~^ ERROR the trait bound `X: Copy` is not satisfied
|
|
ConstrainedStruct { x }
|
|
//~^ ERROR the trait bound `X: Copy` is not satisfied
|
|
}
|
|
}
|
|
|
|
pub fn main() { }
|