We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 53d4476 commit 5473033Copy full SHA for 5473033
tests/ui/traits/associated_type_bound/hrtb-associated.rs
@@ -0,0 +1,30 @@
1
+//@ run-pass
2
+//! This test ensures that HRTB (higher-ranked trait bounds) on associated types
3
+//! compile correctly. This was previously rejected by the compiler.
4
+//! Related issue: <https://github.com/rust-lang/rust/issues/34834>
5
+
6
+pub trait Provides<'a> {
7
+ type Item;
8
+}
9
10
+pub trait Selector: for<'a> Provides<'a> {
11
+ type Namespace: PartialEq + for<'a> PartialEq<<Self as Provides<'a>>::Item>;
12
13
+ fn get_namespace(&self) -> <Self as Provides>::Item;
14
15
16
+pub struct MySelector;
17
18
+impl<'a> Provides<'a> for MySelector {
19
+ type Item = &'a str;
20
21
22
+impl Selector for MySelector {
23
+ type Namespace = String;
24
25
+ fn get_namespace(&self) -> &str {
26
+ unimplemented!()
27
+ }
28
29
30
+fn main() {}
0 commit comments