Skip to content

Rollup of 10 pull requests #71907

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 27 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a1f81ff
rustdoc supports const re-exports
Mark-Simulacrum Apr 29, 2020
70fafed
Remove unsized enum test
Mark-Simulacrum Apr 30, 2020
bfed215
Remove ignored type alias test
Mark-Simulacrum Apr 30, 2020
34eb2c1
Report cannot move errors in promoted MIR
matthewjasper Apr 22, 2020
a992f95
Add examples for std::f32 constants.
steveklabnik May 3, 2020
0768fa4
add some whitespace
steveklabnik May 3, 2020
d38d429
correct -> intended
steveklabnik May 4, 2020
8bef0a3
f64 examples
steveklabnik May 4, 2020
55e37f9
Add examples to int macros
steveklabnik May 4, 2020
1593e2b
Add remove_current_as_list to LinkedList's CursorMut
main-- May 4, 2020
c5cdf7f
whoops
main-- May 4, 2020
6e77729
Correctly handle UEFI targets as Windows-like when emitting sections …
IsaacWoods May 4, 2020
4a8fa18
add a missing word
Dante-Broggi May 4, 2020
a9b6af9
double neg
lcnr May 4, 2020
d02128f
Update btree_map::VacantEntry::insert docs to actually call insert
carols10cents May 4, 2020
7386736
Suggest to add missing feature when using gated const features
mibac138 May 4, 2020
36f51f9
fix typo in function name
euclio May 4, 2020
4bde46e
Rollup merge of #71587 - matthewjasper:promoted-move-errors, r=nikoma…
Dylan-DPC May 4, 2020
04776b1
Rollup merge of #71711 - Mark-Simulacrum:deignore-tests, r=nikomatsakis
Dylan-DPC May 4, 2020
db7b381
Rollup merge of #71845 - steveklabnik:add-const-examples, r=dtolnay
Dylan-DPC May 4, 2020
faccb0f
Rollup merge of #71878 - main--:patch-2, r=Amanieu
Dylan-DPC May 4, 2020
c1b2fd2
Rollup merge of #71881 - IsaacWoods:master, r=petrochenkov
Dylan-DPC May 4, 2020
4b0b6e3
Rollup merge of #71883 - Dante-Broggi:patch-1, r=Dylan-DPC
Dylan-DPC May 4, 2020
a93cc06
Rollup merge of #71891 - lcnr:not-iter-any, r=Dylan-DPC
Dylan-DPC May 4, 2020
ac84daf
Rollup merge of #71892 - integer32llc:btreemap-entry-vacant-docs, r=j…
Dylan-DPC May 4, 2020
ad74ce9
Rollup merge of #71902 - mibac138:const-feature-diag, r=varkor
Dylan-DPC May 4, 2020
8b781b0
Rollup merge of #71904 - euclio:function-typo, r=jonas-schievink
Dylan-DPC May 4, 2020
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
11 changes: 5 additions & 6 deletions src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2499,15 +2499,14 @@ impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
///
/// ```
/// use std::collections::BTreeMap;
/// use std::collections::btree_map::Entry;
///
/// let mut count: BTreeMap<&str, usize> = BTreeMap::new();
/// let mut map: BTreeMap<&str, u32> = BTreeMap::new();
///
/// // count the number of occurrences of letters in the vec
/// for x in vec!["a","b","a","c","a","b"] {
/// *count.entry(x).or_insert(0) += 1;
/// if let Entry::Vacant(o) = map.entry("poneyland") {
/// o.insert(37);
/// }
///
/// assert_eq!(count["a"], 3);
/// assert_eq!(map["poneyland"], 37);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(self, value: V) -> &'a mut V {
Expand Down
25 changes: 25 additions & 0 deletions src/liballoc/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,31 @@ impl<'a, T> CursorMut<'a, T> {
}
}

/// Removes the current element from the `LinkedList` without deallocating the list node.
///
/// The node that was removed is returned as a new `LinkedList` containing only this node.
/// The cursor is moved to point to the next element in the current `LinkedList`.
///
/// If the cursor is currently pointing to the "ghost" non-element then no element
/// is removed and `None` is returned.
#[unstable(feature = "linked_list_cursors", issue = "58533")]
pub fn remove_current_as_list(&mut self) -> Option<LinkedList<T>> {
let mut unlinked_node = self.current?;
unsafe {
self.current = unlinked_node.as_ref().next;
self.list.unlink_node(unlinked_node);

unlinked_node.as_mut().prev = None;
unlinked_node.as_mut().next = None;
Some(LinkedList {
head: Some(unlinked_node),
tail: Some(unlinked_node),
len: 1,
marker: PhantomData,
})
}
}

