Skip to content

Commit 3215403

Browse files
committed
tests
1 parent cbf9153 commit 3215403

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ LL | let _result = &Some(42).as_deref();
66
|
77
= note: the following trait bounds were not satisfied:
88
`{integer}: Deref`
9-
`<{integer} as Deref>::Target = _`
109

1110
error: aborting due to previous error
1211

src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let _result = &mut Some(42).as_deref_mut();
66
|
77
= note: the following trait bounds were not satisfied:
88
`{integer}: DerefMut`
9-
`<{integer} as Deref>::Target = _`
9+
`{integer}: Deref`
1010

1111
error: aborting due to previous error
1212

src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ LL | let _result = &Ok(42).as_deref();
66
|
77
= note: the following trait bounds were not satisfied:
88
`{integer}: Deref`
9-
`<{integer} as Deref>::Target = _`
109

1110
error: aborting due to previous error
1211

src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let _result = &mut Ok(42).as_deref_mut();
66
|
77
= note: the following trait bounds were not satisfied:
88
`{integer}: DerefMut`
9-
`<{integer} as Deref>::Target = _`
9+
`{integer}: Deref`
1010

1111
error: aborting due to previous error
1212

src/test/ui/resolve/issue-85671.rs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// check-pass
2+
3+
// Some trait with a function that returns a slice:
4+
pub trait AsSlice {
5+
type Element;
6+
fn as_slice(&self) -> &[Self::Element];
7+
}
8+
9+
// Some type
10+
pub struct A<Cont>(Cont);
11+
12+
// Here we say that if A wraps a slice, then it implements AsSlice
13+
impl<'a, Element> AsSlice for A<&'a [Element]> {
14+
type Element = Element;
15+
fn as_slice(&self) -> &[Self::Element] {
16+
self.0
17+
}
18+
}
19+
20+
impl<Cont> A<Cont> {
21+
// We want this function to work
22+
pub fn failing<Coef>(&self)
23+
where
24+
Self: AsSlice<Element = Coef>,
25+
{
26+
self.as_ref_a().as_ref_a();
27+
}
28+
29+
pub fn as_ref_a<Coef>(&self) -> A<&[<Self as AsSlice>::Element]>
30+
where
31+
Self: AsSlice<Element = Coef>,
32+
{
33+
A(self.as_slice())
34+
}
35+
}
36+
37+
fn main() {}

0 commit comments

Comments
 (0)