rust/tests/ui/suggestions/dont-suggest-borrowing-existing-borrow.rs
Esteban Küber d6924441cd Update test
2025-07-10 17:34:39 +00:00

28 lines
779 B
Rust

//@ run-rustfix
struct S;
trait Trait {
fn foo() {}
}
impl Trait for &mut S {}
trait Trait2 {
fn bar() {}
}
impl Trait2 for &S {}
impl Trait2 for &mut S {}
fn main() {
let _ = &str::from("value");
//~^ ERROR the trait bound `str: From<_>` is not satisfied
//~| ERROR the size for values of type `str` cannot be known at compilation time
let _ = &mut S::foo();
//~^ ERROR the trait bound `S: Trait` is not satisfied
let _ = &S::foo();
//~^ ERROR the trait bound `S: Trait` is not satisfied
let _ = S::foo();
//~^ ERROR the trait bound `S: Trait` is not satisfied
let _ = &mut S::bar();
//~^ ERROR the trait bound `S: Trait2` is not satisfied
let _ = &S::bar();
//~^ ERROR the trait bound `S: Trait2` is not satisfied
}