Skip to content

Commit 9692d98

Browse files
authored
Rollup merge of rust-lang#103006 - WaffleLapkin:rustdoc_dont, r=compiler-errors
rustdoc: don't ICE on `TyKind::Typeof` Fixes rust-lang#102986 I'm not sure why rustdoc started seeing `TyKind::Typeof` all of a sudden (the code being editted was last touched 3 months ago), probably something to do with error recovery? idk.
2 parents c7f048e + 577d2cf commit 9692d98

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/librustdoc/clean/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1543,8 +1543,7 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
15431543
}
15441544
TyKind::BareFn(barefn) => BareFunction(Box::new(clean_bare_fn_ty(barefn, cx))),
15451545
// Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
1546-
TyKind::Infer | TyKind::Err => Infer,
1547-
TyKind::Typeof(..) => panic!("unimplemented type {:?}", ty.kind),
1546+
TyKind::Infer | TyKind::Err | TyKind::Typeof(..) => Infer,
15481547
}
15491548
}
15501549

src/test/rustdoc-ui/issue-102986.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
struct Struct {
2+
y: (typeof("hey"),),
3+
//~^ `typeof` is a reserved keyword but unimplemented
4+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0516]: `typeof` is a reserved keyword but unimplemented
2+
--> $DIR/issue-102986.rs:2:9
3+
|
4+
LL | y: (typeof("hey"),),
5+
| ^^^^^^^^^^^^^ reserved keyword
6+
|
7+
help: consider replacing `typeof(...)` with an actual type
8+
|
9+
LL | y: (&'static str,),
10+
| ~~~~~~~~~~~~
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0516`.

0 commit comments

Comments
 (0)