File tree Expand file tree Collapse file tree 2 files changed +45
-4
lines changed Expand file tree Collapse file tree 2 files changed +45
-4
lines changed Original file line number Diff line number Diff line change @@ -613,6 +613,50 @@ fn main() {
613613 ) ;
614614}
615615
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+
616660#[ test]
617661fn syscalls ( ) {
618662 check_pass (
Original file line number Diff line number Diff line change @@ -486,13 +486,10 @@ impl<'ctx> MirLowerCtx<'ctx> {
486486 ) ;
487487 Ok ( Some ( current) )
488488 }
489- ValueNs :: FunctionId ( _) | ValueNs :: StructId ( _) => {
489+ ValueNs :: FunctionId ( _) | ValueNs :: StructId ( _) | ValueNs :: ImplSelf ( _ ) => {
490490 // It's probably a unit struct or a zero sized function, so no action is needed.
491491 Ok ( Some ( current) )
492492 }
493- it => {
494- not_supported ! ( "unknown name {it:?} in value name space" ) ;
495- }
496493 }
497494 }
498495 Expr :: If { condition, then_branch, else_branch } => {
You can’t perform that action at this time.
0 commit comments