/// Inserts the elements from the given `LinkedList` after the current one.
///
/// If the cursor is pointing at the "ghost" non-element then the new elements are
Expand Down
147 changes: 147 additions & 0 deletions src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,46 @@ use crate::num::FpCategory;

/// The radix or base of the internal representation of `f32`.
/// Use [`f32::RADIX`](../../std/primitive.f32.html#associatedconstant.RADIX) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let r = std::f32::RADIX;
///
/// // intended way
/// let r = f32::RADIX;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const RADIX: u32 = f32::RADIX;

/// Number of significant digits in base 2.
/// Use [`f32::MANTISSA_DIGITS`](../../std/primitive.f32.html#associatedconstant.MANTISSA_DIGITS) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let d = std::f32::MANTISSA_DIGITS;
///
/// // intended way
/// let d = f32::MANTISSA_DIGITS;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;

/// Approximate number of significant digits in base 10.
/// Use [`f32::DIGITS`](../../std/primitive.f32.html#associatedconstant.DIGITS) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let d = std::f32::DIGITS;
///
/// // intended way
/// let d = f32::DIGITS;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const DIGITS: u32 = f32::DIGITS;

Expand All @@ -36,50 +67,166 @@ pub const DIGITS: u32 = f32::DIGITS;
/// This is the difference between `1.0` and the next larger representable number.
///
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let e = std::f32::EPSILON;
///
/// // intended way
/// let e = f32::EPSILON;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const EPSILON: f32 = f32::EPSILON;

/// Smallest finite `f32` value.
/// Use [`f32::MIN`](../../std/primitive.f32.html#associatedconstant.MIN) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f32::MIN;
///
/// // intended way
/// let min = f32::MIN;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN: f32 = f32::MIN;

/// Smallest positive normal `f32` value.
/// Use [`f32::MIN_POSITIVE`](../../std/primitive.f32.html#associatedconstant.MIN_POSITIVE) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f32::MIN_POSITIVE;
///
/// // intended way
/// let min = f32::MIN_POSITIVE;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;

/// Largest finite `f32` value.
/// Use [`f32::MAX`](../../std/primitive.f32.html#associatedconstant.MAX) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let max = std::f32::MAX;
///
/// // intended way
/// let max = f32::MAX;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX: f32 = f32::MAX;

/// One greater than the minimum possible normal power of 2 exponent.
/// Use [`f32::MIN_EXP`](../../std/primitive.f32.html#associatedconstant.MIN_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f32::MIN_EXP;
///
/// // intended way
/// let min = f32::MIN_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_EXP: i32 = f32::MIN_EXP;

/// Maximum possible power of 2 exponent.
/// Use [`f32::MAX_EXP`](../../std/primitive.f32.html#associatedconstant.MAX_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let max = std::f32::MAX_EXP;
///
/// // intended way
/// let max = f32::MAX_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX_EXP: i32 = f32::MAX_EXP;

/// Minimum possible normal power of 10 exponent.
/// Use [`f32::MIN_10_EXP`](../../std/primitive.f32.html#associatedconstant.MIN_10_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f32::MIN_10_EXP;
///
/// // intended way
/// let min = f32::MIN_10_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;

/// Maximum possible power of 10 exponent.
/// Use [`f32::MAX_10_EXP`](../../std/primitive.f32.html#associatedconstant.MAX_10_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let max = std::f32::MAX_10_EXP;
///
/// // intended way
/// let max = f32::MAX_10_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;

/// Not a Number (NaN).
/// Use [`f32::NAN`](../../std/primitive.f32.html#associatedconstant.NAN) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let nan = std::f32::NAN;
///
/// // intended way
/// let nan = f32::NAN;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const NAN: f32 = f32::NAN;

/// Infinity (∞).
/// Use [`f32::INFINITY`](../../std/primitive.f32.html#associatedconstant.INFINITY) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let inf = std::f32::INFINITY;
///
/// // intended way
/// let inf = f32::INFINITY;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const INFINITY: f32 = f32::INFINITY;

/// Negative infinity (−∞).
/// Use [`f32::NEG_INFINITY`](../../std/primitive.f32.html#associatedconstant.NEG_INFINITY) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let ninf = std::f32::NEG_INFINITY;
///
/// // intended way
/// let ninf = f32::NEG_INFINITY;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const NEG_INFINITY: f32 = f32::NEG_INFINITY;

Expand Down
Loading