Auto merge of #42885 - ollie27:rustdoc_empty_glob_path, r=GuillaumeGomez

rustdoc: Don't ICE on `use *;`

Fixes #42875
This commit is contained in:
bors 2017-06-26 11:06:13 +00:00
commit 859c3236e5
2 changed files with 28 additions and 1 deletions

View file

@ -1019,10 +1019,14 @@ impl fmt::Display for clean::Import {
}
}
clean::Import::Glob(ref src) => {
if src.path.segments.is_empty() {
write!(f, "use *;")
} else {
write!(f, "use {}::*;", *src)
}
}
}
}
}
impl fmt::Display for clean::ImportSource {

View file

@ -0,0 +1,23 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: --no-defaults
#![crate_name = "foo"]
// @has foo/a/index.html '//code' 'use *;'
mod a {
use *;
}
// @has foo/b/index.html '//code' 'pub use *;'
pub mod b {
pub use *;
}