about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-02-12 04:51:21 +0000
committerMichael Goulet <michael@errs.io>2024-02-12 04:51:49 +0000
commitfc7693d63b2f3736b7d847c8c3d9c7219c4bea4a (patch)
tree68f6c05ccd593676620fb25cb4de2c90307f4a44
parent084ce5bdb5f7dc1c725f6770a8de281165ba3b0a (diff)
downloadrust-fc7693d63b2f3736b7d847c8c3d9c7219c4bea4a.tar.gz
rust-fc7693d63b2f3736b7d847c8c3d9c7219c4bea4a.zip
Clean inlined type alias with correct param-env
-rw-r--r--src/librustdoc/clean/mod.rs4
-rw-r--r--tests/rustdoc-ui/normalize-in-inlined-type-alias.rs14
2 files changed, 17 insertions, 1 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 89977934cde..abd0b3562d2 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -1840,7 +1840,9 @@ fn maybe_expand_private_type_alias<'tcx>(
         }
     }
 
-    Some(cx.enter_alias(args, def_id.to_def_id(), |cx| clean_ty(&ty, cx)))
+    Some(cx.enter_alias(args, def_id.to_def_id(), |cx| {
+        cx.with_param_env(def_id.to_def_id(), |cx| clean_ty(&ty, cx))
+    }))
 }
 
 pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type {
diff --git a/tests/rustdoc-ui/normalize-in-inlined-type-alias.rs b/tests/rustdoc-ui/normalize-in-inlined-type-alias.rs
new file mode 100644
index 00000000000..45e04a70c09
--- /dev/null
+++ b/tests/rustdoc-ui/normalize-in-inlined-type-alias.rs
@@ -0,0 +1,14 @@
+// check-pass
+// compile-flags: -Znormalize-docs
+
+trait Woo<T> {
+    type Assoc;
+}
+
+impl<T> Woo<T> for () {
+    type Assoc = ();
+}
+
+type Alias<P> = <() as Woo<P>>::Assoc;
+
+pub fn hello<S>() -> Alias<S> {}