Skip to content

Commit 78be8dc

Browse files
author
The Miri Cronjob Bot
committed
Merge ref 'f605b57042ff' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: f605b57 Filtered ref: c69d2743ed4676c4529ebb60b258f6c1273c9145 This merge was created using https://github.com/rust-lang/josh-sync.
2 parents cc5846f + ede2f42 commit 78be8dc

File tree

85 files changed

+1473
-1010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1473
-1010
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/fmt/num.rs

Lines changed: 125 additions & 206 deletions
Large diffs are not rendered by default.

core/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@ pub mod assert_matches {
226226
pub use crate::macros::{assert_matches, debug_assert_matches};
227227
}
228228

229+
#[unstable(feature = "derive_from", issue = "144889")]
230+
/// Unstable module containing the unstable `From` derive macro.
231+
pub mod from {
232+
#[unstable(feature = "derive_from", issue = "144889")]
233+
pub use crate::macros::builtin::From;
234+
}
235+
229236
// We don't export this through #[macro_export] for now, to avoid breakage.
230237
#[unstable(feature = "autodiff", issue = "124509")]
231238
/// Unstable module containing the unstable `autodiff` macro.

core/src/net/ip_addr.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -626,13 +626,13 @@ impl Ipv4Addr {
626626
/// # Examples
627627
///
628628
/// ```
629-
/// #![feature(ip_from)]
630629
/// use std::net::Ipv4Addr;
631630
///
632631
/// let addr = Ipv4Addr::from_octets([13u8, 12u8, 11u8, 10u8]);
633632
/// assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr);
634633
/// ```
635-
#[unstable(feature = "ip_from", issue = "131360")]
634+
#[stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")]
635+
#[rustc_const_stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")]
636636
#[must_use]
637637
#[inline]
638638
pub const fn from_octets(octets: [u8; 4]) -> Ipv4Addr {
@@ -1464,7 +1464,6 @@ impl Ipv6Addr {
14641464
/// # Examples
14651465
///
14661466
/// ```
1467-
/// #![feature(ip_from)]
14681467
/// use std::net::Ipv6Addr;
14691468
///
14701469
/// let addr = Ipv6Addr::from_segments([
@@ -1479,7 +1478,8 @@ impl Ipv6Addr {
14791478
/// addr
14801479
/// );
14811480
/// ```
1482-
#[unstable(feature = "ip_from", issue = "131360")]
1481+
#[stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")]
1482+
#[rustc_const_stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")]
14831483
#[must_use]
14841484
#[inline]
14851485
pub const fn from_segments(segments: [u16; 8]) -> Ipv6Addr {
@@ -2029,7 +2029,6 @@ impl Ipv6Addr {
20292029
/// # Examples
20302030
///
20312031
/// ```
2032-
/// #![feature(ip_from)]
20332032
/// use std::net::Ipv6Addr;
20342033
///
20352034
/// let addr = Ipv6Addr::from_octets([
@@ -2044,7 +2043,8 @@ impl Ipv6Addr {
20442043
/// addr
20452044
/// );
20462045
/// ```
2047-
#[unstable(feature = "ip_from", issue = "131360")]
2046+
#[stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")]
2047+
#[rustc_const_stable(feature = "ip_from", since = "CURRENT_RUSTC_VERSION")]
20482048
#[must_use]
20492049
#[inline]
20502050
pub const fn from_octets(octets: [u8; 16]) -> Ipv6Addr {

core/src/num/dec2flt/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ macro_rules! from_str_float_impl {
124124
/// * '2.5E-10'
125125
/// * '5.'
126126
/// * '.5', or, equivalently, '0.5'
127+
/// * '7'
128+
/// * '007'
127129
/// * 'inf', '-inf', '+infinity', 'NaN'
128130
///
129131
/// Note that alphabetical characters are not case-sensitive.

core/src/option.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,19 +2095,19 @@ impl<T> Option<&mut T> {
20952095
impl<T, E> Option<Result<T, E>> {
20962096
/// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.
20972097
///
2098-
/// [`None`] will be mapped to <code>[Ok]\([None])</code>.
2099-
/// <code>[Some]\([Ok]\(\_))</code> and <code>[Some]\([Err]\(\_))</code> will be mapped to
2100-
/// <code>[Ok]\([Some]\(\_))</code> and <code>[Err]\(\_)</code>.
2098+
/// <code>[Some]\([Ok]\(\_))</code> is mapped to <code>[Ok]\([Some]\(\_))</code>,
2099+
/// <code>[Some]\([Err]\(\_))</code> is mapped to <code>[Err]\(\_)</code>,
2100+
/// and [`None`] will be mapped to <code>[Ok]\([None])</code>.
21012101
///
21022102
/// # Examples
21032103
///
21042104
/// ```
21052105
/// #[derive(Debug, Eq, PartialEq)]
21062106
/// struct SomeErr;
21072107
///
2108-
/// let x: Result<Option<i32>, SomeErr> = Ok(Some(5));
2109-
/// let y: Option<Result<i32, SomeErr>> = Some(Ok(5));
2110-
/// assert_eq!(x, y.transpose());
2108+
/// let x: Option<Result<i32, SomeErr>> = Some(Ok(5));
2109+
/// let y: Result<Option<i32>, SomeErr> = Ok(Some(5));
2110+
/// assert_eq!(x.transpose(), y);
21112111
/// ```
21122112
#[inline]
21132113
#[stable(feature = "transpose_result", since = "1.33.0")]

core/src/prelude/v1.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,3 @@ pub use crate::macros::builtin::deref;
117117
reason = "`type_alias_impl_trait` has open design concerns"
118118
)]
119119
pub use crate::macros::builtin::define_opaque;
120-
121-
#[unstable(
122-
feature = "derive_from",
123-
issue = "144889",
124-
reason = "`derive(From)` is unstable"
125-
)]
126-
pub use crate::macros::builtin::From;

core/src/unicode/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
//! Unicode internals used in liballoc and libstd. Not public API.
12
#![unstable(feature = "unicode_internals", issue = "none")]
2-
#![allow(missing_docs)]
3+
#![doc(hidden)]
34

45
// for use in alloc, not re-exported in std.
56
#[rustfmt::skip]
@@ -31,5 +32,4 @@ mod unicode_data;
3132
///
3233
/// The version numbering scheme is explained in
3334
/// [Unicode 11.0 or later, Section 3.1 Versions of the Unicode Standard](https://www.unicode.org/versions/Unicode11.0.0/ch03.pdf#page=4).
34-
#[stable(feature = "unicode_version", since = "1.45.0")]
3535
pub const UNICODE_VERSION: (u8, u8, u8) = unicode_data::UNICODE_VERSION;

coretests/benches/fmt.rs

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,183 @@ fn write_u8_min(bh: &mut Bencher) {
162162
black_box(format!("{}", black_box(u8::MIN)));
163163
});
164164
}
165+
166+
#[bench]
167+
fn write_i8_bin(bh: &mut Bencher) {
168+
let mut buf = String::with_capacity(256);
169+
bh.iter(|| {
170+
write!(black_box(&mut buf), "{:b}", black_box(0_i8)).unwrap();
171+
write!(black_box(&mut buf), "{:b}", black_box(100_i8)).unwrap();
172+
write!(black_box(&mut buf), "{:b}", black_box(-100_i8)).unwrap();
173+
write!(black_box(&mut buf), "{:b}", black_box(1_i8 << 4)).unwrap();
174+
black_box(&mut buf).clear();
175+
});
176+
}
177+
178+
#[bench]
179+
fn write_i16_bin(bh: &mut Bencher) {
180+
let mut buf = String::with_capacity(256);
181+
bh.iter(|| {
182+
write!(black_box(&mut buf), "{:b}", black_box(0_i16)).unwrap();
183+
write!(black_box(&mut buf), "{:b}", black_box(100_i16)).unwrap();
184+
write!(black_box(&mut buf), "{:b}", black_box(-100_i16)).unwrap();
185+
write!(black_box(&mut buf), "{:b}", black_box(1_i16 << 8)).unwrap();
186+
black_box(&mut buf).clear();
187+
});
188+
}
189+
190+
#[bench]
191+
fn write_i32_bin(bh: &mut Bencher) {
192+
let mut buf = String::with_capacity(256);
193+
bh.iter(|| {
194+
write!(black_box(&mut buf), "{:b}", black_box(0_i32)).unwrap();
195+
write!(black_box(&mut buf), "{:b}", black_box(100_i32)).unwrap();
196+
write!(black_box(&mut buf), "{:b}", black_box(-100_i32)).unwrap();
197+
write!(black_box(&mut buf), "{:b}", black_box(1_i32 << 16)).unwrap();
198+
black_box(&mut buf).clear();
199+
});
200+
}
201+
202+
#[bench]
203+
fn write_i64_bin(bh: &mut Bencher) {
204+
let mut buf = String::with_capacity(256);
205+
bh.iter(|| {
206+
write!(black_box(&mut buf), "{:b}", black_box(0_i64)).unwrap();
207+
write!(black_box(&mut buf), "{:b}", black_box(100_i64)).unwrap();
208+
write!(black_box(&mut buf), "{:b}", black_box(-100_i64)).unwrap();
209+
write!(black_box(&mut buf), "{:b}", black_box(1_i64 << 32)).unwrap();
210+
black_box(&mut buf).clear();
211+
});
212+
}
213+
214+
#[bench]
215+
fn write_i128_bin(bh: &mut Bencher) {
216+
let mut buf = String::with_capacity(256);
217+
bh.iter(|| {
218+
write!(black_box(&mut buf), "{:b}", black_box(0_i128)).unwrap();
219+
write!(black_box(&mut buf), "{:b}", black_box(100_i128)).unwrap();
220+
write!(black_box(&mut buf), "{:b}", black_box(-100_i128)).unwrap();
221+
write!(black_box(&mut buf), "{:b}", black_box(1_i128 << 64)).unwrap();
222+
black_box(&mut buf).clear();
223+
});
224+
}
225+
226+
#[bench]
227+
fn write_i8_oct(bh: &mut Bencher) {
228+
let mut buf = String::with_capacity(256);
229+
bh.iter(|| {
230+
write!(black_box(&mut buf), "{:o}", black_box(0_i8)).unwrap();
231+
write!(black_box(&mut buf), "{:o}", black_box(100_i8)).unwrap();
232+
write!(black_box(&mut buf), "{:o}", black_box(-100_i8)).unwrap();
233+
write!(black_box(&mut buf), "{:o}", black_box(1_i8 << 4)).unwrap();
234+
black_box(&mut buf).clear();
235+
});
236+
}
237+
238+
#[bench]
239+
fn write_i16_oct(bh: &mut Bencher) {
240+
let mut buf = String::with_capacity(256);
241+
bh.iter(|| {
242+
write!(black_box(&mut buf), "{:o}", black_box(0_i16)).unwrap();
243+
write!(black_box(&mut buf), "{:o}", black_box(100_i16)).unwrap();
244+
write!(black_box(&mut buf), "{:o}", black_box(-100_i16)).unwrap();
245+
write!(black_box(&mut buf), "{:o}", black_box(1_i16 << 8)).unwrap();
246+
black_box(&mut buf).clear();
247+
});
248+
}
249+
250+
#[bench]
251+
fn write_i32_oct(bh: &mut Bencher) {
252+
let mut buf = String::with_capacity(256);
253+
bh.iter(|| {
254+
write!(black_box(&mut buf), "{:o}", black_box(0_i32)).unwrap();
255+
write!(black_box(&mut buf), "{:o}", black_box(100_i32)).unwrap();
256+
write!(black_box(&mut buf), "{:o}", black_box(-100_i32)).unwrap();
257+
write!(black_box(&mut buf), "{:o}", black_box(1_i32 << 16)).unwrap();
258+
black_box(&mut buf).clear();
259+
});
260+
}
261+
262+
#[bench]
263+
fn write_i64_oct(bh: &mut Bencher) {
264+
let mut buf = String::with_capacity(256);
265+
bh.iter(|| {
266+
write!(black_box(&mut buf), "{:o}", black_box(0_i64)).unwrap();
267+
write!(black_box(&mut buf), "{:o}", black_box(100_i64)).unwrap();
268+
write!(black_box(&mut buf), "{:o}", black_box(-100_i64)).unwrap();
269+
write!(black_box(&mut buf), "{:o}", black_box(1_i64 << 32)).unwrap();
270+
black_box(&mut buf).clear();
271+
});
272+
}
273+
274+
#[bench]
275+
fn write_i128_oct(bh: &mut Bencher) {
276+
let mut buf = String::with_capacity(256);
277+
bh.iter(|| {
278+
write!(black_box(&mut buf), "{:o}", black_box(0_i128)).unwrap();
279+
write!(black_box(&mut buf), "{:o}", black_box(100_i128)).unwrap();
280+
write!(black_box(&mut buf), "{:o}", black_box(-100_i128)).unwrap();
281+
write!(black_box(&mut buf), "{:o}", black_box(1_i128 << 64)).unwrap();
282+
black_box(&mut buf).clear();
283+
});
284+
}
285+
286+
#[bench]
287+
fn write_i8_hex(bh: &mut Bencher) {
288+
let mut buf = String::with_capacity(256);
289+
bh.iter(|| {
290+
write!(black_box(&mut buf), "{:x}", black_box(0_i8)).unwrap();
291+
write!(black_box(&mut buf), "{:x}", black_box(100_i8)).unwrap();
292+
write!(black_box(&mut buf), "{:x}", black_box(-100_i8)).unwrap();
293+
write!(black_box(&mut buf), "{:x}", black_box(1_i8 << 4)).unwrap();
294+
black_box(&mut buf).clear();
295+
});
296+
}
297+
298+
#[bench]
299+
fn write_i16_hex(bh: &mut Bencher) {
300+
let mut buf = String::with_capacity(256);
301+
bh.iter(|| {
302+
write!(black_box(&mut buf), "{:x}", black_box(0_i16)).unwrap();
303+
write!(black_box(&mut buf), "{:x}", black_box(100_i16)).unwrap();
304+
write!(black_box(&mut buf), "{:x}", black_box(-100_i16)).unwrap();
305+
write!(black_box(&mut buf), "{:x}", black_box(1_i16 << 8)).unwrap();
306+
black_box(&mut buf).clear();
307+
});
308+
}
309+
310+
#[bench]
311+
fn write_i32_hex(bh: &mut Bencher) {
312+
let mut buf = String::with_capacity(256);
313+
bh.iter(|| {
314+
write!(black_box(&mut buf), "{:x}", black_box(0_i32)).unwrap();
315+
write!(black_box(&mut buf), "{:x}", black_box(100_i32)).unwrap();
316+
write!(black_box(&mut buf), "{:x}", black_box(-100_i32)).unwrap();
317+
write!(black_box(&mut buf), "{:x}", black_box(1_i32 << 16)).unwrap();
318+
black_box(&mut buf).clear();
319+
});
320+
}
321+
322+
#[bench]
323+
fn write_i64_hex(bh: &mut Bencher) {
324+
let mut buf = String::with_capacity(256);
325+
bh.iter(|| {
326+
write!(black_box(&mut buf), "{:x}", black_box(0_i64)).unwrap();
327+
write!(black_box(&mut buf), "{:x}", black_box(100_i64)).unwrap();
328+
write!(black_box(&mut buf), "{:x}", black_box(-100_i64)).unwrap();
329+
write!(black_box(&mut buf), "{:x}", black_box(1_i64 << 32)).unwrap();
330+
black_box(&mut buf).clear();
331+
});
332+
}
333+
334+
#[bench]
335+
fn write_i128_hex(bh: &mut Bencher) {
336+
let mut buf = String::with_capacity(256);
337+
bh.iter(|| {
338+
write!(black_box(&mut buf), "{:x}", black_box(0_i128)).unwrap();
339+
write!(black_box(&mut buf), "{:x}", black_box(100_i128)).unwrap();
340+
write!(black_box(&mut buf), "{:x}", black_box(-100_i128)).unwrap();
341+
write!(black_box(&mut buf), "{:x}", black_box(1_i128 << 64)).unwrap();
342+
black_box(&mut buf).clear();
343+
});
344+
}

coretests/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#![feature(hashmap_internals)]
5757
#![feature(int_roundings)]
5858
#![feature(ip)]
59-
#![feature(ip_from)]
6059
#![feature(is_ascii_octdigit)]
6160
#![feature(isolate_most_least_significant_one)]
6261
#![feature(iter_advance_by)]

0 commit comments

Comments
 (0)