File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -778,8 +778,20 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
778778 }
779779 // The interface is empty.
780780 hir:: ItemKind :: GlobalAsm ( ..) => { }
781- // assume the type is never reachable - since it's opaque, no one can use it from this interface
782- hir:: ItemKind :: OpaqueTy ( ..) => { }
781+ hir:: ItemKind :: OpaqueTy ( ..) => {
782+ // HACK(jynelson): trying to infer the type of `impl trait` breaks `async-std` (and `pub async fn` in general)
783+ // Since rustdoc never need to do codegen and doesn't care about link-time reachability,
784+ // mark this as unreachable.
785+ // See https://github.com/rust-lang/rust/issues/75100
786+ if !self . tcx . sess . opts . actually_rustdoc {
787+ // FIXME: This is some serious pessimization intended to workaround deficiencies
788+ // in the reachability pass (`middle/reachable.rs`). Types are marked as link-time
789+ // reachable if they are returned via `impl Trait`, even from private functions.
790+ let exist_level = cmp:: max ( item_level, Some ( AccessLevel :: ReachableFromImplTrait ) ) ;
791+ self . reach ( item. hir_id , exist_level) . generics ( ) . predicates ( ) . ty ( ) ;
792+
793+ }
794+ }
783795 // Visit everything.
784796 hir:: ItemKind :: Const ( ..)
785797 | hir:: ItemKind :: Static ( ..)
You can’t perform that action at this time.
0 commit comments