Skip to content

Rollup of 8 pull requests #104983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Nov 27, 2022
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
68d9530
notify lcnr on changes to `ObligationCtxt`
lcnr Nov 25, 2022
1dc88ff
Allow non-org members to label `requires-debug-assertions`
compiler-errors Nov 26, 2022
c256bd2
Remove redundant `all` in cfg
ChrisDenton Nov 26, 2022
2ab3f76
Remove more redundant `all`s
ChrisDenton Nov 26, 2022
e06b61c
explain how to get the discriminant out of a `#[repr(T)] enum`
Nov 25, 2022
4b2a1eb
Support unit tests for jsondoclint
aDotInTheVoid Nov 26, 2022
946d51e
fix broken link fragment
Nov 26, 2022
09818a8
Add a test that makes sense
aDotInTheVoid Nov 26, 2022
74de78a
rustdoc: improve popover focus handling JS
notriddle Nov 26, 2022
c96d888
Pretty-print generators with their `generator_kind`
Swatinem Nov 25, 2022
c26074a
rustdoc: pass "true" to reset focus for notable traits
notriddle Nov 26, 2022
353cef9
Use target exe_suffix for doctests
workingjubilee Apr 9, 2022
47ddca6
Attempt to solve problem with globs
workingjubilee Nov 27, 2022
7ce937f
Rollup merge of #95836 - workingjubilee:doctest-exe, r=notriddle
matthiaskrgr Nov 27, 2022
5d05cf8
Rollup merge of #104882 - lcnr:notify-ocx, r=Mark-Simulacrum
matthiaskrgr Nov 27, 2022
9ba78ac
Rollup merge of #104892 - lukas-code:discriminant, r=scottmcm
matthiaskrgr Nov 27, 2022
9ebffb7
Rollup merge of #104917 - compiler-errors:requires-debug-assertions, …
matthiaskrgr Nov 27, 2022
6e6c42c
Rollup merge of #104931 - Swatinem:async-pretty, r=eholk
matthiaskrgr Nov 27, 2022
8d90647
Rollup merge of #104934 - ChrisDenton:all-anybody-wants, r=thomcc
matthiaskrgr Nov 27, 2022
e3165a3
Rollup merge of #104944 - aDotInTheVoid:jsondoclint-unit-tests, r=jyn514
matthiaskrgr Nov 27, 2022
55cf566
Rollup merge of #104946 - notriddle:notriddle/popover-menu-focus, r=G…
matthiaskrgr Nov 27, 2022
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
Prev Previous commit
Next Next commit
Use target exe_suffix for doctests
This will use rust_out.exe for doctests on Windows,
rust_out.wasm for doctests in the wasm case, and
also handles cross-compiling or user-provided targets.
  • Loading branch information
workingjubilee committed Nov 27, 2022
commit 353cef9654444799ed03576acbcc3af26f9899fd
16 changes: 14 additions & 2 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc_span::edition::Edition;
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::sym;
use rustc_span::{BytePos, FileName, Pos, Span, DUMMY_SP};
use rustc_target::spec::TargetTriple;
use rustc_target::spec::{Target, TargetTriple};
use tempfile::Builder as TempFileBuilder;

use std::env;
Expand Down Expand Up @@ -293,6 +293,16 @@ struct UnusedExterns {
unused_extern_names: Vec<String>,
}

fn add_exe_suffix(input: String, target: &TargetTriple) -> String {
let exe_suffix = match target {
TargetTriple::TargetTriple(_) => Target::expect_builtin(target).options.exe_suffix,
TargetTriple::TargetJson { contents, .. } => {
Target::from_json(contents.parse().unwrap()).unwrap().0.options.exe_suffix
}
};
input + &exe_suffix
}

fn run_test(
test: &str,
crate_name: &str,
Expand All @@ -313,7 +323,9 @@ fn run_test(
let (test, line_offset, supports_color) =
make_test(test, Some(crate_name), lang_string.test_harness, opts, edition, Some(test_id));

let output_file = outdir.path().join("rust_out");
// Make sure we emit well-formed executable names for our target.
let rust_out = add_exe_suffix("rust_out".to_owned(), &target);
let output_file = outdir.path().join(rust_out);

let rustc_binary = rustdoc_options
.test_builder
Expand Down