Skip to content

Commit d2130e4

Browse files
authored
Rollup merge of #106024 - JulianKnodt:add_term_html_docs, r=notriddle
Fix ICE due to `todo!()` in `rustdoc` for `Term`s Left a todo awhile ago (I think), so fill it in to print a const for `Term`s. Fixes #105952. Should I add some annotations to the rustdoc test?
2 parents 793df7f + 8a4cbf4 commit d2130e4

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/librustdoc/html/format.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1655,10 +1655,10 @@ impl clean::types::Term {
16551655
&'a self,
16561656
cx: &'a Context<'tcx>,
16571657
) -> impl fmt::Display + 'a + Captures<'tcx> {
1658-
match self {
1659-
clean::types::Term::Type(ty) => ty.print(cx),
1660-
_ => todo!(),
1661-
}
1658+
display_fn(move |f| match self {
1659+
clean::types::Term::Type(ty) => fmt::Display::fmt(&ty.print(cx), f),
1660+
clean::types::Term::Constant(ct) => fmt::Display::fmt(&ct.print(cx.tcx()), f),
1661+
})
16621662
}
16631663
}
16641664

src/test/rustdoc/issue-105952.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_name = "foo"]
2+
3+
#![feature(associated_const_equality)]
4+
pub enum ParseMode {
5+
Raw,
6+
}
7+
pub trait Parse {
8+
const PARSE_MODE: ParseMode;
9+
}
10+
pub trait RenderRaw {}
11+
12+
// @hasraw foo/trait.RenderRaw.html 'impl'
13+
// @hasraw foo/trait.RenderRaw.html 'ParseMode::Raw'
14+
impl<T: Parse<PARSE_MODE = { ParseMode::Raw }>> RenderRaw for T {}

0 commit comments

Comments
 (0)