Skip to content
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

Rollup of 7 pull requests #63408

Merged
merged 24 commits into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8ae8bc2
Fix various issues with making items reachable through macros
matthewjasper Aug 5, 2019
7b41fd2
Make some items in core::unicode private
matthewjasper Aug 5, 2019
d9d9246
Remove gensym from format_args
matthewjasper Aug 5, 2019
642ee70
Add test for issue-43623
JohnTitor Aug 8, 2019
55f15d7
Add test for issue-44405
JohnTitor Aug 8, 2019
fd7ac6b
Deprecate `try!` macro
Jun 23, 2019
90fa790
Postpone deprecating try! until 1.39.0
tesuji Jul 15, 2019
6842316
Allow deprecated try macro in test crates
tesuji Jul 14, 2019
e9ee2cb
Improve test output for libcore/time
ohsayan Aug 9, 2019
623debf
Improve tests for libcore/slice
ohsayan Aug 9, 2019
33445ae
Improve tests for liballoc/btree/set
ohsayan Aug 9, 2019
fb3a013
Merge pull request #1 from rust-lang/master
ohsayan Aug 9, 2019
c5687e3
enable flt2dec tests in Miri
RalfJung Aug 9, 2019
c7e16c5
Check links on all platforms when running locally
mati865 Aug 6, 2019
29ca428
Miri is really slow
RalfJung Aug 9, 2019
73edef7
reduce some test sizes in Miri
RalfJung Aug 9, 2019
78caca0
explain Miri disabling
RalfJung Aug 9, 2019
03c524e
Rollup merge of #62672 - lzutao:deprecated-try-macro, r=Centril
Centril Aug 9, 2019
a038726
Rollup merge of #62950 - mati865:linkcheck, r=alexcrichton
Centril Aug 9, 2019
714c8ea
Rollup merge of #63114 - matthewjasper:hygienic-format-args, r=petroc…
Centril Aug 9, 2019
7a25162
Rollup merge of #63397 - JohnTitor:add-tests-for-ices, r=Centril
Centril Aug 9, 2019
171e845
Rollup merge of #63403 - sntdevco:master, r=Centril
Centril Aug 9, 2019
14ec32e
Rollup merge of #63404 - RalfJung:flt2dec, r=Centril
Centril Aug 9, 2019
4e3c209
Rollup merge of #63407 - RalfJung:miri-test-sizes, r=Centril
Centril Aug 9, 2019
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
26 changes: 23 additions & 3 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use build_helper::t;
use crate::Mode;
use crate::Compiler;
use crate::builder::{Step, RunConfig, ShouldRun, Builder};
use crate::util::{exe, add_lib_path};
use crate::util::{exe, add_lib_path, CiEnv};
use crate::compile;
use crate::channel::GitInfo;
use crate::channel;
Expand Down Expand Up @@ -279,11 +279,26 @@ pub fn prepare_tool_cargo(
cargo
}

fn rustbook_features() -> Vec<String> {
let mut features = Vec::new();

// Due to CI budged and risk of spurious failures we want to limit jobs running this check.
// At same time local builds should run it regardless of the platform.
// `CiEnv::None` means it's local build and `CHECK_LINKS` is defined in x86_64-gnu-tools to
// explicitly enable it on single job
if CiEnv::current() == CiEnv::None || env::var("CHECK_LINKS").is_ok() {
features.push("linkcheck".to_string());
}

features
}

macro_rules! bootstrap_tool {
($(
$name:ident, $path:expr, $tool_name:expr
$(,llvm_tools = $llvm:expr)*
$(,is_external_tool = $external:expr)*
$(,features = $features:expr)*
;
)+) => {
#[derive(Copy, PartialEq, Eq, Clone)]
Expand Down Expand Up @@ -350,7 +365,12 @@ macro_rules! bootstrap_tool {
} else {
SourceType::InTree
},
extra_features: Vec::new(),
extra_features: {
// FIXME(#60643): avoid this lint by using `_`
let mut _tmp = Vec::new();
$(_tmp.extend($features);)*
_tmp
},
}).expect("expected to build -- essential tool")
}
}
Expand All @@ -359,7 +379,7 @@ macro_rules! bootstrap_tool {
}

