rustdoc: Fix re-exporting primitive types

* Generate links to the primitive type docs for re-exports.
* Don't ICE on cross crate primitive type re-exports.
* Make primitive type re-exports show up cross crate.
This commit is contained in:
Oliver Middleton 2020-01-26 21:28:09 +00:00
parent 80a65bcaf2
commit bbc2ae7590
6 changed files with 91 additions and 17 deletions

View file

@ -0,0 +1,8 @@
// compile-flags: --emit metadata --crate-type lib --edition 2018
#![crate_name = "foo"]
pub mod bar {
pub use bool;
pub use char as my_char;
}

View file

@ -0,0 +1,28 @@
// aux-build: primitive-reexport.rs
// compile-flags:--extern foo --edition 2018
#![crate_name = "bar"]
// @has bar/p/index.html
// @has - '//code' 'pub use bool;'
// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.bool.html"]' 'bool'
// @has - '//code' 'pub use char as my_char;'
// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char'
pub mod p {
pub use foo::bar::*;
}
// @has bar/baz/index.html
// @has - '//code' 'pub use bool;'
// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.bool.html"]' 'bool'
// @has - '//code' 'pub use char as my_char;'
// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char'
pub use foo::bar as baz;
// @has bar/index.html
// @has - '//code' 'pub use str;'
// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html"]' 'str'
// @has - '//code' 'pub use i32 as my_i32;'
// @has - '//code/a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html"]' 'i32'
pub use str;
pub use i32 as my_i32;