File tree 2 files changed +45
-4
lines changed
2 files changed +45
-4
lines changed Original file line number Diff line number Diff line change @@ -613,6 +613,50 @@ fn main() {
613
613
) ;
614
614
}
615
615
616
+ #[ test]
617
+ fn self_with_capital_s ( ) {
618
+ check_pass (
619
+ r#"
620
+ //- minicore: fn, add, copy
621
+
622
+ struct S1;
623
+
624
+ impl S1 {
625
+ fn f() {
626
+ Self;
627
+ }
628
+ }
629
+
630
+ struct S2 {
631
+ f1: i32,
632
+ }
633
+
634
+ impl S2 {
635
+ fn f() {
636
+ Self { f1: 5 };
637
+ }
638
+ }
639
+
640
+ struct S3(i32);
641
+
642
+ impl S3 {
643
+ fn f() {
644
+ Self(2);
645
+ Self;
646
+ let this = Self;
647
+ this(2);
648
+ }
649
+ }
650
+
651
+ fn main() {
652
+ S1::f();
653
+ S2::f();
654
+ S3::f();
655
+ }
656
+ "# ,
657
+ ) ;
658
+ }
659
+
616
660
#[ test]
617
661
fn syscalls ( ) {
618
662
check_pass (
Original file line number Diff line number Diff line change @@ -486,13 +486,10 @@ impl<'ctx> MirLowerCtx<'ctx> {
486
486
) ;
487
487
Ok ( Some ( current) )
488
488
}
489
- ValueNs :: FunctionId ( _) | ValueNs :: StructId ( _) => {
489
+ ValueNs :: FunctionId ( _) | ValueNs :: StructId ( _) | ValueNs :: ImplSelf ( _ ) => {
490
490
// It's probably a unit struct or a zero sized function, so no action is needed.
491
491
Ok ( Some ( current) )
492
492
}
493
- it => {
494
- not_supported ! ( "unknown name {it:?} in value name space" ) ;
495
- }
496
493
}
497
494
}
498
495
Expr :: If { condition, then_branch, else_branch } => {
You can’t perform that action at this time.
0 commit comments