Skip to content

Commit ea3c4d8

Browse files
Rollup merge of rust-lang#106366 - GuillaumeGomez:fix-rustdoc-ice-typedef-type-mismatch, r=notriddle
Fix rustdoc ICE on bad typedef with mismatching types Fixes rust-lang#106226. Fixes rust-lang#105742. Fixes rust-lang#105737. Fixes rust-lang#105334. Fixes rust-lang#96287. In this case, it's ok to replace the panic with `rustc_error::raise` because the compiler provided us with a `Error`. r? `@notriddle`
2 parents 0d5c5fa + c156773 commit ea3c4d8

11 files changed

+497
-1
lines changed

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
18531853
ty::Placeholder(..) => panic!("Placeholder"),
18541854
ty::GeneratorWitness(..) => panic!("GeneratorWitness"),
18551855
ty::Infer(..) => panic!("Infer"),
1856-
ty::Error(_) => panic!("Error"),
1856+
ty::Error(_) => rustc_errors::FatalError.raise(),
18571857
}
18581858
}
18591859

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

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
impl Vec< br##"*.."## > {}
2+
//~^ ERROR
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0747]: constant provided when a type was expected
2+
--> $DIR/issue-105334.rs:1:11
3+
|
4+
LL | impl Vec< br##"*.."## > {}
5+
| ^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0747`.

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

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
impl Vec<lol> {}
2+
//~^ ERROR
3+
4+
pub fn lol() {}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0747]: constant provided when a type was expected
2+
--> $DIR/issue-105737.rs:1:10
3+
|
4+
LL | impl Vec<lol> {}
5+
| ^^^
6+
|
7+
= help: `lol` is a function item, not a type
8+
= help: function item types cannot be named directly
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0747`.

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

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// compile-flags: -Znormalize-docs
2+
3+
use std::ops::Index;
4+
5+
pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
6+
//~^ ERROR
7+
//~^^ ERROR
8+
//~^^^ ERROR
9+
let _ = s;
10+
}
11+
12+
pub trait SVec: Index<
13+
<Self as SVec>::Item,
14+
//~^ ERROR
15+
//~^^ ERROR
16+
//~^^^ ERROR
17+
//~^^^^ ERROR
18+
Output = <Index<<Self as SVec>::Item,
19+
//~^ ERROR
20+
//~^^ ERROR
21+
//~^^^ ERROR
22+
//~^^^^ ERROR
23+
Output = <Self as SVec>::Item> as SVec>::Item,
24+
//~^ ERROR
25+
//~^^ ERROR
26+
//~^^^ ERROR
27+
//~^^^^ ERROR
28+
//~^^^^^ ERROR
29+
//~^^^^^^ ERROR
30+
//~^^^^^^^ ERROR
31+
//~^^^^^^^^ ERROR
32+
> {
33+
type Item<'a, T>;
34+
35+
fn len(&self) -> <Self as SVec>::Item;
36+
//~^ ERROR
37+
//~^^ ERROR
38+
//~^^^ ERROR
39+
//~^^^^ ERROR
40+
}

0 commit comments

Comments
 (0)