File tree 2 files changed +22
-7
lines changed
compiler/rustc_passes/src
src/test/ui/stability-attribute
2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -888,14 +888,26 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
888
888
}
889
889
890
890
fn visit_ty ( & mut self , t : & ' tcx Ty < ' tcx > ) {
891
- match t. kind {
892
- TyKind :: Never => self . fully_stable = false ,
893
- TyKind :: BareFn ( f) => {
894
- if rustc_target:: spec:: abi:: is_stable ( f. abi . name ( ) ) . is_err ( ) {
895
- self . fully_stable = false ;
896
- }
891
+ if let TyKind :: Never = t. kind {
892
+ self . fully_stable = false ;
893
+ }
894
+ if let TyKind :: BareFn ( f) = t. kind {
895
+ if rustc_target:: spec:: abi:: is_stable ( f. abi . name ( ) ) . is_err ( ) {
896
+ self . fully_stable = false ;
897
+ }
898
+ }
899
+ intravisit:: walk_ty ( self , t)
900
+ }
901
+
902
+ fn visit_fn_decl ( & mut self , fd : & ' tcx hir:: FnDecl < ' tcx > ) {
903
+ for ty in fd. inputs {
904
+ self . visit_ty ( ty)
905
+ }
906
+ if let hir:: FnRetTy :: Return ( output_ty) = fd. output {
907
+ match output_ty. kind {
908
+ TyKind :: Never => { } // `-> !` is stable
909
+ _ => self . visit_ty ( output_ty) ,
897
910
}
898
- _ => intravisit:: walk_ty ( self , t) ,
899
911
}
900
912
}
901
913
}
Original file line number Diff line number Diff line change @@ -37,4 +37,7 @@ impl StableTrait for StableType {}
37
37
//~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl]
38
38
impl StableTrait for fn ( ) -> ! { }
39
39
40
+ #[ unstable( feature = "l" , issue = "none" ) ]
41
+ impl StableTrait for fn ( ) -> UnstableType { }
42
+
40
43
fn main ( ) { }
You can’t perform that action at this time.
0 commit comments