mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-18 09:53:26 +00:00
![Benoît du Garreau](/assets/img/avatar_default.png)
Use a GAT for `Searcher` associated type because this trait is always implemented for every lifetime anyway.
17 lines
358 B
Rust
17 lines
358 B
Rust
//@ run-rustfix
|
|
|
|
fn foo(x: &str) -> bool {
|
|
x.starts_with(&("hi".to_string() + " you"))
|
|
//~^ ERROR the trait bound `String: Pattern` is not satisfied [E0277]
|
|
}
|
|
|
|
fn foo2(x: &str) -> bool {
|
|
x.starts_with(&"hi".to_string())
|
|
//~^ ERROR the trait bound `String: Pattern` is not satisfied [E0277]
|
|
}
|
|
|
|
fn main() {
|
|
foo("hi you");
|
|
foo2("hi");
|
|
}
|