Skip to content

Commit 1cf684c

Browse files
committed
rustdoc: Render new self syntax in use
Fix #21442
1 parent d77f6d5 commit 1cf684c

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,7 @@ impl Clean<ViewListIdent> for ast::PathListItem {
22442244
source: resolve_def(cx, id)
22452245
},
22462246
ast::PathListMod { id } => ViewListIdent {
2247-
name: "mod".to_string(),
2247+
name: "self".to_string(),
22482248
source: resolve_def(cx, id)
22492249
}
22502250
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-include ../tools.mk
2+
3+
all: foo.rs
4+
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
5+
$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
6+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub mod io {
12+
pub trait Reader { }
13+
}
14+
15+
pub enum Maybe<A> {
16+
Just(A),
17+
Nothing
18+
}
19+
20+
// @has foo/prelude/index.html
21+
pub mod prelude {
22+
// @has foo/prelude/index.html '//code' 'pub use io::{self, Reader}'
23+
#[doc(no_inline)] pub use io::{self, Reader};
24+
// @has foo/prelude/index.html '//code' 'pub use Maybe::{self, Just, Nothing}'
25+
#[doc(no_inline)] pub use Maybe::{self, Just, Nothing};
26+
}

0 commit comments

Comments
 (0)