Skip to content

Commit

Permalink
Rollup merge of rust-lang#106024 - JulianKnodt:add_term_html_docs, r=…
Browse files Browse the repository at this point in the history
…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 rust-lang#105952.

Should I add some annotations to the rustdoc test?
  • Loading branch information
matthiaskrgr committed Dec 22, 2022
2 parents d5983c5 + 8a4cbf4 commit c27553f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1655,10 +1655,10 @@ impl clean::types::Term {
&'a self,
cx: &'a Context<'tcx>,
) -> impl fmt::Display + 'a + Captures<'tcx> {
match self {
clean::types::Term::Type(ty) => ty.print(cx),
_ => todo!(),
}
display_fn(move |f| match self {
clean::types::Term::Type(ty) => fmt::Display::fmt(&ty.print(cx), f),
clean::types::Term::Constant(ct) => fmt::Display::fmt(&ct.print(cx.tcx()), f),
})
}
}

Expand Down
14 changes: 14 additions & 0 deletions src/test/rustdoc/issue-105952.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![crate_name = "foo"]

#![feature(associated_const_equality)]
pub enum ParseMode {
Raw,
}
pub trait Parse {
const PARSE_MODE: ParseMode;
}
pub trait RenderRaw {}

// @hasraw foo/trait.RenderRaw.html 'impl'
// @hasraw foo/trait.RenderRaw.html 'ParseMode::Raw'
impl<T: Parse<PARSE_MODE = { ParseMode::Raw }>> RenderRaw for T {}

0 comments on commit c27553f

Please sign in to comment.