Skip to content

Commit ff59a93

Browse files
Rollup merge of rust-lang#153664 - estebank:issue-109804, r=lqd
Add test for rust-lang#109804 Close rust-lang#109804.
2 parents 25fae37 + ff67fd0 commit ff59a93

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
use std::borrow::Borrow;
2+
pub const F: for<'a> fn(&'a &'static String) -> &'a str = <&'static String as Borrow<str>>::borrow;
3+
//~^ ERROR E0277
4+
fn main() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0277]: the trait bound `&'static String: Borrow<str>` is not satisfied
2+
--> $DIR/suggest-remove-reference-in-where-clause.rs:2:60
3+
|
4+
LL | pub const F: for<'a> fn(&'a &'static String) -> &'a str = <&'static String as Borrow<str>>::borrow;
5+
| ^^^^^^^^^^^^^^^ the trait `Borrow<str>` is not implemented for `&'static String`
6+
|
7+
help: consider removing the leading `&`-reference
8+
|
9+
LL - pub const F: for<'a> fn(&'a &'static String) -> &'a str = <&'static String as Borrow<str>>::borrow;
10+
LL + pub const F: for<'a> fn(&'a &'static String) -> &'a str = <String as Borrow<str>>::borrow;
11+
|
12+
13+
error: aborting due to 1 previous error
14+
15+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)