This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed
compiler/rustc_passes/src
src/test/ui/stability-attribute Expand file tree Collapse file tree 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> {
888888 }
889889
890890 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) ,
897910 }
898- _ => intravisit:: walk_ty ( self , t) ,
899911 }
900912 }
901913}
Original file line number Diff line number Diff line change @@ -37,4 +37,7 @@ impl StableTrait for StableType {}
3737//~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl]
3838impl StableTrait for fn ( ) -> ! { }
3939
40+ #[ unstable( feature = "l" , issue = "none" ) ]
41+ impl StableTrait for fn ( ) -> UnstableType { }
42+
4043fn main ( ) { }
You can’t perform that action at this time.
0 commit comments