Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/copyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Get paths for files added
id: git-diff
run: |
ignore='(.md|.props|expected|ignore|gitignore)$'
ignore='(.diff|.md|.props|expected|ignore|gitignore)$'
files=$(git diff --ignore-submodules=all --name-only --diff-filter=A ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -v -E $ignore | xargs)
echo "::set-output name=paths::$files"

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ version = "0.1.0"
dependencies = [
"Inflector",
"pulldown-cmark 0.8.0",
"rustdoc",
"walkdir",
]

Expand Down
21 changes: 15 additions & 6 deletions src/bootstrap/run.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
use crate::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::dist::distdir;
use crate::tool::Tool;
use crate::{compile, tool, Compiler};
use build_helper::output;
use std::process::Command;

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Dashboard;
pub struct Dashboard {
pub compiler: Compiler,
}

impl Step for Dashboard {
type Output = ();
Expand All @@ -15,19 +18,25 @@ impl Step for Dashboard {
/// This tool in `src/tools` extracts examples from books, runs them through
/// RMC, and displays their results.
fn run(self, builder: &Builder<'_>) {
// Before running the dashboard, we need to ensure that it is already
// built.
let dashboard = builder.ensure(tool::Dashboard { compiler: self.compiler });
// We also need to ensure that stage n standard library is built for
// rmc-rustc.
builder.ensure(compile::Std { compiler: self.compiler, target: self.compiler.host });
let target = builder.config.build.triple;
builder.info("Generating confidence dashboard");
try_run(
builder,
&mut builder.tool_cmd(Tool::Dashboard).env("TRIPLE", builder.config.build.triple),
);
try_run(builder, Command::new(dashboard).env("TRIPLE", target));
}

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/dashboard")
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Dashboard);
run.builder.ensure(Dashboard {
compiler: run.builder.compiler(run.builder.top_stage, run.target),
});
}
}

Expand Down
58 changes: 57 additions & 1 deletion src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ bootstrap_tool!(
Linkchecker, "src/tools/linkchecker", "linkchecker";
CargoTest, "src/tools/cargotest", "cargotest";
Compiletest, "src/tools/compiletest", "compiletest", is_unstable_tool = true;
Dashboard, "src/tools/dashboard", "dashboard";
BuildManifest, "src/tools/build-manifest", "build-manifest";
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client";
RustInstaller, "src/tools/rust-installer", "fabricate", is_external_tool = true;
Expand Down Expand Up @@ -585,6 +584,63 @@ impl Step for Rustdoc {
}
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
pub struct Dashboard {
pub compiler: Compiler,
}

impl Step for Dashboard {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/dashboard")
}

fn make_run(run: RunConfig<'_>) {
// Use the same compiler used to compile rustdoc.
run.builder.ensure(Dashboard {
compiler: run.builder.compiler(run.builder.top_stage, run.target),
});
}

fn run(self, builder: &Builder<'_>) -> PathBuf {
// Since the dashboard depends on rustdoc, we follow the same steps used
// above to compile rustdoc.
let target_compiler = self.compiler;
let target = target_compiler.host;
let build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build);
builder.ensure(compile::Std { compiler: build_compiler, target: target_compiler.host });
builder.ensure(compile::Rustc { compiler: build_compiler, target: target_compiler.host });
let cargo = prepare_tool_cargo(
builder,
build_compiler,
Mode::ToolRustc,
target,
"build",
"src/tools/dashboard",
SourceType::InTree,
&Vec::new(),
);
builder.info(&format!(
"Building dashboard for stage{} ({})",
target_compiler.stage, target_compiler.host
));
builder.run(&mut cargo.into());
let tool_dashboard = builder
.cargo_out(build_compiler, Mode::ToolRustc, target)
.join(exe("dashboard", target_compiler.host));
let sysroot = builder.sysroot(target_compiler);
let bindir = sysroot.join("bin");
t!(fs::create_dir_all(&bindir));
let bin_dashboard = bindir.join(exe("dashboard", target_compiler.host));
let _ = fs::remove_file(&bin_dashboard);
builder.copy(&tool_dashboard, &bin_dashboard);
bin_dashboard
}
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Cargo {
pub compiler: Compiler,
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::lint::init_lints;
use crate::passes::span_of_attrs;

#[derive(Clone, Default)]
crate struct TestOptions {
pub struct TestOptions {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my only concern is the potential for future conflicts from stuff like this, but if it's fine with your Adrian, then it's fine with me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, opened #461 to keep track of this. @bdalrhm had linking issues when not doing this and we agreed to change it in order to have the PR online.

/// Whether to disable the default `extern crate my_crate;` when creating doctests.
crate no_crate_inject: bool,
/// Whether to emit compilation warnings when compiling doctests. Setting this will suppress
Expand Down Expand Up @@ -493,7 +493,7 @@ fn run_test(

/// Transforms a test into code that can be compiled into a Rust binary, and returns the number of
/// lines before the test code begins as well as if the output stream supports colors or not.
crate fn make_test(
pub fn make_test(
s: &str,
crate_name: Option<&str>,
dont_insert_main: bool,
Expand Down Expand Up @@ -777,7 +777,7 @@ fn partition_source(s: &str) -> (String, String, String) {
(before, after, crates)
}

crate trait Tester {
pub trait Tester {
fn add_test(&mut self, test: String, config: LangString, line: usize);
fn get_line(&self) -> usize {
0
Expand Down
16 changes: 8 additions & 8 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ impl<'a, I: Iterator<Item = SpannedEvent<'a>>> Iterator for Footnotes<'a, I> {
}
}

crate fn find_testable_code<T: doctest::Tester>(
pub fn find_testable_code<T: doctest::Tester>(
doc: &str,
tests: &mut T,
error_codes: ErrorCodes,
Expand Down Expand Up @@ -711,7 +711,7 @@ crate fn find_testable_code<T: doctest::Tester>(
}
}

crate struct ExtraInfo<'tcx> {
pub struct ExtraInfo<'tcx> {
id: ExtraInfoId,
sp: Span,
tcx: TyCtxt<'tcx>,
Expand Down Expand Up @@ -758,21 +758,21 @@ impl<'tcx> ExtraInfo<'tcx> {
}

#[derive(Eq, PartialEq, Clone, Debug)]
crate struct LangString {
pub struct LangString {
original: String,
crate should_panic: bool,
pub should_panic: bool,
crate no_run: bool,
crate ignore: Ignore,
pub ignore: Ignore,
crate rust: bool,
crate test_harness: bool,
crate compile_fail: bool,
pub compile_fail: bool,
crate error_codes: Vec<String>,
crate allow_fail: bool,
crate edition: Option<Edition>,
pub edition: Option<Edition>,
}

#[derive(Eq, PartialEq, Clone, Debug)]
crate enum Ignore {
pub enum Ignore {
All,
None,
Some(Vec<String>),
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ mod docfs;
mod doctree;
#[macro_use]
mod error;
mod doctest;
pub mod doctest;
mod fold;
mod formats;
// used by the error-index generator, so it needs to be public
Expand Down
1 change: 1 addition & 0 deletions src/tools/dashboard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ edition = "2018"
[dependencies]
Inflector = "0.11.4"
pulldown-cmark = { version = "0.8.0", default-features = false }
rustdoc = { path = "../../librustdoc" }
walkdir = "2.3.2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- 1
+ 1 let ok_num = Ok::<_, ()>(5);
+ 2 assert!(!ok_num.is_err());
+ 4 assert!([2, 4, 6][..] == vec[..]);
Loading