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 12 pull requests #59428

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
7fb1c22
promoted is still left in 2 places
Mar 16, 2019
a837b8a
cleaner code as per review
Mar 17, 2019
23c87a1
fixed all compilation errors
Mar 18, 2019
ac6ab65
adjust MaybeUninit API to discussions
RalfJung Mar 18, 2019
776407e
tidy checks
Mar 19, 2019
9374efa
fix some uses I missed
RalfJung Mar 19, 2019
8829dda
remove visit_static from librustc::mir
Mar 20, 2019
72f8d4e
Add no_hash to query macro and move some queries over
Zoxc Mar 20, 2019
b440041
Allow itertools
Zoxc Mar 20, 2019
d060e7d
Add no_force to query macro and move some queries over
Zoxc Mar 20, 2019
52374a6
Add anon to query macro and move a query over
Zoxc Mar 20, 2019
4d0a1e4
Add eval_always to query macro and move a query over
Zoxc Mar 20, 2019
75677c4
Fix whitespace
Zoxc Mar 20, 2019
71dfb01
Update build instructions in README.md
ewk Mar 21, 2019
cf2f1bb
review fixes
Mar 20, 2019
48af718
Expand `impl FromIterator for Option` doc to include example of early…
pnkfelix Mar 20, 2019
d5a61c0
Expand `impl FromIterator for Result` doc to include examples of `Err…
pnkfelix Mar 20, 2019
b34a71b
add suggestions to trim_{left,right} deprecations
euclio Mar 22, 2019
37cfeb2
Add/rename checked_duration_since tests
faern Mar 22, 2019
d56b1fd
Make duration_since use checked_duration_since
faern Mar 22, 2019
1ccad16
Update sys::time impls to have checked_sub_instant
faern Mar 22, 2019
8ba1a97
Expand suggestions for type ascription parse errors
estebank Mar 13, 2019
b1a6c32
Tweak labels
estebank Mar 13, 2019
72a3089
Only suggest let assignment for type ascription if we find an equals …
estebank Mar 13, 2019
81b876b
Hide "type ascription is experimental error" unless it's the only one
estebank Mar 13, 2019
44a086e
Review comment
estebank Mar 20, 2019
d72ef21
Reword type ascription note to reduce verbosity
estebank Mar 23, 2019
752544b
adding mir::StaticKind enum for static and promoted
Mar 23, 2019
fb93f10
code review fixes
Mar 24, 2019
8d7c2bb
replace redundant note in deprecation warning
euclio Mar 24, 2019
f5d6b3a
Moves test::black_box to core::hint
gnzlbg Mar 21, 2019
f244383
Remove dupplicated config
gnzlbg Mar 25, 2019
6315221
Update src/libcore/option.rs
killercup Mar 25, 2019
cfa76c4
black_box should inhibit optimizations on platforms without inline as…
gnzlbg Mar 25, 2019
0e83e96
add missing braces
pnkfelix Mar 25, 2019
0bb36a2
Clarify `{Ord,f32,f64}::clamp` docs a little
tbu- Mar 25, 2019
24db517
black_box should use inline assembly on wasm32
gnzlbg Mar 25, 2019
28c602a
Utilize `?` instead of `return None`.
frewsxcv Mar 25, 2019
3e7a5fd
Rollup merge of #59150 - estebank:type-ascription, r=varkor
Centril Mar 26, 2019
01af178
Rollup merge of #59232 - saleemjaffer:mir_place_refactor, r=oli-obk
Centril Mar 26, 2019
e061309
Rollup merge of #59284 - RalfJung:maybe-uninit, r=sfackler
Centril Mar 26, 2019
205d20a
Rollup merge of #59315 - Zoxc:move-query, r=oli-obk
Centril Mar 26, 2019
7b70515
Rollup merge of #59334 - ewk:readme, r=Mark-Simulacrum
Centril Mar 26, 2019
f9ae15f
Rollup merge of #59336 - gnzlbg:hint_black_box, r=alexcrichton
Centril Mar 26, 2019
ea51c8b
Rollup merge of #59362 - pnkfelix:demo-from-iterator-short-circuiting…
Centril Mar 26, 2019
cb15da7
Rollup merge of #59372 - euclio:rename-trim, r=rkruppe
Centril Mar 26, 2019
8aa161b
Rollup merge of #59374 - faern:simplify-checked-duration-since, r=she…
Centril Mar 26, 2019
e5f4755
Rollup merge of #59389 - euclio:deprecated-suggestion, r=varkor
Centril Mar 26, 2019
25f3ae9
Rollup merge of #59410 - tbu-:pr_doc_clarifyclamp, r=joshtriplett
Centril Mar 26, 2019
5059a9a
Rollup merge of #59419 - frewsxcv:frewsxcv-qu, r=varkor
Centril Mar 26, 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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2811,6 +2811,7 @@ dependencies = [
name = "rustc_macros"
version = "0.1.0"
dependencies = [
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ of the rustc-guide instead._
$ ./x.py build && sudo ./x.py install
```

