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! {
15081508 with str :: rsplitn;
15091509}
15101510
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+
15111524mod bench {
15121525 use test:: { Bencher , black_box} ;
15131526
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 {
492492/////////////////////////////////////////////////////////////////////////////
493493
494494/// 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 {
496496 pattern_methods ! ( StrSearcher <' a, ' b>, |& s| s, |s| s) ;
497497}
498498
You can’t perform that action at this time.
0 commit comments