Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5b9905b
Added CharIndices::offset function
TrolledWoods Feb 27, 2021
772543a
Removed trailing whitespace
TrolledWoods Feb 27, 2021
907eab8
Added feature flag to doc test
TrolledWoods Feb 27, 2021
30fc601
Tests for field is never read diagnostic
sunjay Mar 11, 2021
321aace
Added suggestion and note for when a field is never used
sunjay Mar 12, 2021
7faaf39
Updating test stderr files
sunjay Mar 12, 2021
789186d
Trying out a new message that works a little better for values *and* …
sunjay Mar 12, 2021
2acd8eb
New shorter diagnostic note that is different for items versus fields
sunjay Mar 13, 2021
3e34eb8
Putting help message only under the identifier that needs to be prefixed
sunjay Mar 25, 2021
539242a
Add a suggestion when using a type alias instead of trait alias
JohnTitor Mar 31, 2021
eea27b8
Mention trait alias on the E0404 note
JohnTitor Mar 31, 2021
53a1105
On stable, suggest removing `#![feature]` for features that have been…
jyn514 Mar 31, 2021
fa1624c
Added tracking issue number
TrolledWoods Apr 5, 2021
37a5b51
implement TrustedRandomAccess for Take iterator adapter
the8472 Apr 8, 2021
03900e4
move core::hint::black_box under its own feature gate
RalfJung Apr 15, 2021
4873271
bootstrap: use bash on illumos to run install scripts
jclulow Apr 16, 2021
e85f19b
:arrow_up: rust-analyzer
lnicola Apr 20, 2021
f505d61
Remove duplicated fn(Box<[T]>) -> Vec<T>
calebsander Apr 16, 2021
62226ee
Improve BinaryHeap::retain.
m-ou-se Nov 2, 2020
f5d72ab
Add better test for BinaryHeap::retain.
m-ou-se Nov 2, 2020
fc2a74c
RustWrapper: work around unification of diagnostic handlers
durin42 Mar 23, 2021
d6e5bba
Rollup merge of #78681 - m-ou-se:binary-heap-retain, r=Amanieu
Dylan-DPC Apr 22, 2021
9f7b36a
Rollup merge of #82585 - TrolledWoods:master, r=dtolnay
Dylan-DPC Apr 22, 2021
8903387
Rollup merge of #83004 - sunjay:field-never-read-issue-81658, r=pnkfelix
Dylan-DPC Apr 22, 2021
a714418
Rollup merge of #83425 - durin42:llvm-update, r=nagisa
Dylan-DPC Apr 22, 2021
9c15d9b
Rollup merge of #83722 - jyn514:stable-help, r=estebank
Dylan-DPC Apr 22, 2021
b6dbf13
Rollup merge of #83729 - JohnTitor:issue-43913, r=estebank
Dylan-DPC Apr 22, 2021
151c0ed
Rollup merge of #83990 - the8472:take-trusted-len, r=dtolnay
Dylan-DPC Apr 22, 2021
4413950
Rollup merge of #84216 - RalfJung:black-box, r=Mark-Simulacrum
Dylan-DPC Apr 22, 2021
46b7644
Rollup merge of #84248 - calebsander:refactor/vec-functions, r=Amanieu
Dylan-DPC Apr 22, 2021
8c7b58c
Rollup merge of #84250 - jclulow:illumos-bash-bootstrap, r=Mark-Simul…
Dylan-DPC Apr 22, 2021
030f4a2
Rollup merge of #84359 - lnicola:rust-analyzer-2021-04-20, r=jonas-sc…
Dylan-DPC Apr 22, 2021
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
move core::hint::black_box under its own feature gate
  • Loading branch information
RalfJung committed Apr 15, 2021
commit 03900e46d79d1910b230fac265a0bd6b611c7e4c
1 change: 1 addition & 0 deletions compiler/rustc_index/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(allow_internal_unstable)]
#![feature(bench_black_box)]
#![feature(const_fn)]
#![feature(const_panic)]
#![feature(extend_one)]
Expand Down
8 changes: 4 additions & 4 deletions library/core/benches/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,28 @@ fn write_str_macro_debug(bh: &mut Bencher) {
#[bench]
fn write_u128_max(bh: &mut Bencher) {
bh.iter(|| {
std::hint::black_box(format!("{}", u128::MAX));
test::black_box(format!("{}", u128::MAX));
});
}

#[bench]
fn write_u128_min(bh: &mut Bencher) {
bh.iter(|| {
let s = format!("{}", 0u128);
std::hint::black_box(s);
test::black_box(s);
});
}

#[bench]
fn write_u64_max(bh: &mut Bencher) {
bh.iter(|| {
std::hint::black_box(format!("{}", u64::MAX));
test::black_box(format!("{}", u64::MAX));
});
}

#[bench]
fn write_u64_min(bh: &mut Bencher) {
bh.iter(|| {
std::hint::black_box(format!("{}", 0u64));
test::black_box(format!("{}", 0u64));
});
}
2 changes: 1 addition & 1 deletion library/core/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub fn spin_loop() {
/// [`std::convert::identity`]: crate::convert::identity
#[cfg_attr(not(miri), inline)]
#[cfg_attr(miri, inline(never))]
#[unstable(feature = "test", issue = "50297")]
#[unstable(feature = "bench_black_box", issue = "64102")]
#[cfg_attr(miri, allow(unused_mut))]
pub fn black_box<T>(mut dummy: T) -> T {
// We need to "use" the argument in some way LLVM can't introspect, and on
Expand Down
1 change: 1 addition & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
#![feature(assert_matches)]
#![feature(associated_type_bounds)]
#![feature(atomic_mut_ptr)]
#![feature(bench_black_box)]
#![feature(box_syntax)]
#![feature(c_variadic)]
#![feature(cfg_accessible)]
Expand Down
11 changes: 9 additions & 2 deletions library/test/src/bench.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//! Benchmarking module.
pub use std::hint::black_box;

use super::{
event::CompletedTest,
options::BenchMode,
Expand All @@ -16,6 +14,15 @@ use std::panic::{catch_unwind, AssertUnwindSafe};
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};

/// An identity function that *__hints__* to the compiler to be maximally pessimistic about what
/// `black_box` could do.
///
/// See [`std::hint::black_box`] for details.
#[inline(always)]
pub fn black_box<T>(dummy: T) -> T {
std::hint::black_box(dummy)
}

/// Manager of the benchmarking runs.
///
/// This is fed into functions marked with `#[bench]` to allow for
Expand Down
1 change: 1 addition & 0 deletions library/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#![feature(rustc_private)]
#![feature(nll)]
#![feature(available_concurrency)]
#![feature(bench_black_box)]
#![feature(internal_output_capture)]
#![feature(panic_unwind)]
#![feature(staged_api)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/cast-discriminant-zst-enum.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// run-pass
// Test a ZST enum whose dicriminant is ~0i128. This caused an ICE when casting to a i32.
#![feature(test)]
#![feature(bench_black_box)]
use std::hint::black_box;

#[derive(Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/const_discriminant.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// run-pass
#![feature(const_discriminant)]
#![feature(test)]
#![feature(bench_black_box)]
#![allow(dead_code)]

use std::mem::{discriminant, Discriminant};
Expand Down