File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ // regression test for #91489
4+
5+ use std:: borrow:: Borrow ;
6+ use std:: borrow:: Cow ;
7+
8+ pub struct VariantType { }
9+ pub struct VariantTy { }
10+
11+ impl Borrow < VariantTy > for VariantType {
12+ fn borrow ( & self ) -> & VariantTy {
13+ unimplemented ! ( )
14+ }
15+ }
16+
17+ impl ToOwned for VariantTy {
18+ type Owned = VariantType ;
19+ fn to_owned ( & self ) -> VariantType {
20+ unimplemented ! ( )
21+ }
22+ }
23+
24+ impl VariantTy {
25+ pub fn as_str ( & self ) -> ( ) { }
26+ }
27+
28+ // the presence of this was causing all attempts to call `as_str` on
29+ // `Cow<'_, VariantTy>, including in itself, to not find the method
30+ static _TYP: ( ) = {
31+ let _ = || {
32+ // should be found
33+ Cow :: Borrowed ( & VariantTy { } ) . as_str ( ) ;
34+ } ;
35+ } ;
36+
37+ fn main ( ) {
38+ // should be found
39+ Cow :: Borrowed ( & VariantTy { } ) . as_str ( )
40+ }
You can’t perform that action at this time.
0 commit comments