File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1508,6 +1508,19 @@ generate_iterator_test! {
1508
1508
with str :: rsplitn;
1509
1509
}
1510
1510
1511
+ #[ test]
1512
+ fn different_str_pattern_forwarding_lifetimes ( ) {
1513
+ use std:: str:: pattern:: Pattern ;
1514
+
1515
+ fn foo < ' a , P > ( p : P ) where for < ' b > & ' b P : Pattern < ' a > {
1516
+ for _ in 0 ..3 {
1517
+ "asdf" . find ( & p) ;
1518
+ }
1519
+ }
1520
+
1521
+ foo :: < & str > ( "x" ) ;
1522
+ }
1523
+
1511
1524
mod bench {
1512
1525
use test:: { Bencher , black_box} ;
1513
1526
Original file line number Diff line number Diff line change @@ -492,7 +492,7 @@ impl<'a, F> Pattern<'a> for F where F: FnMut(char) -> bool {
492
492
/////////////////////////////////////////////////////////////////////////////
493
493
494
494
/// Delegates to the `&str` impl.
495
- impl < ' a , ' b > Pattern < ' a > for & ' b & ' b str {
495
+ impl < ' a , ' b , ' c > Pattern < ' a > for & ' c & ' b str {
496
496
pattern_methods ! ( StrSearcher <' a, ' b>, |& s| s, |s| s) ;
497
497
}
498
498
You can’t perform that action at this time.
0 commit comments