If after running `sudo ./x.py install` you see an error message like

```
error: failed to load source for a dependency on 'cc'
```

then run these two commands and then try `sudo ./x.py install` again:

```
$ cargo install cargo-vendor
```

```
$ cargo vendor
```

> ***Note:*** Install locations can be adjusted by copying the config file
> from `./config.toml.example` to `./config.toml`, and
> adjusting the `prefix` option under `[install]`. Various other options, such
Expand Down
10 changes: 5 additions & 5 deletions src/liballoc/collections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<K, V> LeafNode<K, V> {
keys: uninitialized_array![_; CAPACITY],
vals: uninitialized_array![_; CAPACITY],
parent: ptr::null(),
parent_idx: MaybeUninit::uninitialized(),
parent_idx: MaybeUninit::uninit(),
len: 0
}
}
Expand All @@ -129,7 +129,7 @@ unsafe impl Sync for NodeHeader<(), ()> {}
// ever take a pointer past the first key.
static EMPTY_ROOT_NODE: NodeHeader<(), ()> = NodeHeader {
parent: ptr::null(),
parent_idx: MaybeUninit::uninitialized(),
parent_idx: MaybeUninit::uninit(),
len: 0,
keys_start: [],
};
Expand Down Expand Up @@ -261,7 +261,7 @@ impl<K, V> Root<K, V> {
-> NodeRef<marker::Mut<'_>, K, V, marker::Internal> {
debug_assert!(!self.is_shared_root());
let mut new_node = Box::new(unsafe { InternalNode::new() });
new_node.edges[0].set(unsafe { BoxedNode::from_ptr(self.node.as_ptr()) });
new_node.edges[0].write(unsafe { BoxedNode::from_ptr(self.node.as_ptr()) });

self.node = BoxedNode::from_internal(new_node);
self.height += 1;
Expand Down Expand Up @@ -737,7 +737,7 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
unsafe {
ptr::write(self.keys_mut().get_unchecked_mut(idx), key);
ptr::write(self.vals_mut().get_unchecked_mut(idx), val);
self.as_internal_mut().edges.get_unchecked_mut(idx + 1).set(edge.node);
self.as_internal_mut().edges.get_unchecked_mut(idx + 1).write(edge.node);

(*self.as_leaf_mut()).len += 1;

Expand Down Expand Up @@ -1080,7 +1080,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
let mut child = self.descend();
unsafe {
(*child.as_leaf_mut()).parent = ptr;
(*child.as_leaf_mut()).parent_idx.set(idx);
(*child.as_leaf_mut()).parent_idx.write(idx);
}
}

Expand Down
13 changes: 9 additions & 4 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,14 @@ pub trait Ord: Eq + PartialOrd<Self> {
if self <= other { self } else { other }
}

/// Returns max if self is greater than max, and min if self is less than min.
/// Otherwise this will return self. Panics if min > max.
/// Restrict a value to a certain interval.
///
/// Returns `max` if `self` is greater than `max`, and `min` if `self` is
/// less than `min`. Otherwise this returns `self`.
///
/// # Panics
///
/// Panics if `min > max`.
///
/// # Examples
///
Expand All @@ -586,8 +592,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
assert!(min <= max);
if self < min {
min
}
else if self > max {
} else if self > max {
max
} else {
self
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/fmt/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ fn float_to_decimal_common_exact<T>(fmt: &mut Formatter, num: &T,
where T: flt2dec::DecodableFloat
{
unsafe {
let mut buf = MaybeUninit::<[u8; 1024]>::uninitialized(); // enough for f32 and f64
let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninitialized();
let mut buf = MaybeUninit::<[u8; 1024]>::uninit(); // enough for f32 and f64
let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninit();
// FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized
// `MaybeUninit` (here and elsewhere in this file). Revisit this once
// we decided whether that is valid or not.
Expand All @@ -32,8 +32,8 @@ fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter, num: &T,
{
unsafe {
// enough for f32 and f64
let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized();
let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninitialized();
let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninit();
let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninit();
// FIXME(#53491)
let formatted = flt2dec::to_shortest_str(flt2dec::strategy::grisu::format_shortest, *num,
sign, precision, false, buf.get_mut(),
Expand Down Expand Up @@ -71,8 +71,8 @@ fn float_to_exponential_common_exact<T>(fmt: &mut Formatter, num: &T,
where T: flt2dec::DecodableFloat
{
unsafe {
let mut buf = MaybeUninit::<[u8; 1024]>::uninitialized(); // enough for f32 and f64
let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized();
let mut buf = MaybeUninit::<[u8; 1024]>::uninit(); // enough for f32 and f64
let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninit();
// FIXME(#53491)
let formatted = flt2dec::to_exact_exp_str(flt2dec::strategy::grisu::format_exact,
*num, sign, precision,
Expand All @@ -91,8 +91,8 @@ fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
{
unsafe {
// enough for f32 and f64
let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized();
let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized();
let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninit();
let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninit();
// FIXME(#53491)
let formatted = flt2dec::to_shortest_exp_str(flt2dec::strategy::grisu::format_shortest,
*num, sign, (0, 0), upper,
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/fmt/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ trait GenericRadix {
for byte in buf.iter_mut().rev() {
let n = x % base; // Get the current place value.
x = x / base; // Deaccumulate the number.
byte.set(Self::digit(n.to_u8())); // Store the digit in the buffer.
byte.write(Self::digit(n.to_u8())); // Store the digit in the buffer.
curr -= 1;
if x == zero {
// No more digits left to accumulate.
Expand All @@ -72,7 +72,7 @@ trait GenericRadix {
for byte in buf.iter_mut().rev() {
let n = zero - (x % base); // Get the current place value.
x = x / base; // Deaccumulate the number.
byte.set(Self::digit(n.to_u8())); // Store the digit in the buffer.
byte.write(Self::digit(n.to_u8())); // Store the digit in the buffer.
curr -= 1;
if x == zero {
// No more digits left to accumulate.
Expand Down
22 changes: 22 additions & 0 deletions src/libcore/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,25 @@ pub fn spin_loop() {
}
}
}

/// A function that is opaque to the optimizer, to allow benchmarks to
/// pretend to use outputs to assist in avoiding dead-code
/// elimination.
///
/// This function is a no-op, and does not even read from `dummy`.
#[unstable(feature = "test", issue = "27812")]
pub fn black_box<T>(dummy: T) -> T {
#[cfg(not(target_arch = "asmjs"))] {
// we need to "use" the argument in some way LLVM can't
// introspect.
unsafe { asm!("" : : "r"(&dummy)) }
dummy
}
#[cfg(target_arch = "asmjs")] {
unsafe {
let ret = crate::ptr::read_volatile(&dummy);
crate::mem::forget(dummy);
ret
}
}
}
4 changes: 2 additions & 2 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,12 +626,12 @@ macro_rules! todo {
#[macro_export]
#[unstable(feature = "maybe_uninit_array", issue = "53491")]
macro_rules! uninitialized_array {
// This `into_initialized` is safe because an array of `MaybeUninit` does not
// This `assume_init` is safe because an array of `MaybeUninit` does not
// require initialization.
// FIXME(#49147): Could be replaced by an array initializer, once those can
// be any const expression.
($t:ty; $size:expr) => (unsafe {
MaybeUninit::<[MaybeUninit<$t>; $size]>::uninitialized().into_initialized()
MaybeUninit::<[MaybeUninit<$t>; $size]>::uninit().assume_init()
});
}

Expand Down
Loading