Skip to content

Commit

Permalink
Rollup merge of #106366 - GuillaumeGomez:fix-rustdoc-ice-typedef-type…
Browse files Browse the repository at this point in the history
…-mismatch, r=notriddle

Fix rustdoc ICE on bad typedef with mismatching types

Fixes #106226.
Fixes #105742.
Fixes #105737.
Fixes #105334.
Fixes #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`
  • Loading branch information
compiler-errors authored Jan 2, 2023
2 parents 0d5c5fa + c156773 commit ea3c4d8
Show file tree
Hide file tree
Showing 11 changed files with 497 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
ty::Placeholder(..) => panic!("Placeholder"),
ty::GeneratorWitness(..) => panic!("GeneratorWitness"),
ty::Infer(..) => panic!("Infer"),
ty::Error(_) => panic!("Error"),
ty::Error(_) => rustc_errors::FatalError.raise(),
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/test/rustdoc-ui/issue-105334.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
impl Vec< br##"*.."## > {}
//~^ ERROR
9 changes: 9 additions & 0 deletions src/test/rustdoc-ui/issue-105334.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0747]: constant provided when a type was expected
--> $DIR/issue-105334.rs:1:11
|
LL | impl Vec< br##"*.."## > {}
| ^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0747`.
4 changes: 4 additions & 0 deletions src/test/rustdoc-ui/issue-105737.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
impl Vec<lol> {}
//~^ ERROR

pub fn lol() {}
12 changes: 12 additions & 0 deletions src/test/rustdoc-ui/issue-105737.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0747]: constant provided when a type was expected
--> $DIR/issue-105737.rs:1:10
|
LL | impl Vec<lol> {}
| ^^^
|
= help: `lol` is a function item, not a type
= help: function item types cannot be named directly

error: aborting due to previous error

For more information about this error, try `rustc --explain E0747`.
40 changes: 40 additions & 0 deletions src/test/rustdoc-ui/issue-105742.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// compile-flags: -Znormalize-docs

use std::ops::Index;

pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
//~^ ERROR
//~^^ ERROR
//~^^^ ERROR
let _ = s;
}

pub trait SVec: Index<
<Self as SVec>::Item,
//~^ ERROR
//~^^ ERROR
//~^^^ ERROR
//~^^^^ ERROR
Output = <Index<<Self as SVec>::Item,
//~^ ERROR
//~^^ ERROR
//~^^^ ERROR
//~^^^^ ERROR
Output = <Self as SVec>::Item> as SVec>::Item,
//~^ ERROR
//~^^ ERROR
//~^^^ ERROR
//~^^^^ ERROR
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
> {
type Item<'a, T>;

fn len(&self) -> <Self as SVec>::Item;
//~^ ERROR
//~^^ ERROR
//~^^^ ERROR
//~^^^^ ERROR
}
Loading

0 comments on commit ea3c4d8

Please sign in to comment.