rust/tests/ui/trait-impl-bound-suggestions.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
742 B
Rust
Raw Normal View History

// 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=()> {
fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> {
//~^ ERROR the trait bound `X: Copy` is not satisfied
ConstrainedStruct { x }
}
}
// Regression test for #120838
#[allow(dead_code)]
trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where {
fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> {
//~^ ERROR the trait bound `X: Copy` is not satisfied
ConstrainedStruct { x }
}
}
pub fn main() { }