bootstrap_tool!(
Rustbook, "src/tools/rustbook", "rustbook";
Rustbook, "src/tools/rustbook", "rustbook", features = rustbook_features();
UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
Tidy, "src/tools/tidy", "tidy";
Linkchecker, "src/tools/linkchecker", "linkchecker";
Expand Down
3 changes: 3 additions & 0 deletions src/ci/docker/x86_64-gnu-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ COPY x86_64-gnu-tools/checkregression.py /tmp/
COPY x86_64-gnu-tools/checktools.sh /tmp/
COPY x86_64-gnu-tools/repo.sh /tmp/

# Run rustbook with `linkcheck` feature enabled
ENV CHECK_LINKS 1

ENV RUST_CONFIGURE_ARGS \
--build=x86_64-unknown-linux-gnu \
--save-toolstates=/tmp/toolstates.json
Expand Down
3 changes: 3 additions & 0 deletions src/liballoc/tests/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,10 @@ fn test_split_off_empty_left() {

#[test]
fn test_split_off_large_random_sorted() {
#[cfg(not(miri))] // Miri is too slow
let mut data = rand_data(1529);
#[cfg(miri)]
let mut data = rand_data(529);
// special case with maximum height.
data.sort();

Expand Down
28 changes: 26 additions & 2 deletions src/liballoc/tests/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn test_clone_eq() {
m.insert(1);
m.insert(2);

assert!(m.clone() == m);
assert_eq!(m.clone(), m);
}

#[test]
Expand All @@ -28,7 +28,7 @@ fn test_hash() {
y.insert(2);
y.insert(1);

assert!(hash(&x) == hash(&y));
assert_eq!(hash(&x), hash(&y));
}

fn check<F>(a: &[i32], b: &[i32], expected: &[i32], f: F)
Expand Down Expand Up @@ -69,6 +69,11 @@ fn test_intersection() {
check_intersection(&[11, 1, 3, 77, 103, 5, -5],
&[2, 11, 77, -9, -42, 5, 3],
&[3, 5, 11, 77]);

if cfg!(miri) { // Miri is too slow
return;
}

let large = (0..1000).collect::<Vec<_>>();
check_intersection(&[], &large, &[]);
check_intersection(&large, &[], &[]);
Expand Down Expand Up @@ -98,6 +103,11 @@ fn test_difference() {
check_difference(&[-5, 11, 22, 33, 40, 42],
&[-12, -5, 14, 23, 34, 38, 39, 50],
&[11, 22, 33, 40, 42]);

if cfg!(miri) { // Miri is too slow
return;
}

let large = (0..1000).collect::<Vec<_>>();
check_difference(&[], &large, &[]);
check_difference(&[-1], &large, &[-1]);
Expand Down Expand Up @@ -166,6 +176,17 @@ fn test_is_subset() {
assert_eq!(is_subset(&[1, 2], &[1]), false);
assert_eq!(is_subset(&[1, 2], &[1, 2]), true);
assert_eq!(is_subset(&[1, 2], &[2, 3]), false);
assert_eq!(is_subset(&[-5, 11, 22, 33, 40, 42],
&[-12, -5, 14, 23, 11, 34, 22, 38, 33, 42, 39, 40]),
true);
assert_eq!(is_subset(&[-5, 11, 22, 33, 40, 42],
&[-12, -5, 14, 23, 34, 38, 22, 11]),
false);

if cfg!(miri) { // Miri is too slow
return;
}

let large = (0..1000).collect::<Vec<_>>();
assert_eq!(is_subset(&[], &large), true);
assert_eq!(is_subset(&large, &[]), false);
Expand Down Expand Up @@ -371,7 +392,10 @@ fn test_split_off_empty_left() {

#[test]
fn test_split_off_large_random_sorted() {
#[cfg(not(miri))] // Miri is too slow
let mut data = rand_data(1529);
#[cfg(miri)]
let mut data = rand_data(529);
// special case with maximum height.
data.sort();

Expand Down
3 changes: 1 addition & 2 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ macro_rules! debug_assert_ne {
/// ```
#[macro_export]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.39.0", reason = "use the `?` operator instead")]
#[doc(alias = "?")]
macro_rules! r#try {
($expr:expr) => (match $expr {
Expand Down Expand Up @@ -767,7 +768,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")]
#[allow_internal_unstable(fmt_internals)]
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
pub macro format_args {
($fmt:expr) => ({ /* compiler built-in */ }),
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })
Expand All @@ -779,7 +779,6 @@ pub(crate) mod builtin {
language use and is subject to change")]
#[allow_internal_unstable(fmt_internals)]
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
pub macro format_args_nl {
($fmt:expr) => ({ /* compiler built-in */ }),
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })
Expand Down
1 change: 1 addition & 0 deletions src/libcore/tests/num/dec2flt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fn infinity() {
fn zero() {
test_literal!(0.0);
test_literal!(1e-325);
#[cfg(not(miri))] // Miri is too slow
test_literal!(1e-326);
#[cfg(not(miri))] // Miri is too slow
test_literal!(1e-500);
Expand Down
7 changes: 6 additions & 1 deletion src/libcore/tests/num/flt2dec/estimator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ fn test_estimate_scaling_factor() {
assert_almost_eq!(estimate_scaling_factor(1, -1074), -323);
assert_almost_eq!(estimate_scaling_factor(0x1fffffffffffff, 971), 309);

for i in -1074..972 {
#[cfg(not(miri))] // Miri is too slow
let iter = -1074..972;
#[cfg(miri)]
let iter = (-1074..972).step_by(37);

for i in iter {
let expected = super::ldexp_f64(1.0, i).log10().ceil();
assert_almost_eq!(estimate_scaling_factor(1, i as i16), expected as i16);
}
Expand Down
16 changes: 14 additions & 2 deletions src/libcore/tests/num/flt2dec/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg(not(miri))] // Miri does not implement ldexp, which most tests here need

use std::prelude::v1::*;
use std::{str, i16, f32, f64, fmt};

Expand Down Expand Up @@ -257,6 +255,7 @@ pub fn f32_shortest_sanity_test<F>(mut f: F) where F: FnMut(&Decoded, &mut [u8])
check_shortest!(f(minf32) => b"1", -44);
}

#[cfg(not(miri))] // Miri is too slow
pub fn f32_exact_sanity_test<F>(mut f: F)
where F: FnMut(&Decoded, &mut [u8], i16) -> (usize, i16) {
let minf32 = ldexp_f32(1.0, -149);
Expand Down Expand Up @@ -362,6 +361,7 @@ pub fn f64_shortest_sanity_test<F>(mut f: F) where F: FnMut(&Decoded, &mut [u8])
check_shortest!(f(minf64) => b"5", -323);
}

#[cfg(not(miri))] // Miri is too slow
pub fn f64_exact_sanity_test<F>(mut f: F)
where F: FnMut(&Decoded, &mut [u8], i16) -> (usize, i16) {
let minf64 = ldexp_f64(1.0, -1074);
Expand Down Expand Up @@ -553,6 +553,10 @@ pub fn to_shortest_str_test<F>(mut f_: F)
assert_eq!(to_string(f, minf64, Minus, 324, false), format!("0.{:0>323}5", ""));
assert_eq!(to_string(f, minf64, Minus, 325, false), format!("0.{:0>323}50", ""));

if cfg!(miri) { // Miri is too slow
return;
}

// very large output
assert_eq!(to_string(f, 1.1, Minus, 80000, false), format!("1.1{:0>79999}", ""));
}
Expand Down Expand Up @@ -807,6 +811,10 @@ pub fn to_exact_exp_str_test<F>(mut f_: F)
"1.401298464324817070923729583289916131280261941876515771757068283\
8897910826858606014866381883621215820312500000000000000000000000e-45");

if cfg!(miri) { // Miri is too slow
return;
}

assert_eq!(to_string(f, f64::MAX, Minus, 1, false), "2e308");
assert_eq!(to_string(f, f64::MAX, Minus, 2, false), "1.8e308");
assert_eq!(to_string(f, f64::MAX, Minus, 4, false), "1.798e308");
Expand Down Expand Up @@ -1040,6 +1048,10 @@ pub fn to_exact_fixed_str_test<F>(mut f_: F)
assert_eq!(to_string(f, f32::MAX, Minus, 2, false),
"340282346638528859811704183484516925440.00");

if cfg!(miri) { // Miri is too slow
return;
}

let minf32 = ldexp_f32(1.0, -149);
assert_eq!(to_string(f, minf32, Minus, 0, false), "0");
assert_eq!(to_string(f, minf32, Minus, 1, false), "0.0");
Expand Down
23 changes: 19 additions & 4 deletions src/libcore/tests/num/flt2dec/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ pub fn f32_exhaustive_equivalence_test<F, G>(f: F, g: G, k: usize)
#[test]
fn shortest_random_equivalence_test() {
use core::num::flt2dec::strategy::dragon::format_shortest as fallback;
f64_random_equivalence_test(format_shortest_opt, fallback, MAX_SIG_DIGITS, 10_000);
f32_random_equivalence_test(format_shortest_opt, fallback, MAX_SIG_DIGITS, 10_000);
#[cfg(not(miri))] // Miri is too slow
const N: usize = 10_000;
#[cfg(miri)]
const N: usize = 10;

f64_random_equivalence_test(format_shortest_opt, fallback, MAX_SIG_DIGITS, N);
f32_random_equivalence_test(format_shortest_opt, fallback, MAX_SIG_DIGITS, N);
}

#[test] #[ignore] // it is too expensive
Expand Down Expand Up @@ -138,17 +143,27 @@ fn shortest_f64_hard_random_equivalence_test() {
#[test]
fn exact_f32_random_equivalence_test() {
use core::num::flt2dec::strategy::dragon::format_exact as fallback;
#[cfg(not(miri))] // Miri is too slow
const N: usize = 1_000;
#[cfg(miri)]
const N: usize = 3;

for k in 1..21 {
f32_random_equivalence_test(|d, buf| format_exact_opt(d, buf, i16::MIN),
|d, buf| fallback(d, buf, i16::MIN), k, 1_000);
|d, buf| fallback(d, buf, i16::MIN), k, N);
}
}

#[test]
fn exact_f64_random_equivalence_test() {
use core::num::flt2dec::strategy::dragon::format_exact as fallback;
#[cfg(not(miri))] // Miri is too slow
const N: usize = 1_000;
#[cfg(miri)]
const N: usize = 3;

for k in 1..21 {
f64_random_equivalence_test(|d, buf| format_exact_opt(d, buf, i16::MIN),
|d, buf| fallback(d, buf, i16::MIN), k, 1_000);
|d, buf| fallback(d, buf, i16::MIN), k, N);
}
}
1 change: 1 addition & 0 deletions src/libcore/tests/num/flt2dec/strategy/dragon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fn shortest_sanity_test() {
}

#[test]
#[cfg(not(miri))] // Miri is too slow
fn exact_sanity_test() {
// This test ends up running what I can only assume is some corner-ish case
// of the `exp2` library function, defined in whatever C runtime we're
Expand Down
1 change: 1 addition & 0 deletions src/libcore/tests/num/flt2dec/strategy/grisu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ fn shortest_sanity_test() {
}

#[test]
#[cfg(not(miri))] // Miri is too slow
fn exact_sanity_test() {
// See comments in dragon.rs's exact_sanity_test for why this test is
// ignored on MSVC
Expand Down
18 changes: 9 additions & 9 deletions src/libcore/tests/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ use core::result::Result::{Ok, Err};
#[test]
fn test_position() {
let b = [1, 2, 3, 5, 5];
assert!(b.iter().position(|&v| v == 9) == None);
assert!(b.iter().position(|&v| v == 5) == Some(3));
assert!(b.iter().position(|&v| v == 3) == Some(2));
assert!(b.iter().position(|&v| v == 0) == None);
assert_eq!(b.iter().position(|&v| v == 9), None);
assert_eq!(b.iter().position(|&v| v == 5), Some(3));
assert_eq!(b.iter().position(|&v| v == 3), Some(2));
assert_eq!(b.iter().position(|&v| v == 0), None);
}

#[test]
fn test_rposition() {
let b = [1, 2, 3, 5, 5];
assert!(b.iter().rposition(|&v| v == 9) == None);
assert!(b.iter().rposition(|&v| v == 5) == Some(4));
assert!(b.iter().rposition(|&v| v == 3) == Some(2));
assert!(b.iter().rposition(|&v| v == 0) == None);
assert_eq!(b.iter().rposition(|&v| v == 9), None);
assert_eq!(b.iter().rposition(|&v| v == 5), Some(4));
assert_eq!(b.iter().rposition(|&v| v == 3), Some(2));
assert_eq!(b.iter().rposition(|&v| v == 0), None);
}

#[test]
Expand Down Expand Up @@ -1153,7 +1153,7 @@ fn test_rotate_right() {
}

#[test]
#[cfg(not(miri))]
#[cfg(not(miri))] // Miri is too slow
fn brute_force_rotate_test_0() {
// In case of edge cases involving multiple algorithms
let n = 300;
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/tests/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::time::Duration;

#[test]
fn creation() {
assert!(Duration::from_secs(1) != Duration::from_secs(0));
assert_ne!(Duration::from_secs(1), Duration::from_secs(0));
assert_eq!(Duration::from_secs(1) + Duration::from_secs(2),
Duration::from_secs(3));
assert_eq!(Duration::from_millis(10) + Duration::from_secs(4),
Expand Down
Loading