This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ #![ feature( type_alias_impl_trait) ]
4+
5+ struct MyTy < ' a > ( Vec < u8 > , & ' a ( ) ) ;
6+
7+ impl MyTy < ' _ > {
8+ fn one ( & mut self ) -> & mut impl Sized {
9+ & mut self . 0
10+ }
11+ fn two ( & mut self ) -> & mut ( impl Sized + ' static ) {
12+ self . one ( )
13+ }
14+ }
15+
16+ type Opaque < ' a > = impl Sized ;
17+ fn define < ' a > ( ) -> Opaque < ' a > { }
18+
19+ fn test < ' a > ( ) {
20+ None :: < & ' static Opaque < ' a > > ;
21+ }
22+
23+ fn one < ' a , ' b : ' b > ( ) -> & ' a impl Sized {
24+ & ( )
25+ }
26+ fn two < ' a , ' b > ( ) {
27+ one :: < ' a , ' b > ( ) ;
28+ }
29+
30+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ // check-pass
2+ #![ feature( type_alias_impl_trait) ]
3+
4+ fn opaque < ' a : ' a > ( ) -> impl Sized { }
5+ fn assert_static < T : ' static > ( _: T ) { }
6+
7+ fn test_closure ( ) {
8+ let closure = |_| {
9+ assert_static ( opaque ( ) ) ;
10+ } ;
11+ closure ( & opaque ( ) ) ;
12+ }
13+
14+ type Opaque < ' a > = impl Sized ;
15+ fn define < ' a > ( ) -> Opaque < ' a > { }
16+
17+ fn test_tait ( _: & Opaque < ' _ > ) {
18+ None :: < & ' static Opaque < ' _ > > ;
19+ }
20+
21+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0428]: the name `test` is defined multiple times
2+ --> $DIR/issue-108592.rs:17:1
3+ |
4+ LL | fn test() {
5+ | --------- previous definition of the value `test` here
6+ ...
7+ LL | fn test(_: &Opaque<'_>) {
8+ | ^^^^^^^^^^^^^^^^^^^^^^^ `test` redefined here
9+ |
10+ = note: `test` must be defined only once in the value namespace of this module
11+
12+ error[E0601]: `main` function not found in crate `issue_108592`
13+ --> $DIR/issue-108592.rs:20:2
14+ |
15+ LL | }
16+ | ^ consider adding a `main` function to `$DIR/issue-108592.rs`
17+
18+ error: aborting due to 2 previous errors
19+
20+ Some errors have detailed explanations: E0428, E0601.
21+ For more information about an error, try `rustc --explain E0428`.
You can’t perform that action at this time.
0 commit comments