about summary refs log tree commit diff
path: root/tests/ui/suggestions/trait-impl-bound-suggestions.fixed
blob: 9d3168f5acd68c99e7380c0da3bbc48fc8128eec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//@ 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() { }