Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
81f3ab6b
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
81f3ab6b
编写于
6月 29, 2021
作者:
J
Joshua Nelson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use a macro for documenting rustdoc
上级
0ce21126
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
75 addition
and
67 deletion
+75
-67
src/bootstrap/builder.rs
src/bootstrap/builder.rs
+1
-0
src/bootstrap/doc.rs
src/bootstrap/doc.rs
+74
-67
未找到文件。
src/bootstrap/builder.rs
浏览文件 @
81f3ab6b
...
...
@@ -465,6 +465,7 @@ fn get_step_descriptions(kind: Kind) -> Vec<StepDescription> {
doc
::
Std
,
doc
::
Rustc
,
doc
::
Rustdoc
,
// doc::Rustfmt,
doc
::
ErrorIndex
,
doc
::
Nomicon
,
doc
::
Reference
,
...
...
src/bootstrap/doc.rs
浏览文件 @
81f3ab6b
...
...
@@ -593,23 +593,25 @@ fn run(self, builder: &Builder<'_>) {
}
}
#[derive(Debug,
Copy,
Clone,
Hash,
PartialEq,
Eq)]
pub
struct
Rustdoc
{
macro_rules!
tool_doc
{
(
$tool
:
ident
,
$should_run
:
literal
,
$path
:
literal
,
[
$
(
$krate
:
literal
),
+
$
(,)
?
])
=>
{
#[derive(Debug,
Copy,
Clone,
Hash,
PartialEq,
Eq)]
pub
struct
$tool
{
stage
:
u32
,
target
:
TargetSelection
,
}
}
impl
Step
for
Rustdoc
{
impl
Step
for
$tool
{
type
Output
=
();
const
DEFAULT
:
bool
=
true
;
const
ONLY_HOSTS
:
bool
=
true
;
fn
should_run
(
run
:
ShouldRun
<
'_
>
)
->
ShouldRun
<
'_
>
{
run
.krate
(
"rustdoc-tool"
)
run
.krate
(
$should_run
)
}
fn
make_run
(
run
:
RunConfig
<
'_
>
)
{
run
.builder
.ensure
(
Rustdoc
{
stage
:
run
.builder.top_stage
,
target
:
run
.target
});
run
.builder
.ensure
(
$tool
{
stage
:
run
.builder.top_stage
,
target
:
run
.target
});
}
/// Generates compiler documentation.
...
...
@@ -621,7 +623,7 @@ fn make_run(run: RunConfig<'_>) {
fn
run
(
self
,
builder
:
&
Builder
<
'_
>
)
{
let
stage
=
self
.stage
;
let
target
=
self
.target
;
builder
.info
(
&
format!
(
"Documenting stage{} rustdoc ({})"
,
stage
,
target
));
builder
.info
(
&
format!
(
"Documenting stage{} {} ({})"
,
stage
,
stringify!
(
$tool
)
.to_lowercase
()
,
target
));
// This is the intended out directory for compiler documentation.
let
out
=
builder
.compiler_doc_out
(
target
);
...
...
@@ -630,15 +632,15 @@ fn run(self, builder: &Builder<'_>) {
let
compiler
=
builder
.compiler
(
stage
,
builder
.config.build
);
if
!
builder
.config.compiler_docs
{
builder
.info
(
"
\t
skipping - compiler/librustdoc
docs disabled"
);
builder
.info
(
"
\t
skipping - compiler/tool
docs disabled"
);
return
;
}
// Build rustc docs so that we generate relative links.
builder
.ensure
(
Rustc
{
stage
,
target
});
// Build rustdoc
.
builder
.ensure
(
tool
::
Rustdoc
{
compiler
});
// Build the tool
.
builder
.ensure
(
tool
::
$tool
{
compiler
});
// Symlink compiler docs to the output directory of rustdoc documentation.
let
out_dir
=
builder
.stage_out
(
compiler
,
Mode
::
ToolRustc
)
.join
(
target
.triple
)
.join
(
"doc"
);
...
...
@@ -652,7 +654,7 @@ fn run(self, builder: &Builder<'_>) {
Mode
::
ToolRustc
,
target
,
"doc"
,
"src/tools/rustdoc"
,
$path
,
SourceType
::
InTree
,
&
[],
);
...
...
@@ -660,8 +662,9 @@ fn run(self, builder: &Builder<'_>) {
cargo
.arg
(
"-Zskip-rustdoc-fingerprint"
);
// Only include compiler crates, no dependencies of those, such as `libc`.
cargo
.arg
(
"--no-deps"
);
cargo
.arg
(
"-p"
)
.arg
(
"rustdoc"
);
cargo
.arg
(
"-p"
)
.arg
(
"rustdoc-json-types"
);
$
(
cargo
.arg
(
"-p"
)
.arg
(
$krate
);
)
+
cargo
.rustdocflag
(
"--document-private-items"
);
cargo
.rustdocflag
(
"--enable-index-page"
);
...
...
@@ -669,8 +672,12 @@ fn run(self, builder: &Builder<'_>) {
cargo
.rustdocflag
(
"-Zunstable-options"
);
builder
.run
(
&
mut
cargo
.into
());
}
}
}
}
tool_doc!
(
Rustdoc
,
"rustdoc-tool"
,
"src/tools/rustdoc"
,
[
"rustdoc"
,
"rustdoc-json-types"
]);
#[derive(Ord,
PartialOrd,
Debug,
Copy,
Clone,
Hash,
PartialEq,
Eq)]
pub
struct
ErrorIndex
{
pub
target
:
TargetSelection
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录