Auto merge of #53216 - kennytm:rollup, r=kennytm
Rollup of 15 pull requests Successful merges: - #52773 (Avoid unnecessary pattern matching against Option and Result) - #53082 (Fix doc link (again)) - #53094 (Automatically expand section if url id point to one of its component) - #53106 (atomic ordering docs) - #53110 (Account for --remap-path-prefix in save-analysis) - #53116 (NetBSD: fix signedess of char) - #53179 (Whitelist wasm32 simd128 target feature) - #53183 (Suggest comma when missing in macro call) - #53207 (Add individual docs for rotate_{left, right}) - #53211 ([nll] enable feature(nll) on various crates for bootstrap) - #53214 ([nll] enable feature(nll) on various crates for bootstrap: part 2) - #53215 (Slightly refactor syntax_ext/format) - #53217 (inline some short functions) - #53219 ([nll] enable feature(nll) on various crates for bootstrap: part 3) - #53222 (A few cleanups for rustc_target)
This commit is contained in:
commit
8958ed6722
@ -76,6 +76,7 @@
|
||||
|
||||
#![cfg_attr(not(test), feature(fn_traits))]
|
||||
#![cfg_attr(not(test), feature(generator_trait))]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![cfg_attr(test, feature(test))]
|
||||
|
||||
#![feature(allocator_api)]
|
||||
|
@ -16,6 +16,7 @@
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(libc)]
|
||||
#![feature(linkage)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(staged_api)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![cfg_attr(dummy_jemalloc, allow(dead_code, unused_extern_crates))]
|
||||
|
@ -14,8 +14,10 @@
|
||||
reason = "this library is unlikely to be stabilized in its current \
|
||||
form or name",
|
||||
issue = "32838")]
|
||||
|
||||
#![feature(allocator_api)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(staged_api)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))]
|
||||
|
@ -26,6 +26,7 @@
|
||||
#![feature(alloc)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(dropck_eyepatch)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(raw_vec_internals)]
|
||||
#![cfg_attr(test, feature(test))]
|
||||
|
||||
|
@ -469,6 +469,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
|
||||
/// assert_eq!(2, 2.max(2));
|
||||
/// ```
|
||||
#[stable(feature = "ord_max_min", since = "1.21.0")]
|
||||
#[inline]
|
||||
fn max(self, other: Self) -> Self
|
||||
where Self: Sized {
|
||||
if other >= self { other } else { self }
|
||||
@ -485,6 +486,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
|
||||
/// assert_eq!(2, 2.min(2));
|
||||
/// ```
|
||||
#[stable(feature = "ord_max_min", since = "1.21.0")]
|
||||
#[inline]
|
||||
fn min(self, other: Self) -> Self
|
||||
where Self: Sized {
|
||||
if self <= other { self } else { other }
|
||||
|
@ -95,7 +95,7 @@ impl<T: ?Sized> !Send for *mut T { }
|
||||
message="the size for values of type `{Self}` cannot be known at compilation time",
|
||||
label="doesn't have a size known at compile-time",
|
||||
note="to learn more, visit <https://doc.rust-lang.org/book/second-edition/\
|
||||
ch19-04-advanced-types.html#dynamically-sized-types-and-sized>",
|
||||
ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>",
|
||||
)]
|
||||
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
|
||||
pub trait Sized {
|
||||
|
@ -188,7 +188,7 @@ mod wrapping;
|
||||
// `Int` + `SignedInt` implemented for signed integers
|
||||
macro_rules! int_impl {
|
||||
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr, $Feature:expr,
|
||||
$EndFeature:expr) => {
|
||||
$EndFeature:expr, $rot:expr, $rot_op:expr, $rot_result:expr) => {
|
||||
doc_comment! {
|
||||
concat!("Returns the smallest value that can be represented by this integer type.
|
||||
|
||||
@ -334,55 +334,52 @@ $EndFeature, "
|
||||
}
|
||||
}
|
||||
|
||||
/// Shifts the bits to the left by a specified amount, `n`,
|
||||
/// wrapping the truncated bits to the end of the resulting integer.
|
||||
///
|
||||
/// Please note this isn't the same operation as `<<`!
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Please note that this example is shared between integer types.
|
||||
/// Which explains why `i64` is used here.
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// let n = 0x0123456789ABCDEFi64;
|
||||
/// let m = -0x76543210FEDCBA99i64;
|
||||
///
|
||||
/// assert_eq!(n.rotate_left(32), m);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn rotate_left(self, n: u32) -> Self {
|
||||
(self as $UnsignedT).rotate_left(n) as Self
|
||||
doc_comment! {
|
||||
concat!("Shifts the bits to the left by a specified amount, `n`,
|
||||
wrapping the truncated bits to the end of the resulting integer.
|
||||
|
||||
Please note this isn't the same operation as `<<`!
|
||||
|
||||
# Examples
|
||||
|
||||
Basic usage:
|
||||
|
||||
```
|
||||
let n = ", $rot_op, stringify!($SelfT), ";
|
||||
let m = ", $rot_result, ";
|
||||
|
||||
assert_eq!(n.rotate_left(", $rot, "), m);
|
||||
```"),
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn rotate_left(self, n: u32) -> Self {
|
||||
(self as $UnsignedT).rotate_left(n) as Self
|
||||
}
|
||||
}
|
||||
|
||||
/// Shifts the bits to the right by a specified amount, `n`,
|
||||
/// wrapping the truncated bits to the beginning of the resulting
|
||||
/// integer.
|
||||
///
|
||||
/// Please note this isn't the same operation as `>>`!
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Please note that this example is shared between integer types.
|
||||
/// Which explains why `i64` is used here.
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// let n = 0x0123456789ABCDEFi64;
|
||||
/// let m = -0xFEDCBA987654322i64;
|
||||
///
|
||||
/// assert_eq!(n.rotate_right(4), m);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn rotate_right(self, n: u32) -> Self {
|
||||
(self as $UnsignedT).rotate_right(n) as Self
|
||||
}
|
||||
doc_comment! {
|
||||
concat!("Shifts the bits to the right by a specified amount, `n`,
|
||||
wrapping the truncated bits to the beginning of the resulting
|
||||
integer.
|
||||
|
||||
Please note this isn't the same operation as `>>`!
|
||||
|
||||
# Examples
|
||||
|
||||
Basic usage:
|
||||
|
||||
```
|
||||
let n = ", $rot_result, stringify!($SelfT), ";
|
||||
let m = ", $rot_op, ";
|
||||
|
||||
assert_eq!(n.rotate_right(", $rot, "), m);
|
||||
```"),
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn rotate_right(self, n: u32) -> Self {
|
||||
(self as $UnsignedT).rotate_right(n) as Self
|
||||
}
|
||||
}
|
||||
/// Reverses the byte order of the integer.
|
||||
///
|
||||
/// # Examples
|
||||
@ -2012,46 +2009,50 @@ $EndFeature, "
|
||||
|
||||
#[lang = "i8"]
|
||||
impl i8 {
|
||||
int_impl! { i8, i8, u8, 8, -128, 127, "", "" }
|
||||
int_impl! { i8, i8, u8, 8, -128, 127, "", "", 2, "-0x7e", "0xa" }
|
||||
}
|
||||
|
||||
#[lang = "i16"]
|
||||
impl i16 {
|
||||
int_impl! { i16, i16, u16, 16, -32768, 32767, "", "" }
|
||||
int_impl! { i16, i16, u16, 16, -32768, 32767, "", "", 4, "-0x5ffd", "0x3a" }
|
||||
}
|
||||
|
||||
#[lang = "i32"]
|
||||
impl i32 {
|
||||
int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, "", "" }
|
||||
int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, "", "", 8, "0x10000b3", "0xb301" }
|
||||
}
|
||||
|
||||
#[lang = "i64"]
|
||||
impl i64 {
|
||||
int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "" }
|
||||
int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "", 12,
|
||||
"0xaa00000000006e1", "0x6e10aa" }
|
||||
}
|
||||
|
||||
#[lang = "i128"]
|
||||
impl i128 {
|
||||
int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
|
||||
170141183460469231731687303715884105727, "", "" }
|
||||
170141183460469231731687303715884105727, "", "", 16,
|
||||
"0x13f40000000000000000000000004f76", "0x4f7613f4"
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
#[lang = "isize"]
|
||||
impl isize {
|
||||
int_impl! { isize, i16, u16, 16, -32768, 32767, "", "" }
|
||||
int_impl! { isize, i16, u16, 16, -32768, 32767, "", "", 4, "-0x5ffd", "0x3a" }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[lang = "isize"]
|
||||
impl isize {
|
||||
int_impl! { isize, i32, u32, 32, -2147483648, 2147483647, "", "" }
|
||||
int_impl! { isize, i32, u32, 32, -2147483648, 2147483647, "", "", 8, "0x10000b3", "0xb301" }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[lang = "isize"]
|
||||
impl isize {
|
||||
int_impl! { isize, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "" }
|
||||
int_impl! { isize, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "",
|
||||
12, "0xaa00000000006e1", "0x6e10aa" }
|
||||
}
|
||||
|
||||
// Emits the correct `cttz` call, depending on the size of the type.
|
||||
@ -2069,7 +2070,8 @@ macro_rules! uint_cttz_call {
|
||||
|
||||
// `Int` + `UnsignedInt` implemented for unsigned integers
|
||||
macro_rules! uint_impl {
|
||||
($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr, $Feature:expr, $EndFeature:expr) => {
|
||||
($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr, $Feature:expr, $EndFeature:expr,
|
||||
$rot:expr, $rot_op:expr, $rot_result:expr) => {
|
||||
doc_comment! {
|
||||
concat!("Returns the smallest value that can be represented by this integer type.
|
||||
|
||||
@ -2210,57 +2212,55 @@ assert_eq!(n.trailing_zeros(), 3);", $EndFeature, "
|
||||
}
|
||||
}
|
||||
|
||||
/// Shifts the bits to the left by a specified amount, `n`,
|
||||
/// wrapping the truncated bits to the end of the resulting integer.
|
||||
///
|
||||
/// Please note this isn't the same operation as `<<`!
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// Please note that this example is shared between integer types.
|
||||
/// Which explains why `u64` is used here.
|
||||
///
|
||||
/// ```
|
||||
/// let n = 0x0123456789ABCDEFu64;
|
||||
/// let m = 0x3456789ABCDEF012u64;
|
||||
///
|
||||
/// assert_eq!(n.rotate_left(12), m);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn rotate_left(self, n: u32) -> Self {
|
||||
// Protect against undefined behaviour for over-long bit shifts
|
||||
let n = n % $BITS;
|
||||
(self << n) | (self >> (($BITS - n) % $BITS))
|
||||
doc_comment! {
|
||||
concat!("Shifts the bits to the left by a specified amount, `n`,
|
||||
wrapping the truncated bits to the end of the resulting integer.
|
||||
|
||||
Please note this isn't the same operation as `<<`!
|
||||
|
||||
# Examples
|
||||
|
||||
Basic usage:
|
||||
|
||||
```
|
||||
let n = ", $rot_op, stringify!($SelfT), ";
|
||||
let m = ", $rot_result, ";
|
||||
|
||||
assert_eq!(n.rotate_left(", $rot, "), m);
|
||||
```"),
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn rotate_left(self, n: u32) -> Self {
|
||||
// Protect against undefined behaviour for over-long bit shifts
|
||||
let n = n % $BITS;
|
||||
(self << n) | (self >> (($BITS - n) % $BITS))
|
||||
}
|
||||
}
|
||||
|
||||
/// Shifts the bits to the right by a specified amount, `n`,
|
||||
/// wrapping the truncated bits to the beginning of the resulting
|
||||
/// integer.
|
||||
///
|
||||
/// Please note this isn't the same operation as `>>`!
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// Please note that this example is shared between integer types.
|
||||
/// Which explains why `u64` is used here.
|
||||
///
|
||||
/// ```
|
||||
/// let n = 0x0123456789ABCDEFu64;
|
||||
/// let m = 0xDEF0123456789ABCu64;
|
||||
///
|
||||
/// assert_eq!(n.rotate_right(12), m);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn rotate_right(self, n: u32) -> Self {
|
||||
// Protect against undefined behaviour for over-long bit shifts
|
||||
let n = n % $BITS;
|
||||
(self >> n) | (self << (($BITS - n) % $BITS))
|
||||
doc_comment! {
|
||||
concat!("Shifts the bits to the right by a specified amount, `n`,
|
||||
wrapping the truncated bits to the beginning of the resulting
|
||||
integer.
|
||||
|
||||
Please note this isn't the same operation as `>>`!
|
||||
|
||||
# Examples
|
||||
|
||||
Basic usage:
|
||||
|
||||
```
|
||||
let n = ", $rot_result, stringify!($SelfT), ";
|
||||
let m = ", $rot_op, ";
|
||||
|
||||
assert_eq!(n.rotate_right(", $rot, "), m);
|
||||
```"),
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn rotate_right(self, n: u32) -> Self {
|
||||
// Protect against undefined behaviour for over-long bit shifts
|
||||
let n = n % $BITS;
|
||||
(self >> n) | (self << (($BITS - n) % $BITS))
|
||||
}
|
||||
}
|
||||
|
||||
/// Reverses the byte order of the integer.
|
||||
@ -3621,7 +3621,7 @@ $EndFeature, "
|
||||
|
||||
#[lang = "u8"]
|
||||
impl u8 {
|
||||
uint_impl! { u8, u8, 8, 255, "", "" }
|
||||
uint_impl! { u8, u8, 8, 255, "", "", 2, "0x82", "0xa" }
|
||||
|
||||
|
||||
/// Checks if the value is within the ASCII range.
|
||||
@ -4147,39 +4147,41 @@ impl u8 {
|
||||
|
||||
#[lang = "u16"]
|
||||
impl u16 {
|
||||
uint_impl! { u16, u16, 16, 65535, "", "" }
|
||||
uint_impl! { u16, u16, 16, 65535, "", "", 4, "0xa003", "0x3a" }
|
||||
}
|
||||
|
||||
#[lang = "u32"]
|
||||
impl u32 {
|
||||
uint_impl! { u32, u32, 32, 4294967295, "", "" }
|
||||
uint_impl! { u32, u32, 32, 4294967295, "", "", 8, "0x10000b3", "0xb301" }
|
||||
}
|
||||
|
||||
#[lang = "u64"]
|
||||
impl u64 {
|
||||
uint_impl! { u64, u64, 64, 18446744073709551615, "", "" }
|
||||
uint_impl! { u64, u64, 64, 18446744073709551615, "", "", 12, "0xaa00000000006e1", "0x6e10aa" }
|
||||
}
|
||||
|
||||
#[lang = "u128"]
|
||||
impl u128 {
|
||||
uint_impl! { u128, u128, 128, 340282366920938463463374607431768211455, "", "" }
|
||||
uint_impl! { u128, u128, 128, 340282366920938463463374607431768211455, "", "", 16,
|
||||
"0x13f40000000000000000000000004f76", "0x4f7613f4" }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
#[lang = "usize"]
|
||||
impl usize {
|
||||
uint_impl! { usize, u16, 16, 65536, "", "" }
|
||||
uint_impl! { usize, u16, 16, 65536, "", "", 4, "0xa003", "0x3a" }
|
||||
}
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[lang = "usize"]
|
||||
impl usize {
|
||||
uint_impl! { usize, u32, 32, 4294967295, "", "" }
|
||||
uint_impl! { usize, u32, 32, 4294967295, "", "", 8, "0x10000b3", "0xb301" }
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[lang = "usize"]
|
||||
impl usize {
|
||||
uint_impl! { usize, u64, 64, 18446744073709551615, "", "" }
|
||||
uint_impl! { usize, u64, 64, 18446744073709551615, "", "", 12, "0xaa00000000006e1",
|
||||
"0x6e10aa" }
|
||||
}
|
||||
|
||||
/// A classification of floating point numbers.
|
||||
|
@ -1141,6 +1141,7 @@ unsafe impl<'a, A> TrustedLen for Iter<'a, A> {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, A> Clone for Iter<'a, A> {
|
||||
#[inline]
|
||||
fn clone(&self) -> Iter<'a, A> {
|
||||
Iter { inner: self.inner.clone() }
|
||||
}
|
||||
@ -1307,14 +1308,17 @@ impl<T> ops::Try for Option<T> {
|
||||
type Ok = T;
|
||||
type Error = NoneError;
|
||||
|
||||
#[inline]
|
||||
fn into_result(self) -> Result<T, NoneError> {
|
||||
self.ok_or(NoneError)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_ok(v: T) -> Self {
|
||||
Some(v)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_error(_: NoneError) -> Self {
|
||||
None
|
||||
}
|
||||
|
@ -1084,6 +1084,7 @@ unsafe impl<'a, A> TrustedLen for Iter<'a, A> {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> Clone for Iter<'a, T> {
|
||||
#[inline]
|
||||
fn clone(&self) -> Iter<'a, T> { Iter { inner: self.inner } }
|
||||
}
|
||||
|
||||
@ -1235,14 +1236,17 @@ impl<T,E> ops::Try for Result<T, E> {
|
||||
type Ok = T;
|
||||
type Error = E;
|
||||
|
||||
#[inline]
|
||||
fn into_result(self) -> Self {
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_ok(v: T) -> Self {
|
||||
Ok(v)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_error(v: E) -> Self {
|
||||
Err(v)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
//!
|
||||
//! [`Ordering`]: enum.Ordering.html
|
||||
//!
|
||||
//! [1]: http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations
|
||||
//! [1]: https://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations
|
||||
//! [2]: ../../../nomicon/atomics.html
|
||||
//!
|
||||
//! Atomic variables are safe to share between threads (they implement [`Sync`])
|
||||
@ -178,7 +178,7 @@ unsafe impl<T> Sync for AtomicPtr<T> {}
|
||||
/// "relaxed" atomics allow all reorderings.
|
||||
///
|
||||
/// Rust's memory orderings are [the same as
|
||||
/// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations).
|
||||
/// LLVM's](https://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations).
|
||||
///
|
||||
/// For more information see the [nomicon].
|
||||
///
|
||||
@ -190,35 +190,70 @@ pub enum Ordering {
|
||||
///
|
||||
/// Corresponds to LLVM's [`Monotonic`] ordering.
|
||||
///
|
||||
/// [`Monotonic`]: http://llvm.org/docs/Atomics.html#monotonic
|
||||
/// [`Monotonic`]: https://llvm.org/docs/Atomics.html#monotonic
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Relaxed,
|
||||
/// When coupled with a store, all previous writes become visible
|
||||
/// to the other threads that perform a load with [`Acquire`] ordering
|
||||
/// on the same value.
|
||||
/// When coupled with a store, all previous operations become ordered
|
||||
/// before any load of this value with [`Acquire`] (or stronger) ordering.
|
||||
/// In particular, all previous writes become visible to all threads
|
||||
/// that perform an [`Acquire`] (or stronger) load of this value.
|
||||
///
|
||||
/// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
|
||||
/// Notice that using this ordering for an operation that combines loads
|
||||
/// and stores leads to a [`Relaxed`] load operation!
|
||||
///
|
||||
/// This ordering is only applicable for operations that can perform a store.
|
||||
///
|
||||
/// Corresponds to LLVM's [`Release`] ordering.
|
||||
///
|
||||
/// [`Release`]: https://llvm.org/docs/Atomics.html#release
|
||||
/// [`Acquire`]: https://llvm.org/docs/Atomics.html#acquire
|
||||
/// [`Relaxed`]: https://llvm.org/docs/Atomics.html#monotonic
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Release,
|
||||
/// When coupled with a load, all subsequent loads will see data
|
||||
/// written before a store with [`Release`] ordering on the same value
|
||||
/// in other threads.
|
||||
/// When coupled with a load, if the loaded value was written by a store operation with
|
||||
/// [`Release`] (or stronger) ordering, then all subsequent operations
|
||||
/// become ordered after that store. In particular, all subsequent loads will see data
|
||||
/// written before the store.
|
||||
///
|
||||
/// [`Release`]: http://llvm.org/docs/Atomics.html#release
|
||||
/// Notice that using this ordering for an operation that combines loads
|
||||
/// and stores leads to a [`Relaxed`] store operation!
|
||||
///
|
||||
/// This ordering is only applicable for operations that can perform a load.
|
||||
///
|
||||
/// Corresponds to LLVM's [`Acquire`] ordering.
|
||||
///
|
||||
/// [`Acquire`]: https://llvm.org/docs/Atomics.html#acquire
|
||||
/// [`Release`]: https://llvm.org/docs/Atomics.html#release
|
||||
/// [`Relaxed`]: https://llvm.org/docs/Atomics.html#monotonic
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
Acquire,
|
||||
/// Has the effects of both [`Acquire`] and [`Release`] together.
|
||||
/// Has the effects of both [`Acquire`] and [`Release`] together:
|
||||
/// For loads it uses [`Acquire`] ordering. For stores it uses the [`Release`] ordering.
|
||||
///
|
||||
/// Notice that in the case of `compare_and_swap`, it is possible that the operation ends up
|
||||
/// not performing any store and hence it has just `Acquire` ordering. However,
|
||||
/// `AcqRel` will never perform [`Relaxed`] accesses.
|
||||
///
|
||||
/// This ordering is only applicable for operations that combine both loads and stores.
|
||||
///
|
||||
/// For loads it uses [`Acquire`] ordering. For stores it uses the [`Release`] ordering.
|
||||
/// Corresponds to LLVM's [`AcquireRelease`] ordering.
|
||||
///
|
||||
/// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
|
||||
/// [`Release`]: http://llvm.org/docs/Atomics.html#release
|
||||
/// [`AcquireRelease`]: https://llvm.org/docs/Atomics.html#acquirerelease
|
||||
/// [`Acquire`]: https://llvm.org/docs/Atomics.html#acquire
|
||||
/// [`Release`]: https://llvm.org/docs/Atomics.html#release
|
||||
/// [`Relaxed`]: https://llvm.org/docs/Atomics.html#monotonic
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
AcqRel,
|
||||
/// Like `AcqRel` with the additional guarantee that all threads see all
|
||||
/// Like [`Acquire`]/[`Release`]/[`AcqRel`] (for load, store, and load-with-store
|
||||
/// operations, respectively) with the additional guarantee that all threads see all
|
||||
/// sequentially consistent operations in the same order.
|
||||
///
|
||||
/// Corresponds to LLVM's [`SequentiallyConsistent`] ordering.
|
||||
///
|
||||
/// [`SequentiallyConsistent`]: https://llvm.org/docs/Atomics.html#sequentiallyconsistent
|
||||
/// [`Acquire`]: https://llvm.org/docs/Atomics.html#acquire
|
||||
/// [`Release`]: https://llvm.org/docs/Atomics.html#release
|
||||
/// [`AcqRel`]: https://llvm.org/docs/Atomics.html#acquirerelease
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
SeqCst,
|
||||
// Prevent exhaustive matching to allow for future extension
|
||||
@ -297,15 +332,18 @@ impl AtomicBool {
|
||||
/// Loads a value from the bool.
|
||||
///
|
||||
/// `load` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation.
|
||||
/// of this operation. Possible values are [`SeqCst`], [`Acquire`] and [`Relaxed`].
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `order` is [`Release`] or [`AcqRel`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -325,9 +363,18 @@ impl AtomicBool {
|
||||
/// Stores a value into the bool.
|
||||
///
|
||||
/// `store` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation.
|
||||
/// of this operation. Possible values are [`SeqCst`], [`Release`] and [`Relaxed`].
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `order` is [`Acquire`] or [`AcqRel`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -339,13 +386,6 @@ impl AtomicBool {
|
||||
/// some_bool.store(false, Ordering::Relaxed);
|
||||
/// assert_eq!(some_bool.load(Ordering::Relaxed), false);
|
||||
/// ```
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `order` is [`Acquire`] or [`AcqRel`].
|
||||
///
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn store(&self, val: bool, order: Ordering) {
|
||||
@ -357,9 +397,14 @@ impl AtomicBool {
|
||||
/// Stores a value into the bool, returning the previous value.
|
||||
///
|
||||
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation.
|
||||
/// of this operation. All ordering modes are possible. Note that using
|
||||
/// [`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
/// using [`Release`] makes the load part [`Relaxed`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -384,9 +429,16 @@ impl AtomicBool {
|
||||
/// was updated.
|
||||
///
|
||||
/// `compare_and_swap` also takes an [`Ordering`] argument which describes the memory
|
||||
/// ordering of this operation.
|
||||
/// ordering of this operation. Notice that even when using [`AcqRel`], the operation
|
||||
/// might fail and hence just perform an `Acquire` load, but not have `Release` semantics.
|
||||
/// Using [`Acquire`] makes the store part of this operation [`Relaxed`] if it
|
||||
/// happens, and using [`Release`] makes the load part [`Relaxed`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
/// [`bool`]: ../../../std/primitive.bool.html
|
||||
///
|
||||
/// # Examples
|
||||
@ -420,13 +472,18 @@ impl AtomicBool {
|
||||
/// `compare_exchange` takes two [`Ordering`] arguments to describe the memory
|
||||
/// ordering of this operation. The first describes the required ordering if the
|
||||
/// operation succeeds while the second describes the required ordering when the
|
||||
/// operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and must
|
||||
/// be equivalent or weaker than the success ordering.
|
||||
/// operation fails. Using [`Acquire`] as success ordering makes the store part
|
||||
/// of this operation [`Relaxed`], and using [`Release`] makes the successful load
|
||||
/// [`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
|
||||
/// and must be equivalent to or weaker than the success ordering.
|
||||
///
|
||||
///
|
||||
/// [`bool`]: ../../../std/primitive.bool.html
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -473,16 +530,20 @@ impl AtomicBool {
|
||||
/// previous value.
|
||||
///
|
||||
/// `compare_exchange_weak` takes two [`Ordering`] arguments to describe the memory
|
||||
/// ordering of this operation. The first describes the required ordering if the operation
|
||||
/// succeeds while the second describes the required ordering when the operation fails. The
|
||||
/// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or
|
||||
/// weaker than the success ordering.
|
||||
/// ordering of this operation. The first describes the required ordering if the
|
||||
/// operation succeeds while the second describes the required ordering when the
|
||||
/// operation fails. Using [`Acquire`] as success ordering makes the store part
|
||||
/// of this operation [`Relaxed`], and using [`Release`] makes the successful load
|
||||
/// [`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
|
||||
/// and must be equivalent to or weaker than the success ordering.
|
||||
///
|
||||
/// [`bool`]: ../../../std/primitive.bool.html
|
||||
/// [`compare_exchange`]: #method.compare_exchange
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -523,6 +584,16 @@ impl AtomicBool {
|
||||
///
|
||||
/// Returns the previous value.
|
||||
///
|
||||
/// `fetch_and` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation. All ordering modes are possible. Note that using
|
||||
/// [`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
/// using [`Release`] makes the load part [`Relaxed`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
@ -554,6 +625,16 @@ impl AtomicBool {
|
||||
///
|
||||
/// Returns the previous value.
|
||||
///
|
||||
/// `fetch_nand` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation. All ordering modes are possible. Note that using
|
||||
/// [`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
/// using [`Release`] makes the load part [`Relaxed`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
@ -598,6 +679,16 @@ impl AtomicBool {
|
||||
///
|
||||
/// Returns the previous value.
|
||||
///
|
||||
/// `fetch_or` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation. All ordering modes are possible. Note that using
|
||||
/// [`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
/// using [`Release`] makes the load part [`Relaxed`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
@ -629,6 +720,16 @@ impl AtomicBool {
|
||||
///
|
||||
/// Returns the previous value.
|
||||
///
|
||||
/// `fetch_xor` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation. All ordering modes are possible. Note that using
|
||||
/// [`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
/// using [`Release`] makes the load part [`Relaxed`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
@ -714,15 +815,18 @@ impl<T> AtomicPtr<T> {
|
||||
/// Loads a value from the pointer.
|
||||
///
|
||||
/// `load` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation.
|
||||
/// of this operation. Possible values are [`SeqCst`], [`Acquire`] and [`Relaxed`].
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `order` is [`Release`] or [`AcqRel`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -743,9 +847,18 @@ impl<T> AtomicPtr<T> {
|
||||
/// Stores a value into the pointer.
|
||||
///
|
||||
/// `store` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation.
|
||||
/// of this operation. Possible values are [`SeqCst`], [`Release`] and [`Relaxed`].
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `order` is [`Acquire`] or [`AcqRel`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -759,13 +872,6 @@ impl<T> AtomicPtr<T> {
|
||||
///
|
||||
/// some_ptr.store(other_ptr, Ordering::Relaxed);
|
||||
/// ```
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `order` is [`Acquire`] or [`AcqRel`].
|
||||
///
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn store(&self, ptr: *mut T, order: Ordering) {
|
||||
@ -777,9 +883,14 @@ impl<T> AtomicPtr<T> {
|
||||
/// Stores a value into the pointer, returning the previous value.
|
||||
///
|
||||
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
|
||||
/// of this operation.
|
||||
/// of this operation. All ordering modes are possible. Note that using
|
||||
/// [`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
/// using [`Release`] makes the load part [`Relaxed`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -806,9 +917,16 @@ impl<T> AtomicPtr<T> {
|
||||
/// was updated.
|
||||
///
|
||||
/// `compare_and_swap` also takes an [`Ordering`] argument which describes the memory
|
||||
/// ordering of this operation.
|
||||
/// ordering of this operation. Notice that even when using [`AcqRel`], the operation
|
||||
/// might fail and hence just perform an `Acquire` load, but not have `Release` semantics.
|
||||
/// Using [`Acquire`] makes the store part of this operation [`Relaxed`] if it
|
||||
/// happens, and using [`Release`] makes the load part [`Relaxed`].
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -839,14 +957,18 @@ impl<T> AtomicPtr<T> {
|
||||
/// the previous value. On success this value is guaranteed to be equal to `current`.
|
||||
///
|
||||
/// `compare_exchange` takes two [`Ordering`] arguments to describe the memory
|
||||
/// ordering of this operation. The first describes the required ordering if
|
||||
/// the operation succeeds while the second describes the required ordering when
|
||||
/// the operation fails. The failure ordering can't be [`Release`] or [`AcqRel`]
|
||||
/// and must be equivalent or weaker than the success ordering.
|
||||
/// ordering of this operation. The first describes the required ordering if the
|
||||
/// operation succeeds while the second describes the required ordering when the
|
||||
/// operation fails. Using [`Acquire`] as success ordering makes the store part
|
||||
/// of this operation [`Relaxed`], and using [`Release`] makes the successful load
|
||||
/// [`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
|
||||
/// and must be equivalent to or weaker than the success ordering.
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -892,15 +1014,19 @@ impl<T> AtomicPtr<T> {
|
||||
/// previous value.
|
||||
///
|
||||
/// `compare_exchange_weak` takes two [`Ordering`] arguments to describe the memory
|
||||
/// ordering of this operation. The first describes the required ordering if the operation
|
||||
/// succeeds while the second describes the required ordering when the operation fails. The
|
||||
/// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or
|
||||
/// weaker than the success ordering.
|
||||
/// ordering of this operation. The first describes the required ordering if the
|
||||
/// operation succeeds while the second describes the required ordering when the
|
||||
/// operation fails. Using [`Acquire`] as success ordering makes the store part
|
||||
/// of this operation [`Relaxed`], and using [`Release`] makes the successful load
|
||||
/// [`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
|
||||
/// and must be equivalent to or weaker than the success ordering.
|
||||
///
|
||||
/// [`compare_exchange`]: #method.compare_exchange
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -1077,14 +1203,18 @@ assert_eq!(some_var.into_inner(), 5);
|
||||
concat!("Loads a value from the atomic integer.
|
||||
|
||||
`load` takes an [`Ordering`] argument which describes the memory ordering of this operation.
|
||||
Possible values are [`SeqCst`], [`Acquire`] and [`Relaxed`].
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if `order` is [`Release`] or [`AcqRel`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
[`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
[`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
|
||||
# Examples
|
||||
|
||||
@ -1106,8 +1236,18 @@ assert_eq!(some_var.load(Ordering::Relaxed), 5);
|
||||
concat!("Stores a value into the atomic integer.
|
||||
|
||||
`store` takes an [`Ordering`] argument which describes the memory ordering of this operation.
|
||||
Possible values are [`SeqCst`], [`Release`] and [`Relaxed`].
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if `order` is [`Acquire`] or [`AcqRel`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
[`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
[`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
|
||||
# Examples
|
||||
|
||||
@ -1118,14 +1258,7 @@ let some_var = ", stringify!($atomic_type), "::new(5);
|
||||
|
||||
some_var.store(10, Ordering::Relaxed);
|
||||
assert_eq!(some_var.load(Ordering::Relaxed), 10);
|
||||
```
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if `order` is [`Acquire`] or [`AcqRel`].
|
||||
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
[`AcqRel`]: enum.Ordering.html#variant.AcqRel"),
|
||||
```"),
|
||||
#[inline]
|
||||
#[$stable]
|
||||
pub fn store(&self, val: $int_type, order: Ordering) {
|
||||
@ -1136,9 +1269,15 @@ Panics if `order` is [`Acquire`] or [`AcqRel`].
|
||||
doc_comment! {
|
||||
concat!("Stores a value into the atomic integer, returning the previous value.
|
||||
|
||||
`swap` takes an [`Ordering`] argument which describes the memory ordering of this operation.
|
||||
`swap` takes an [`Ordering`] argument which describes the memory ordering
|
||||
of this operation. All ordering modes are possible. Note that using
|
||||
[`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
|
||||
# Examples
|
||||
|
||||
@ -1165,9 +1304,16 @@ The return value is always the previous value. If it is equal to `current`, then
|
||||
value was updated.
|
||||
|
||||
`compare_and_swap` also takes an [`Ordering`] argument which describes the memory
|
||||
ordering of this operation.
|
||||
ordering of this operation. Notice that even when using [`AcqRel`], the operation
|
||||
might fail and hence just perform an `Acquire` load, but not have `Release` semantics.
|
||||
Using [`Acquire`] makes the store part of this operation [`Relaxed`] if it
|
||||
happens, and using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
[`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
|
||||
# Examples
|
||||
|
||||
@ -1208,14 +1354,18 @@ containing the previous value. On success this value is guaranteed to be equal t
|
||||
`current`.
|
||||
|
||||
`compare_exchange` takes two [`Ordering`] arguments to describe the memory
|
||||
ordering of this operation. The first describes the required ordering if
|
||||
the operation succeeds while the second describes the required ordering when
|
||||
the operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and
|
||||
must be equivalent or weaker than the success ordering.
|
||||
ordering of this operation. The first describes the required ordering if the
|
||||
operation succeeds while the second describes the required ordering when the
|
||||
operation fails. Using [`Acquire`] as success ordering makes the store part
|
||||
of this operation [`Relaxed`], and using [`Release`] makes the successful load
|
||||
[`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
|
||||
and must be equivalent to or weaker than the success ordering.
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
[`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
|
||||
# Examples
|
||||
|
||||
@ -1260,13 +1410,17 @@ written and containing the previous value.
|
||||
`compare_exchange_weak` takes two [`Ordering`] arguments to describe the memory
|
||||
ordering of this operation. The first describes the required ordering if the
|
||||
operation succeeds while the second describes the required ordering when the
|
||||
operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and
|
||||
must be equivalent or weaker than the success ordering.
|
||||
operation fails. Using [`Acquire`] as success ordering makes the store part
|
||||
of this operation [`Relaxed`], and using [`Release`] makes the successful load
|
||||
[`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
|
||||
and must be equivalent to or weaker than the success ordering.
|
||||
|
||||
[`compare_exchange`]: #method.compare_exchange
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`AcqRel`]: enum.Ordering.html#variant.AcqRel
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
[`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
|
||||
# Examples
|
||||
|
||||
@ -1302,6 +1456,16 @@ loop {
|
||||
|
||||
This operation wraps around on overflow.
|
||||
|
||||
`fetch_add` takes an [`Ordering`] argument which describes the memory ordering
|
||||
of this operation. All ordering modes are possible. Note that using
|
||||
[`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
|
||||
# Examples
|
||||
|
||||
```
|
||||
@ -1323,6 +1487,16 @@ assert_eq!(foo.load(Ordering::SeqCst), 10);
|
||||
|
||||
This operation wraps around on overflow.
|
||||
|
||||
`fetch_sub` takes an [`Ordering`] argument which describes the memory ordering
|
||||
of this operation. All ordering modes are possible. Note that using
|
||||
[`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
|
||||
# Examples
|
||||
|
||||
```
|
||||
@ -1347,6 +1521,16 @@ sets the new value to the result.
|
||||
|
||||
Returns the previous value.
|
||||
|
||||
`fetch_and` takes an [`Ordering`] argument which describes the memory ordering
|
||||
of this operation. All ordering modes are possible. Note that using
|
||||
[`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
|
||||
# Examples
|
||||
|
||||
```
|
||||
@ -1371,6 +1555,16 @@ sets the new value to the result.
|
||||
|
||||
Returns the previous value.
|
||||
|
||||
`fetch_nand` takes an [`Ordering`] argument which describes the memory ordering
|
||||
of this operation. All ordering modes are possible. Note that using
|
||||
[`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
|
||||
# Examples
|
||||
|
||||
```
|
||||
@ -1396,6 +1590,16 @@ sets the new value to the result.
|
||||
|
||||
Returns the previous value.
|
||||
|
||||
`fetch_or` takes an [`Ordering`] argument which describes the memory ordering
|
||||
of this operation. All ordering modes are possible. Note that using
|
||||
[`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
|
||||
# Examples
|
||||
|
||||
```
|
||||
@ -1420,6 +1624,16 @@ sets the new value to the result.
|
||||
|
||||
Returns the previous value.
|
||||
|
||||
`fetch_xor` takes an [`Ordering`] argument which describes the memory ordering
|
||||
of this operation. All ordering modes are possible. Note that using
|
||||
[`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
|
||||
# Examples
|
||||
|
||||
```
|
||||
@ -1445,6 +1659,25 @@ Note: This may call the function multiple times if the value has been changed fr
|
||||
the meantime, as long as the function returns `Some(_)`, but the function will have been applied
|
||||
but once to the stored value.
|
||||
|
||||
`fetch_update` takes two [`Ordering`] arguments to describe the memory
|
||||
ordering of this operation. The first describes the required ordering for loads
|
||||
and failed updates while the second describes the required ordering when the
|
||||
operation finally succeeds. Beware that this is different from the two
|
||||
modes in [`compare_exchange`]!
|
||||
|
||||
Using [`Acquire`] as success ordering makes the store part
|
||||
of this operation [`Relaxed`], and using [`Release`] makes the final successful load
|
||||
[`Relaxed`]. The (failed) load ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
|
||||
and must be equivalent to or weaker than the success ordering.
|
||||
|
||||
[`bool`]: ../../../std/primitive.bool.html
|
||||
[`compare_exchange`]: #method.compare_exchange
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
[`SeqCst`]: enum.Ordering.html#variant.SeqCst
|
||||
|
||||
# Examples
|
||||
|
||||
```rust
|
||||
@ -1485,6 +1718,16 @@ sets the new value to the result.
|
||||
|
||||
Returns the previous value.
|
||||
|
||||
`fetch_max` takes an [`Ordering`] argument which describes the memory ordering
|
||||
of this operation. All ordering modes are possible. Note that using
|
||||
[`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
|
||||
# Examples
|
||||
|
||||
```
|
||||
@ -1524,6 +1767,16 @@ sets the new value to the result.
|
||||
|
||||
Returns the previous value.
|
||||
|
||||
`fetch_min` takes an [`Ordering`] argument which describes the memory ordering
|
||||
of this operation. All ordering modes are possible. Note that using
|
||||
[`Acquire`] makes the store part of this operation [`Relaxed`], and
|
||||
using [`Release`] makes the load part [`Relaxed`].
|
||||
|
||||
[`Ordering`]: enum.Ordering.html
|
||||
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
|
||||
[`Release`]: enum.Ordering.html#variant.Release
|
||||
[`Acquire`]: enum.Ordering.html#variant.Acquire
|
||||
|
||||
# Examples
|
||||
|
||||
```
|
||||
|
@ -20,6 +20,8 @@
|
||||
html_playground_url = "https://play.rust-lang.org/",
|
||||
test(attr(deny(warnings))))]
|
||||
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
|
||||
pub use self::Piece::*;
|
||||
pub use self::Position::*;
|
||||
pub use self::Alignment::*;
|
||||
|
@ -288,6 +288,7 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/",
|
||||
test(attr(allow(unused_variables), deny(warnings))))]
|
||||
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(str_escape)]
|
||||
|
||||
use self::LabelText::*;
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(libc)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(panic_runtime)]
|
||||
#![feature(staged_api)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
@ -34,6 +34,7 @@
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(lang_items)]
|
||||
#![feature(libc)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(panic_unwind)]
|
||||
#![feature(raw)]
|
||||
#![feature(staged_api)]
|
||||
|
@ -681,10 +681,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
&ty::Predicate::RegionOutlives(ref binder) => {
|
||||
if let Err(_) = select
|
||||
.infcx()
|
||||
.region_outlives_predicate(&dummy_cause, binder)
|
||||
{
|
||||
if select.infcx().region_outlives_predicate(&dummy_cause, binder).is_err() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
// Eventually I'll need to implement param-env-aware
|
||||
// `Γ₁ ⊦ φ₁ => Γ₂ ⊦ φ₂` logic.
|
||||
let param_env = ty::ParamEnv::empty();
|
||||
if let Ok(_) = self.can_sub(param_env, error, implication) {
|
||||
if self.can_sub(param_env, error, implication).is_ok() {
|
||||
debug!("error_implies: {:?} -> {:?} -> {:?}", cond, error, implication);
|
||||
return true
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
|
||||
// variables. Process these constraints.
|
||||
let mut fulfill_cx = FulfillmentContext::new();
|
||||
fulfill_cx.register_predicate_obligations(self, result.obligations);
|
||||
if let Err(_) = fulfill_cx.select_all_or_error(self) {
|
||||
if fulfill_cx.select_all_or_error(self).is_err() {
|
||||
self.tcx.sess.delay_span_bug(
|
||||
span,
|
||||
"implied_outlives_bounds failed to solve obligations from instantiation"
|
||||
|
@ -1587,8 +1587,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
||||
-> bool
|
||||
{
|
||||
assert!(!skol_trait_ref.has_escaping_regions());
|
||||
if let Err(_) = self.infcx.at(&obligation.cause, obligation.param_env)
|
||||
.sup(ty::Binder::dummy(skol_trait_ref), trait_bound) {
|
||||
if self.infcx.at(&obligation.cause, obligation.param_env)
|
||||
.sup(ty::Binder::dummy(skol_trait_ref), trait_bound).is_err() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ fn resolve_associated_item<'a, 'tcx>(
|
||||
})
|
||||
}
|
||||
traits::VtableBuiltin(..) => {
|
||||
if let Some(_) = tcx.lang_items().clone_trait() {
|
||||
if tcx.lang_items().clone_trait().is_some() {
|
||||
Some(Instance {
|
||||
def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
|
||||
substs: rcvr_substs
|
||||
|
@ -45,6 +45,7 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(try_from)]
|
||||
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
|
||||
#[allow(unused_extern_crates)]
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#![sanitizer_runtime]
|
||||
#![feature(alloc_system)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(sanitizer_runtime)]
|
||||
#![feature(staged_api)]
|
||||
#![no_std]
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(quote)]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
|
@ -169,6 +169,10 @@ const MIPS_WHITELIST: &[(&str, Option<&str>)] = &[
|
||||
("msa", Some("mips_target_feature")),
|
||||
];
|
||||
|
||||
const WASM_WHITELIST: &[(&str, Option<&str>)] = &[
|
||||
("simd128", Some("wasm_target_feature")),
|
||||
];
|
||||
|
||||
/// When rustdoc is running, provide a list of all known features so that all their respective
|
||||
/// primtives may be documented.
|
||||
///
|
||||
@ -181,6 +185,7 @@ pub fn all_known_features() -> impl Iterator<Item=(&'static str, Option<&'static
|
||||
.chain(HEXAGON_WHITELIST.iter().cloned())
|
||||
.chain(POWERPC_WHITELIST.iter().cloned())
|
||||
.chain(MIPS_WHITELIST.iter().cloned())
|
||||
.chain(WASM_WHITELIST.iter().cloned())
|
||||
}
|
||||
|
||||
pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str {
|
||||
@ -228,6 +233,7 @@ pub fn target_feature_whitelist(sess: &Session)
|
||||
"hexagon" => HEXAGON_WHITELIST,
|
||||
"mips" | "mips64" => MIPS_WHITELIST,
|
||||
"powerpc" | "powerpc64" => POWERPC_WHITELIST,
|
||||
"wasm32" => WASM_WHITELIST,
|
||||
_ => &[],
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,7 @@
|
||||
// See Cargo.toml for a comment explaining this crate.
|
||||
#![allow(unused_extern_crates)]
|
||||
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
|
||||
extern crate bitflags;
|
||||
extern crate log;
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#![feature(box_syntax)]
|
||||
#![cfg_attr(unix, feature(libc))]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(option_replace)]
|
||||
#![feature(quote)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
|
@ -1295,7 +1295,7 @@ impl EmitterWriter {
|
||||
}
|
||||
|
||||
// if we elided some lines, add an ellipsis
|
||||
if let Some(_) = lines.next() {
|
||||
if lines.next().is_some() {
|
||||
buffer.puts(row_num, max_line_num_len - 1, "...", Style::LineNumber);
|
||||
} else if !show_underline {
|
||||
draw_col_separator_no_space(&mut buffer, row_num, max_line_num_len + 1);
|
||||
|
@ -16,6 +16,7 @@
|
||||
#![allow(unused_attributes)]
|
||||
#![feature(range_contains)]
|
||||
#![cfg_attr(unix, feature(libc))]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(optin_builtin_traits)]
|
||||
|
||||
extern crate atty;
|
||||
|
@ -14,6 +14,7 @@
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(specialization)]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
|
@ -27,6 +27,7 @@
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(macro_vis_matcher)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(quote)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
#![feature(macro_at_most_once_rep)]
|
||||
|
@ -15,6 +15,7 @@
|
||||
#![feature(box_patterns)]
|
||||
#![feature(libc)]
|
||||
#![feature(macro_at_most_once_rep)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(proc_macro_internals)]
|
||||
#![feature(proc_macro_quote)]
|
||||
#![feature(quote)]
|
||||
|
@ -138,7 +138,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
let tables = self.tcx.typeck_tables_of(id);
|
||||
let node_id = self.tcx.hir.as_local_node_id(id).unwrap();
|
||||
let hir_id = self.tcx.hir.node_to_hir_id(node_id);
|
||||
if let Some(_) = tables.closure_kind_origins().get(hir_id) {
|
||||
if tables.closure_kind_origins().get(hir_id).is_some() {
|
||||
false
|
||||
} else {
|
||||
true
|
||||
@ -735,7 +735,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
|
||||
&including_downcast,
|
||||
)?;
|
||||
buf.push_str("[");
|
||||
if let Err(_) = self.append_local_to_string(index, buf) {
|
||||
if self.append_local_to_string(index, buf).is_err() {
|
||||
buf.push_str("..");
|
||||
}
|
||||
buf.push_str("]");
|
||||
|
@ -18,6 +18,7 @@
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -64,6 +64,7 @@
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
|
||||
#[macro_use] extern crate syntax;
|
||||
|
@ -12,6 +12,7 @@
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
|
@ -13,6 +13,7 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
#![feature(slice_sort_by_cached_key)]
|
||||
|
||||
@ -2698,7 +2699,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
|
||||
self.label_ribs.pop();
|
||||
}
|
||||
self.ribs[ValueNS].pop();
|
||||
if let Some(_) = anonymous_module {
|
||||
if anonymous_module.is_some() {
|
||||
self.ribs[TypeNS].pop();
|
||||
}
|
||||
debug!("(resolving block) leaving block");
|
||||
@ -4256,7 +4257,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
|
||||
|
||||
while let Some((in_module, path_segments)) = worklist.pop() {
|
||||
// abort if the module is already found
|
||||
if let Some(_) = result { break; }
|
||||
if result.is_some() { break; }
|
||||
|
||||
self.populate_module_if_necessary(in_module);
|
||||
|
||||
|
@ -39,7 +39,7 @@ pub struct WriteOutput<'b, W: Write + 'b> {
|
||||
|
||||
impl<'b, W: Write> DumpOutput for WriteOutput<'b, W> {
|
||||
fn dump(&mut self, result: &Analysis) {
|
||||
if let Err(_) = write!(self.output, "{}", as_json(&result)) {
|
||||
if write!(self.output, "{}", as_json(&result)).is_err() {
|
||||
error!("Error writing output");
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
#![feature(custom_attribute)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![allow(unused_attributes)]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
@ -125,7 +126,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
|
||||
result.push(ExternalCrateData {
|
||||
// FIXME: change file_name field to PathBuf in rls-data
|
||||
// https://github.com/nrc/rls-data/issues/7
|
||||
file_name: SpanUtils::make_path_string(&lo_loc.file.name),
|
||||
file_name: self.span_utils.make_path_string(&lo_loc.file.name),
|
||||
num: n.as_u32(),
|
||||
id: GlobalCrateId {
|
||||
name: self.tcx.crate_name(n).to_string(),
|
||||
|
@ -13,7 +13,6 @@ use rustc::session::Session;
|
||||
use generated_code;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::env;
|
||||
|
||||
use syntax::parse::lexer::{self, StringReader};
|
||||
use syntax::parse::token::{self, Token};
|
||||
@ -36,11 +35,10 @@ impl<'a> SpanUtils<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make_path_string(path: &FileName) -> String {
|
||||
pub fn make_path_string(&self, path: &FileName) -> String {
|
||||
match *path {
|
||||
FileName::Real(ref path) if !path.is_absolute() =>
|
||||
env::current_dir()
|
||||
.unwrap()
|
||||
self.sess.working_dir.0
|
||||
.join(&path)
|
||||
.display()
|
||||
.to_string(),
|
||||
|
@ -145,7 +145,7 @@ fn classify_arg_ty<'a, Ty, C>(cx: C, arg: &mut ArgType<'a, Ty>)
|
||||
// Extract first 8 chunks as the prefix
|
||||
let rest_size = size - Size::from_bytes(8) * prefix_index as u64;
|
||||
arg.cast_to(CastTarget {
|
||||
prefix: prefix,
|
||||
prefix,
|
||||
prefix_chunk: Size::from_bytes(8),
|
||||
rest: Uniform { unit: Reg::i64(), total: rest_size }
|
||||
});
|
||||
|
@ -90,7 +90,7 @@ impl ArgAttributes {
|
||||
}
|
||||
|
||||
pub fn set(&mut self, attr: ArgAttribute) -> &mut Self {
|
||||
self.regular = self.regular | attr;
|
||||
self.regular |= attr;
|
||||
self
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ impl CastTarget {
|
||||
|
||||
pub fn align<C: HasDataLayout>(&self, cx: C) -> Align {
|
||||
self.prefix.iter()
|
||||
.filter_map(|x| x.map(|kind| Reg { kind: kind, size: self.prefix_chunk }.align(cx)))
|
||||
.filter_map(|x| x.map(|kind| Reg { kind, size: self.prefix_chunk }.align(cx)))
|
||||
.fold(cx.data_layout().aggregate_align.max(self.rest.align(cx)),
|
||||
|acc, align| acc.max(align))
|
||||
}
|
||||
|
@ -199,10 +199,8 @@ pub fn compute_abi_info<'a, Ty, C>(cx: C, fty: &mut FnType<'a, Ty>)
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
if arg.layout.is_aggregate() {
|
||||
if int_regs < needed_int || sse_regs < needed_sse {
|
||||
cls_or_mem = Err(Memory);
|
||||
}
|
||||
if arg.layout.is_aggregate() && (int_regs < needed_int || sse_regs < needed_sse) {
|
||||
cls_or_mem = Err(Memory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,17 +93,17 @@ impl TargetDataLayout {
|
||||
let mut dl = TargetDataLayout::default();
|
||||
let mut i128_align_src = 64;
|
||||
for spec in target.data_layout.split('-') {
|
||||
match &spec.split(':').collect::<Vec<_>>()[..] {
|
||||
&["e"] => dl.endian = Endian::Little,
|
||||
&["E"] => dl.endian = Endian::Big,
|
||||
&["a", ref a..] => dl.aggregate_align = align(a, "a")?,
|
||||
&["f32", ref a..] => dl.f32_align = align(a, "f32")?,
|
||||
&["f64", ref a..] => dl.f64_align = align(a, "f64")?,
|
||||
&[p @ "p", s, ref a..] | &[p @ "p0", s, ref a..] => {
|
||||
match spec.split(':').collect::<Vec<_>>()[..] {
|
||||
["e"] => dl.endian = Endian::Little,
|
||||
["E"] => dl.endian = Endian::Big,
|
||||
["a", ref a..] => dl.aggregate_align = align(a, "a")?,
|
||||
["f32", ref a..] => dl.f32_align = align(a, "f32")?,
|
||||
["f64", ref a..] => dl.f64_align = align(a, "f64")?,
|
||||
[p @ "p", s, ref a..] | [p @ "p0", s, ref a..] => {
|
||||
dl.pointer_size = size(s, p)?;
|
||||
dl.pointer_align = align(a, p)?;
|
||||
}
|
||||
&[s, ref a..] if s.starts_with("i") => {
|
||||
[s, ref a..] if s.starts_with("i") => {
|
||||
let bits = match s[1..].parse::<u64>() {
|
||||
Ok(bits) => bits,
|
||||
Err(_) => {
|
||||
@ -127,7 +127,7 @@ impl TargetDataLayout {
|
||||
dl.i128_align = a;
|
||||
}
|
||||
}
|
||||
&[s, ref a..] if s.starts_with("v") => {
|
||||
[s, ref a..] if s.starts_with("v") => {
|
||||
let v_size = size(&s[1..], "v")?;
|
||||
let a = align(a, s)?;
|
||||
if let Some(v) = dl.vector_align.iter_mut().find(|v| v.0 == v_size) {
|
||||
@ -429,8 +429,8 @@ pub enum Integer {
|
||||
}
|
||||
|
||||
impl Integer {
|
||||
pub fn size(&self) -> Size {
|
||||
match *self {
|
||||
pub fn size(self) -> Size {
|
||||
match self {
|
||||
I8 => Size::from_bytes(1),
|
||||
I16 => Size::from_bytes(2),
|
||||
I32 => Size::from_bytes(4),
|
||||
@ -439,10 +439,10 @@ impl Integer {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn align<C: HasDataLayout>(&self, cx: C) -> Align {
|
||||
pub fn align<C: HasDataLayout>(self, cx: C) -> Align {
|
||||
let dl = cx.data_layout();
|
||||
|
||||
match *self {
|
||||
match self {
|
||||
I8 => dl.i8_align,
|
||||
I16 => dl.i16_align,
|
||||
I32 => dl.i32_align,
|
||||
@ -522,15 +522,15 @@ impl fmt::Display for FloatTy {
|
||||
}
|
||||
|
||||
impl FloatTy {
|
||||
pub fn ty_to_string(&self) -> &'static str {
|
||||
match *self {
|
||||
pub fn ty_to_string(self) -> &'static str {
|
||||
match self {
|
||||
FloatTy::F32 => "f32",
|
||||
FloatTy::F64 => "f64",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bit_width(&self) -> usize {
|
||||
match *self {
|
||||
pub fn bit_width(self) -> usize {
|
||||
match self {
|
||||
FloatTy::F32 => 32,
|
||||
FloatTy::F64 => 64,
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#![feature(box_syntax)]
|
||||
#![feature(const_fn)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -51,7 +51,7 @@ pub struct AbiData {
|
||||
}
|
||||
|
||||
#[allow(non_upper_case_globals)]
|
||||
const AbiDatas: &'static [AbiData] = &[
|
||||
const AbiDatas: &[AbiData] = &[
|
||||
// Platform-specific ABIs
|
||||
AbiData {abi: Abi::Cdecl, name: "cdecl", generic: false },
|
||||
AbiData {abi: Abi::Stdcall, name: "stdcall", generic: false },
|
||||
@ -87,20 +87,20 @@ pub fn all_names() -> Vec<&'static str> {
|
||||
|
||||
impl Abi {
|
||||
#[inline]
|
||||
pub fn index(&self) -> usize {
|
||||
*self as usize
|
||||
pub fn index(self) -> usize {
|
||||
self as usize
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn data(&self) -> &'static AbiData {
|
||||
pub fn data(self) -> &'static AbiData {
|
||||
&AbiDatas[self.index()]
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &'static str {
|
||||
pub fn name(self) -> &'static str {
|
||||
self.data().name
|
||||
}
|
||||
|
||||
pub fn generic(&self) -> bool {
|
||||
pub fn generic(self) -> bool {
|
||||
self.data().generic
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ pub fn opts() -> TargetOptions {
|
||||
// TLS is flagged as enabled if it looks to be supported.
|
||||
let deployment_target = env::var("MACOSX_DEPLOYMENT_TARGET").ok();
|
||||
let version = deployment_target.as_ref().and_then(|s| {
|
||||
let mut i = s.splitn(2, ".");
|
||||
let mut i = s.splitn(2, '.');
|
||||
i.next().and_then(|a| i.next().map(|b| (a, b)))
|
||||
}).and_then(|(a, b)| {
|
||||
a.parse::<u32>().and_then(|a| b.parse::<u32>().map(|b| (a, b))).ok()
|
||||
|
@ -25,13 +25,13 @@ pub enum Arch {
|
||||
}
|
||||
|
||||
impl Arch {
|
||||
pub fn to_string(&self) -> &'static str {
|
||||
pub fn to_string(self) -> &'static str {
|
||||
match self {
|
||||
&Armv7 => "armv7",
|
||||
&Armv7s => "armv7s",
|
||||
&Arm64 => "arm64",
|
||||
&I386 => "i386",
|
||||
&X86_64 => "x86_64"
|
||||
Armv7 => "armv7",
|
||||
Armv7s => "armv7s",
|
||||
Arm64 => "arm64",
|
||||
I386 => "i386",
|
||||
X86_64 => "x86_64"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -747,7 +747,7 @@ impl Target {
|
||||
/// Maximum integer size in bits that this target can perform atomic
|
||||
/// operations on.
|
||||
pub fn max_atomic_width(&self) -> u64 {
|
||||
self.options.max_atomic_width.unwrap_or(self.target_pointer_width.parse().unwrap())
|
||||
self.options.max_atomic_width.unwrap_or_else(|| self.target_pointer_width.parse().unwrap())
|
||||
}
|
||||
|
||||
pub fn is_abi_supported(&self, abi: Abi) -> bool {
|
||||
@ -777,7 +777,7 @@ impl Target {
|
||||
let get_opt_field = |name: &str, default: &str| {
|
||||
obj.find(name).and_then(|s| s.as_string())
|
||||
.map(|s| s.to_string())
|
||||
.unwrap_or(default.to_string())
|
||||
.unwrap_or_else(|| default.to_string())
|
||||
};
|
||||
|
||||
let mut base = Target {
|
||||
@ -1007,7 +1007,6 @@ impl Target {
|
||||
/// filesystem access and JSON decoding.
|
||||
pub fn search(target_triple: &TargetTriple) -> Result<Target, String> {
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::fs;
|
||||
use serialize::json;
|
||||
|
||||
@ -1018,8 +1017,8 @@ impl Target {
|
||||
Target::from_json(obj)
|
||||
}
|
||||
|
||||
match target_triple {
|
||||
&TargetTriple::TargetTriple(ref target_triple) => {
|
||||
match *target_triple {
|
||||
TargetTriple::TargetTriple(ref target_triple) => {
|
||||
// check if triple is in list of supported targets
|
||||
if let Ok(t) = load_specific(target_triple) {
|
||||
return Ok(t)
|
||||
@ -1032,8 +1031,7 @@ impl Target {
|
||||
PathBuf::from(target)
|
||||
};
|
||||
|
||||
let target_path = env::var_os("RUST_TARGET_PATH")
|
||||
.unwrap_or(OsString::new());
|
||||
let target_path = env::var_os("RUST_TARGET_PATH").unwrap_or_default();
|
||||
|
||||
// FIXME 16351: add a sane default search path?
|
||||
|
||||
@ -1045,7 +1043,7 @@ impl Target {
|
||||
}
|
||||
Err(format!("Could not find specification for target {:?}", target_triple))
|
||||
}
|
||||
&TargetTriple::TargetPath(ref target_path) => {
|
||||
TargetTriple::TargetPath(ref target_path) => {
|
||||
if target_path.is_file() {
|
||||
return load_file(&target_path);
|
||||
}
|
||||
@ -1190,7 +1188,7 @@ impl ToJson for Target {
|
||||
|
||||
if default.abi_blacklist != self.options.abi_blacklist {
|
||||
d.insert("abi-blacklist".to_string(), self.options.abi_blacklist.iter()
|
||||
.map(Abi::name).map(|name| name.to_json())
|
||||
.map(|&name| Abi::name(name).to_json())
|
||||
.collect::<Vec<_>>().to_json());
|
||||
}
|
||||
|
||||
@ -1229,9 +1227,9 @@ impl TargetTriple {
|
||||
///
|
||||
/// If this target is a path, the file name (without extension) is returned.
|
||||
pub fn triple(&self) -> &str {
|
||||
match self {
|
||||
&TargetTriple::TargetTriple(ref triple) => triple,
|
||||
&TargetTriple::TargetPath(ref path) => {
|
||||
match *self {
|
||||
TargetTriple::TargetTriple(ref triple) => triple,
|
||||
TargetTriple::TargetPath(ref path) => {
|
||||
path.file_stem().expect("target path must not be empty").to_str()
|
||||
.expect("target path must be valid unicode")
|
||||
}
|
||||
@ -1247,7 +1245,7 @@ impl TargetTriple {
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
|
||||
let triple = self.triple();
|
||||
if let &TargetTriple::TargetPath(ref path) = self {
|
||||
if let TargetTriple::TargetPath(ref path) = *self {
|
||||
let mut hasher = DefaultHasher::new();
|
||||
path.hash(&mut hasher);
|
||||
let hash = hasher.finish();
|
||||
|
@ -16,6 +16,7 @@
|
||||
#![feature(extern_prelude)]
|
||||
#![feature(iterator_find_map)]
|
||||
#![feature(in_band_lifetimes)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#![sanitizer_runtime]
|
||||
#![feature(alloc_system)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(sanitizer_runtime)]
|
||||
#![feature(staged_api)]
|
||||
#![no_std]
|
||||
|
@ -758,8 +758,9 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
|
||||
self.span, infer::FnCall, &fty);
|
||||
|
||||
if let Some(self_ty) = self_ty {
|
||||
if let Err(_) = self.at(&ObligationCause::dummy(), self.param_env)
|
||||
.sup(fty.inputs()[0], self_ty)
|
||||
if self.at(&ObligationCause::dummy(), self.param_env)
|
||||
.sup(fty.inputs()[0], self_ty)
|
||||
.is_err()
|
||||
{
|
||||
return false
|
||||
}
|
||||
|
@ -3915,7 +3915,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||
|
||||
}
|
||||
hir::ExprKind::Continue(destination) => {
|
||||
if let Ok(_) = destination.target_id {
|
||||
if destination.target_id.is_ok() {
|
||||
tcx.types.never
|
||||
} else {
|
||||
// There was an error, make typecheck fail
|
||||
|
@ -486,7 +486,7 @@ pub fn run_core(search_paths: SearchPaths,
|
||||
&name,
|
||||
&output_filenames,
|
||||
|tcx, analysis, _, result| {
|
||||
if let Err(_) = result {
|
||||
if result.is_err() {
|
||||
sess.fatal("Compilation failed, aborting rustdoc");
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>,
|
||||
write_header(class, &mut out).unwrap();
|
||||
|
||||
let mut classifier = Classifier::new(lexer::StringReader::new(&sess, fm, None), sess.codemap());
|
||||
if let Err(_) = classifier.write_source(&mut out) {
|
||||
if classifier.write_source(&mut out).is_err() {
|
||||
return format!("<pre>{}</pre>", src);
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ impl LangString {
|
||||
data.no_run = true;
|
||||
}
|
||||
x if allow_error_code_check && x.starts_with("E") && x.len() == 5 => {
|
||||
if let Ok(_) = x[1..].parse::<u32>() {
|
||||
if x[1..].parse::<u32>().is_ok() {
|
||||
data.error_codes.push(x.to_owned());
|
||||
seen_rust_tags = !seen_other_tags || seen_rust_tags;
|
||||
} else {
|
||||
|
@ -2208,6 +2208,25 @@
|
||||
};
|
||||
|
||||
autoCollapse(getPageId(), getCurrentValue("rustdoc-collapse") === "true");
|
||||
|
||||
if (window.location.hash && window.location.hash.length > 0) {
|
||||
var hash = getPageId();
|
||||
if (hash !== null) {
|
||||
var elem = document.getElementById(hash);
|
||||
if (elem && elem.offsetParent === null) {
|
||||
console.log(elem, elem.parentNode);
|
||||
if (elem.parentNode && elem.parentNode.previousSibling) {
|
||||
var collapses = elem.parentNode
|
||||
.previousSibling
|
||||
.getElementsByClassName("collapse-toggle");
|
||||
if (collapses.length > 0) {
|
||||
// The element is not visible, we need to make it appear!
|
||||
collapseDocs(collapses[0], "show");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}());
|
||||
|
||||
// Sets the focus on the search bar at the top of the page
|
||||
|
@ -29,6 +29,8 @@ use fmt;
|
||||
all(target_os = "android", any(target_arch = "aarch64",
|
||||
target_arch = "arm")),
|
||||
all(target_os = "l4re", target_arch = "x86_64"),
|
||||
all(target_os = "netbsd", any(target_arch = "arm",
|
||||
target_arch = "powerpc")),
|
||||
all(target_os = "openbsd", target_arch = "aarch64"),
|
||||
all(target_os = "fuchsia", target_arch = "aarch64")))]
|
||||
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8;
|
||||
@ -41,6 +43,8 @@ use fmt;
|
||||
all(target_os = "android", any(target_arch = "aarch64",
|
||||
target_arch = "arm")),
|
||||
all(target_os = "l4re", target_arch = "x86_64"),
|
||||
all(target_os = "netbsd", any(target_arch = "arm",
|
||||
target_arch = "powerpc")),
|
||||
all(target_os = "openbsd", target_arch = "aarch64"),
|
||||
all(target_os = "fuchsia", target_arch = "aarch64"))))]
|
||||
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8;
|
||||
|
@ -181,7 +181,7 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt,
|
||||
for lhs in lhses { // try each arm's matchers
|
||||
let lhs_tt = match *lhs {
|
||||
quoted::TokenTree::Delimited(_, ref delim) => &delim.tts[..],
|
||||
_ => cx.span_bug(sp, "malformed macro lhs")
|
||||
_ => continue,
|
||||
};
|
||||
match TokenTree::parse(cx, lhs_tt, arg.clone()) {
|
||||
Success(_) => {
|
||||
@ -191,7 +191,7 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt,
|
||||
err.span_suggestion_short(
|
||||
comma_span,
|
||||
"missing comma here",
|
||||
",".to_string(),
|
||||
", ".to_string(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -452,6 +452,7 @@ declare_features! (
|
||||
(active, mmx_target_feature, "1.27.0", Some(44839), None),
|
||||
(active, sse4a_target_feature, "1.27.0", Some(44839), None),
|
||||
(active, tbm_target_feature, "1.27.0", Some(44839), None),
|
||||
(active, wasm_target_feature, "1.30.0", Some(44839), None),
|
||||
|
||||
// Allows macro invocations of the form `#[foo::bar]`
|
||||
(active, proc_macro_path_invoc, "1.27.0", Some(38356), None),
|
||||
|
@ -631,7 +631,7 @@ fn path_name_i(idents: &[Ident]) -> String {
|
||||
let mut idents_iter = idents.iter().peekable();
|
||||
while let Some(ident) = idents_iter.next() {
|
||||
path_name.push_str(&ident.as_str());
|
||||
if let Some(_) = idents_iter.peek() {
|
||||
if idents_iter.peek().is_some() {
|
||||
path_name.push_str("::")
|
||||
}
|
||||
}
|
||||
|
@ -186,21 +186,43 @@ impl TokenStream {
|
||||
/// Given a `TokenStream` with a `Stream` of only two arguments, return a new `TokenStream`
|
||||
/// separating the two arguments with a comma for diagnostic suggestions.
|
||||
pub(crate) fn add_comma(&self) -> Option<(TokenStream, Span)> {
|
||||
// Used to suggest if a user writes `println!("{}" a);`
|
||||
// Used to suggest if a user writes `foo!(a b);`
|
||||
if let TokenStreamKind::Stream(ref slice) = self.kind {
|
||||
if slice.len() == 2 {
|
||||
let comma_span = match slice[0] {
|
||||
TokenStream { kind: TokenStreamKind::Tree(TokenTree::Token(sp, _)) } |
|
||||
TokenStream { kind: TokenStreamKind::Tree(TokenTree::Delimited(sp, _)) } => {
|
||||
sp.shrink_to_hi()
|
||||
let mut suggestion = None;
|
||||
let mut iter = slice.iter().enumerate().peekable();
|
||||
while let Some((pos, ts)) = iter.next() {
|
||||
if let Some((_, next)) = iter.peek() {
|
||||
match (ts, next) {
|
||||
(TokenStream {
|
||||
kind: TokenStreamKind::Tree(TokenTree::Token(_, token::Token::Comma))
|
||||
}, _) |
|
||||
(_, TokenStream {
|
||||
kind: TokenStreamKind::Tree(TokenTree::Token(_, token::Token::Comma))
|
||||
}) => {}
|
||||
(TokenStream {
|
||||
kind: TokenStreamKind::Tree(TokenTree::Token(sp, _))
|
||||
}, _) |
|
||||
(TokenStream {
|
||||
kind: TokenStreamKind::Tree(TokenTree::Delimited(sp, _))
|
||||
}, _) => {
|
||||
let sp = sp.shrink_to_hi();
|
||||
let comma = TokenStream {
|
||||
kind: TokenStreamKind::Tree(TokenTree::Token(sp, token::Comma)),
|
||||
};
|
||||
suggestion = Some((pos, comma, sp));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
_ => DUMMY_SP,
|
||||
};
|
||||
let comma = TokenStream {
|
||||
kind: TokenStreamKind::Tree(TokenTree::Token(comma_span, token::Comma)),
|
||||
};
|
||||
let slice = RcSlice::new(vec![slice[0].clone(), comma, slice[1].clone()]);
|
||||
return Some((TokenStream { kind: TokenStreamKind::Stream(slice) }, comma_span));
|
||||
}
|
||||
}
|
||||
if let Some((pos, comma, sp)) = suggestion {
|
||||
let mut new_slice = vec![];
|
||||
let parts = slice.split_at(pos + 1);
|
||||
new_slice.extend_from_slice(parts.0);
|
||||
new_slice.push(comma);
|
||||
new_slice.extend_from_slice(parts.1);
|
||||
let slice = RcSlice::new(new_slice);
|
||||
return Some((TokenStream { kind: TokenStreamKind::Stream(slice) }, sp));
|
||||
}
|
||||
}
|
||||
None
|
||||
|
@ -81,7 +81,7 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt,
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(_) = exprs.next() {
|
||||
if exprs.next().is_some() {
|
||||
cx.span_err(sp, "env! takes 1 or 2 arguments");
|
||||
return DummyResult::expr(sp);
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ use self::Position::*;
|
||||
use fmt_macros as parse;
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::ext::base;
|
||||
use syntax::ext::base::*;
|
||||
use syntax::ext::base::{self, *};
|
||||
use syntax::ext::build::AstBuilder;
|
||||
use syntax::feature_gate;
|
||||
use syntax::parse::token;
|
||||
@ -24,6 +23,7 @@ use syntax::symbol::Symbol;
|
||||
use syntax::tokenstream;
|
||||
use syntax_pos::{MultiSpan, Span, DUMMY_SP};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
@ -143,8 +143,10 @@ fn parse_args(ecx: &mut ExtCtxt,
|
||||
ecx.span_err(sp, "requires at least a format string argument");
|
||||
return None;
|
||||
}
|
||||
|
||||
let fmtstr = panictry!(p.parse_expr());
|
||||
let mut named = false;
|
||||
|
||||
while p.token != token::Eof {
|
||||
if !p.eat(&token::Comma) {
|
||||
ecx.span_err(p.span, "expected token: `,`");
|
||||
@ -264,11 +266,11 @@ impl<'a, 'b> Context<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
fn describe_num_args(&self) -> String {
|
||||
fn describe_num_args(&self) -> Cow<str> {
|
||||
match self.args.len() {
|
||||
0 => "no arguments were given".to_string(),
|
||||
1 => "there is 1 argument".to_string(),
|
||||
x => format!("there are {} arguments", x),
|
||||
0 => "no arguments were given".into(),
|
||||
1 => "there is 1 argument".into(),
|
||||
x => format!("there are {} arguments", x).into(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -772,8 +774,10 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||
// `ArgumentType` does not derive `Clone`.
|
||||
let arg_types: Vec<_> = (0..args.len()).map(|_| Vec::new()).collect();
|
||||
let arg_unique_types: Vec<_> = (0..args.len()).map(|_| Vec::new()).collect();
|
||||
|
||||
let mut macsp = ecx.call_site();
|
||||
macsp = macsp.apply_mark(ecx.current_expansion.mark);
|
||||
|
||||
let msg = "format argument must be a string literal";
|
||||
let fmt_sp = efmt.span;
|
||||
let fmt = match expr_to_spanned_string(ecx, efmt, msg) {
|
||||
@ -796,11 +800,46 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||
return DummyResult::raw_expr(sp);
|
||||
}
|
||||
};
|
||||
|
||||
let is_literal = match ecx.codemap().span_to_snippet(fmt_sp) {
|
||||
Ok(ref s) if s.starts_with("\"") || s.starts_with("r#") => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
let fmt_str = &*fmt.node.0.as_str();
|
||||
let str_style = match fmt.node.1 {
|
||||
ast::StrStyle::Cooked => None,
|
||||
ast::StrStyle::Raw(raw) => Some(raw as usize),
|
||||
};
|
||||
|
||||
let mut parser = parse::Parser::new(fmt_str, str_style);
|
||||
|
||||
let mut unverified_pieces = Vec::new();
|
||||
while let Some(piece) = parser.next() {
|
||||
if !parser.errors.is_empty() {
|
||||
break;
|
||||
} else {
|
||||
unverified_pieces.push(piece);
|
||||
}
|
||||
}
|
||||
|
||||
if !parser.errors.is_empty() {
|
||||
let err = parser.errors.remove(0);
|
||||
let sp = fmt.span.from_inner_byte_pos(err.start, err.end);
|
||||
let mut e = ecx.struct_span_err(sp, &format!("invalid format string: {}",
|
||||
err.description));
|
||||
e.span_label(sp, err.label + " in format string");
|
||||
if let Some(note) = err.note {
|
||||
e.note(¬e);
|
||||
}
|
||||
e.emit();
|
||||
return DummyResult::raw_expr(sp);
|
||||
}
|
||||
|
||||
let arg_spans = parser.arg_places.iter()
|
||||
.map(|&(start, end)| fmt.span.from_inner_byte_pos(start, end))
|
||||
.collect();
|
||||
|
||||
let mut cx = Context {
|
||||
ecx,
|
||||
args,
|
||||
@ -815,42 +854,22 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||
count_positions_count: 0,
|
||||
count_args_index_offset: 0,
|
||||
literal: String::new(),
|
||||
pieces: Vec::new(),
|
||||
str_pieces: Vec::new(),
|
||||
pieces: Vec::with_capacity(unverified_pieces.len()),
|
||||
str_pieces: Vec::with_capacity(unverified_pieces.len()),
|
||||
all_pieces_simple: true,
|
||||
macsp,
|
||||
fmtsp: fmt.span,
|
||||
invalid_refs: Vec::new(),
|
||||
arg_spans: Vec::new(),
|
||||
arg_spans,
|
||||
is_literal,
|
||||
};
|
||||
|
||||
let fmt_str = &*fmt.node.0.as_str();
|
||||
let str_style = match fmt.node.1 {
|
||||
ast::StrStyle::Cooked => None,
|
||||
ast::StrStyle::Raw(raw) => Some(raw as usize),
|
||||
};
|
||||
let mut parser = parse::Parser::new(fmt_str, str_style);
|
||||
let mut unverified_pieces = vec![];
|
||||
let mut pieces = vec![];
|
||||
|
||||
while let Some(piece) = parser.next() {
|
||||
if !parser.errors.is_empty() {
|
||||
break;
|
||||
}
|
||||
unverified_pieces.push(piece);
|
||||
}
|
||||
|
||||
cx.arg_spans = parser.arg_places.iter()
|
||||
.map(|&(start, end)| fmt.span.from_inner_byte_pos(start, end))
|
||||
.collect();
|
||||
|
||||
// This needs to happen *after* the Parser has consumed all pieces to create all the spans
|
||||
for mut piece in unverified_pieces {
|
||||
let pieces = unverified_pieces.into_iter().map(|mut piece| {
|
||||
cx.verify_piece(&piece);
|
||||
cx.resolve_name_inplace(&mut piece);
|
||||
pieces.push(piece);
|
||||
}
|
||||
piece
|
||||
}).collect::<Vec<_>>();
|
||||
|
||||
let numbered_position_args = pieces.iter().any(|arg: &parse::Piece| {
|
||||
match *arg {
|
||||
@ -867,6 +886,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||
cx.build_index_map();
|
||||
|
||||
let mut arg_index_consumed = vec![0usize; cx.arg_index_map.len()];
|
||||
|
||||
for piece in pieces {
|
||||
if let Some(piece) = cx.build_piece(&piece, &mut arg_index_consumed) {
|
||||
let s = cx.build_literal_string();
|
||||
@ -875,18 +895,6 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||
}
|
||||
}
|
||||
|
||||
if !parser.errors.is_empty() {
|
||||
let err = parser.errors.remove(0);
|
||||
let sp = cx.fmtsp.from_inner_byte_pos(err.start, err.end);
|
||||
let mut e = cx.ecx.struct_span_err(sp, &format!("invalid format string: {}",
|
||||
err.description));
|
||||
e.span_label(sp, err.label + " in format string");
|
||||
if let Some(note) = err.note {
|
||||
e.note(¬e);
|
||||
}
|
||||
e.emit();
|
||||
return DummyResult::raw_expr(sp);
|
||||
}
|
||||
if !cx.literal.is_empty() {
|
||||
let s = cx.build_literal_string();
|
||||
cx.str_pieces.push(s);
|
||||
@ -898,24 +906,25 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||
|
||||
// Make sure that all arguments were used and all arguments have types.
|
||||
let num_pos_args = cx.args.len() - cx.names.len();
|
||||
let mut errs = vec![];
|
||||
for (i, ty) in cx.arg_types.iter().enumerate() {
|
||||
if ty.len() == 0 {
|
||||
if cx.count_positions.contains_key(&i) {
|
||||
continue;
|
||||
}
|
||||
let msg = if i >= num_pos_args {
|
||||
// named argument
|
||||
"named argument never used"
|
||||
} else {
|
||||
// positional argument
|
||||
"argument never used"
|
||||
};
|
||||
errs.push((cx.args[i].span, msg));
|
||||
}
|
||||
}
|
||||
|
||||
let errs = cx.arg_types
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(i, ty)| ty.is_empty() && !cx.count_positions.contains_key(&i))
|
||||
.map(|(i, _)| {
|
||||
let msg = if i >= num_pos_args {
|
||||
// named argument
|
||||
"named argument never used"
|
||||
} else {
|
||||
// positional argument
|
||||
"argument never used"
|
||||
};
|
||||
(cx.args[i].span, msg)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let errs_len = errs.len();
|
||||
if errs_len > 0 {
|
||||
if !errs.is_empty() {
|
||||
let args_used = cx.arg_types.len() - errs_len;
|
||||
let args_unused = errs_len;
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#![feature(const_fn)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(custom_attribute)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(non_exhaustive)]
|
||||
#![feature(optin_builtin_traits)]
|
||||
#![feature(specialization)]
|
||||
|
@ -50,6 +50,7 @@
|
||||
#![cfg_attr(windows, feature(libc))]
|
||||
// Handle rustfmt skips
|
||||
#![feature(custom_attribute)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![allow(unused_attributes)]
|
||||
|
||||
use std::io::prelude::*;
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#![feature(cfg_target_vendor)]
|
||||
#![feature(link_cfg)]
|
||||
#![cfg_attr(not(stage0), feature(nll))]
|
||||
#![feature(staged_api)]
|
||||
#![feature(unwind_attributes)]
|
||||
#![feature(static_nobundle)]
|
||||
|
@ -5,7 +5,7 @@ LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: constant expressions must have a statically known size
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
@ -15,7 +15,7 @@ LL | const CONST_FOO: str = *"foo";
|
||||
| ^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: constant expressions must have a statically known size
|
||||
|
||||
error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time
|
||||
@ -25,7 +25,7 @@ LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: constant expressions must have a statically known size
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
@ -35,7 +35,7 @@ LL | static STATIC_BAR: str = *"bar";
|
||||
| ^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: constant expressions must have a statically known size
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
@ -5,7 +5,7 @@ LL | fn f(p: Path) { }
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required because it appears within the type `std::path::Path`
|
||||
= note: all local variables must have a statically known size
|
||||
|
||||
|
@ -94,7 +94,7 @@ LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: see issue #48214
|
||||
= help: add #![feature(trivial_bounds)] to the crate attributes to enable
|
||||
|
||||
@ -107,7 +107,7 @@ LL | | }
|
||||
| |_^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `Dst<(dyn A + 'static)>`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required because it appears within the type `Dst<(dyn A + 'static)>`
|
||||
= help: see issue #48214
|
||||
= help: add #![feature(trivial_bounds)] to the crate attributes to enable
|
||||
@ -121,7 +121,7 @@ LL | | }
|
||||
| |_^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: see issue #48214
|
||||
= help: add #![feature(trivial_bounds)] to the crate attributes to enable
|
||||
|
||||
|
@ -9,7 +9,7 @@ LL | | };
|
||||
| |____^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: the yield type of a generator must have a statically known size
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
@ -19,7 +19,7 @@ LL | unsafe { gen.resume(); }
|
||||
| ^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | let _x = "test" as &::std::any::Any;
|
||||
| ^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required for the cast to the object type `dyn std::any::Any`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -5,7 +5,7 @@ LL | &mut something
|
||||
| ^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[T]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: all local variables must have a statically known size
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -5,7 +5,7 @@ LL | (|| Box::new(*(&[0][..])))();
|
||||
| ^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `<std::boxed::Box<T>>::new`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -5,7 +5,7 @@ LL | AbstractRenderer
|
||||
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn AbstractRenderer + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: the return type of a function must have a statically known size
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -7,7 +7,7 @@ LL | | }
|
||||
| |_^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::option::Option`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -9,7 +9,7 @@ LL | | }
|
||||
| |_____^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `Self`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where Self: std::marker::Sized` bound
|
||||
note: required by `From`
|
||||
--> $DIR/issue-20005.rs:11:1
|
||||
|
@ -5,7 +5,7 @@ LL | fn iceman(c: Vec<[i32]>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[i32]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::vec::Vec`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -5,7 +5,7 @@ LL | for item in *things { *item = 0 }
|
||||
| ^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator<Item=&mut u8>`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::iter::IntoIterator::into_iter`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -5,7 +5,7 @@ LL | rows: [[String]],
|
||||
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[std::string::String]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: slice and array elements must have `Sized` type
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -5,7 +5,7 @@ LL | pub fn function(funs: Vec<Fn() -> ()>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::vec::Vec`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -24,7 +24,7 @@ LL | | };
|
||||
| |_____^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() -> u32 + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: constant expressions must have a statically known size
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -5,7 +5,7 @@ LL | data: T, //~ ERROR the size for values of type
|
||||
| ^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `T`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where T: std::marker::Sized` bound
|
||||
= note: only the last field of a struct may have a dynamically sized type
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | fn foo(self) -> &'static i32 {
|
||||
| ^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `Self`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where Self: std::marker::Sized` bound
|
||||
= note: all local variables must have a statically known size
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | V([Box<E>]),
|
||||
| ^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[std::boxed::Box<E>]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -5,7 +5,7 @@ LL | fn _test(ref _p: str) {}
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | pub fn example(ref s: str) {}
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | fn baz(_: Self::Target) where Self: Deref {}
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `<Self as std::ops::Deref>::Target`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where <Self as std::ops::Deref>::Target: std::marker::Sized` bound
|
||||
|
||||
error[E0277]: the size for values of type `(dyn std::string::ToString + 'static)` cannot be known at compilation time
|
||||
@ -15,7 +15,7 @@ LL | pub fn f(_: ToString) {}
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | fn new_struct(r: A+'static)
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: all local variables must have a statically known size
|
||||
|
||||
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
|
||||
@ -15,7 +15,7 @@ LL | -> Struct { //~^ ERROR the size for values of type
|
||||
| ^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required because it appears within the type `Struct`
|
||||
= note: the return type of a function must have a statically known size
|
||||
|
||||
|
@ -9,7 +9,11 @@
|
||||
// except according to those terms.
|
||||
|
||||
macro_rules! foo {
|
||||
($a:ident, $b:ident) => ()
|
||||
($a:ident) => ();
|
||||
($a:ident, $b:ident) => ();
|
||||
($a:ident, $b:ident, $c:ident) => ();
|
||||
($a:ident, $b:ident, $c:ident, $d:ident) => ();
|
||||
($a:ident, $b:ident, $c:ident, $d:ident, $e:ident) => ();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@ -17,4 +21,10 @@ fn main() {
|
||||
//~^ ERROR expected token: `,`
|
||||
foo!(a b);
|
||||
//~^ ERROR no rules expected the token `b`
|
||||
foo!(a, b, c, d e);
|
||||
//~^ ERROR no rules expected the token `e`
|
||||
foo!(a, b, c d, e);
|
||||
//~^ ERROR no rules expected the token `d`
|
||||
foo!(a, b, c d e);
|
||||
//~^ ERROR no rules expected the token `d`
|
||||
}
|
||||
|
@ -1,16 +1,38 @@
|
||||
error: expected token: `,`
|
||||
--> $DIR/missing-comma.rs:16:19
|
||||
--> $DIR/missing-comma.rs:20:19
|
||||
|
|
||||
LL | println!("{}" a);
|
||||
| ^
|
||||
|
||||
error: no rules expected the token `b`
|
||||
--> $DIR/missing-comma.rs:18:12
|
||||
--> $DIR/missing-comma.rs:22:12
|
||||
|
|
||||
LL | foo!(a b);
|
||||
| -^
|
||||
| |
|
||||
| help: missing comma here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: no rules expected the token `e`
|
||||
--> $DIR/missing-comma.rs:24:21
|
||||
|
|
||||
LL | foo!(a, b, c, d e);
|
||||
| -^
|
||||
| |
|
||||
| help: missing comma here
|
||||
|
||||
error: no rules expected the token `d`
|
||||
--> $DIR/missing-comma.rs:26:18
|
||||
|
|
||||
LL | foo!(a, b, c d, e);
|
||||
| -^
|
||||
| |
|
||||
| help: missing comma here
|
||||
|
||||
error: no rules expected the token `d`
|
||||
--> $DIR/missing-comma.rs:28:18
|
||||
|
|
||||
LL | foo!(a, b, c d e);
|
||||
| ^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -223,7 +223,7 @@ LL | let _ = fat_v as *const Foo; //~ ERROR the size for values of type
|
||||
| ^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required for the cast to the object type `dyn Foo`
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
@ -233,7 +233,7 @@ LL | let _ = a as *const Foo; //~ ERROR the size for values of type
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required for the cast to the object type `dyn Foo`
|
||||
|
||||
error[E0606]: casting `&{float}` as `f32` is invalid
|
||||
|
@ -5,7 +5,7 @@ LL | fn foo(_x: K) {}
|
||||
| ^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn I + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: all local variables must have a statically known size
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -28,7 +28,7 @@ LL | let v = s[..2];
|
||||
| doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: all local variables must have a statically known size
|
||||
|
||||
error[E0308]: mismatched types
|
||||
|
@ -23,6 +23,7 @@
|
||||
// gate-test-hexagon_target_feature
|
||||
// gate-test-mips_target_feature
|
||||
// gate-test-mmx_target_feature
|
||||
// gate-test-wasm_target_feature
|
||||
// min-llvm-version 6.0
|
||||
|
||||
#[target_feature(enable = "avx512bw")]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0658]: the target feature `avx512bw` is currently unstable (see issue #44839)
|
||||
--> $DIR/target-feature-gate.rs:28:18
|
||||
--> $DIR/target-feature-gate.rs:29:18
|
||||
|
|
||||
LL | #[target_feature(enable = "avx512bw")]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -5,7 +5,7 @@ LL | mem::size_of::<U>();
|
||||
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `U`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where U: std::marker::Sized` bound
|
||||
= note: required by `std::mem::size_of`
|
||||
|
||||
@ -16,7 +16,7 @@ LL | mem::size_of::<Misc<U>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where U: std::marker::Sized` bound
|
||||
= note: required because it appears within the type `Misc<U>`
|
||||
= note: required by `std::mem::size_of`
|
||||
@ -54,7 +54,7 @@ LL | mem::size_of::<[T]>();
|
||||
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[T]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::mem::size_of`
|
||||
|
||||
error[E0277]: the size for values of type `[&U]` cannot be known at compilation time
|
||||
@ -64,7 +64,7 @@ LL | mem::size_of::<[&U]>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[&U]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required by `std::mem::size_of`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
@ -5,7 +5,7 @@ LL | fn cant_return_str() -> str { //~ ERROR
|
||||
| ^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: the return type of a function must have a statically known size
|
||||
|
||||
error[E0599]: no method named `test` found for type `i32` in the current scope
|
||||
|
@ -5,7 +5,7 @@ LL | value: T,
|
||||
| ^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `T`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where T: std::marker::Sized` bound
|
||||
= note: no field of a union may have a dynamically sized type
|
||||
|
||||
@ -16,7 +16,7 @@ LL | value: T,
|
||||
| ^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `T`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where T: std::marker::Sized` bound
|
||||
= note: only the last field of a struct may have a dynamically sized type
|
||||
|
||||
@ -27,7 +27,7 @@ LL | Value(T),
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `T`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where T: std::marker::Sized` bound
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | VA(W),
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `W`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where W: std::marker::Sized` bound
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
@ -16,7 +16,7 @@ LL | VB{x: X},
|
||||
| ^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `X`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where X: std::marker::Sized` bound
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
@ -27,7 +27,7 @@ LL | VC(isize, Y),
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `Y`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where Y: std::marker::Sized` bound
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
@ -38,7 +38,7 @@ LL | VD{u: isize, x: Z},
|
||||
| ^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `Z`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= help: consider adding a `where Z: std::marker::Sized` bound
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
@ -49,7 +49,7 @@ LL | VE([u8]),
|
||||
| ^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
@ -59,7 +59,7 @@ LL | VF{x: str},
|
||||
| ^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `str`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `[f32]` cannot be known at compilation time
|
||||
@ -69,7 +69,7 @@ LL | VG(isize, [f32]),
|
||||
| ^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[f32]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `[u32]` cannot be known at compilation time
|
||||
@ -79,7 +79,7 @@ LL | VH{u: isize, x: [u32]},
|
||||
| ^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[u32]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
|
||||
@ -89,7 +89,7 @@ LL | VM(Foo),
|
||||
| ^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `(dyn Bar + 'static)` cannot be known at compilation time
|
||||
@ -99,7 +99,7 @@ LL | VN{x: Bar},
|
||||
| ^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn Bar + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `(dyn FooBar + 'static)` cannot be known at compilation time
|
||||
@ -109,7 +109,7 @@ LL | VO(isize, FooBar),
|
||||
| ^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn FooBar + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `(dyn BarFoo + 'static)` cannot be known at compilation time
|
||||
@ -119,7 +119,7 @@ LL | VP{u: isize, x: BarFoo},
|
||||
| ^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `(dyn BarFoo + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `[i8]` cannot be known at compilation time
|
||||
@ -129,7 +129,7 @@ LL | VQ(<&'static [i8] as Deref>::Target),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[i8]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `[char]` cannot be known at compilation time
|
||||
@ -139,7 +139,7 @@ LL | VR{x: <&'static [char] as Deref>::Target},
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[char]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `[f64]` cannot be known at compilation time
|
||||
@ -149,7 +149,7 @@ LL | VS(isize, <&'static [f64] as Deref>::Target),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[f64]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
|
||||
@ -159,7 +159,7 @@ LL | VT{u: isize, x: <&'static [i32] as Deref>::Target},
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[i32]`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
error[E0277]: the size for values of type `(dyn PathHelper1 + 'static)` cannot be known at compilation time
|
||||
@ -169,7 +169,7 @@ LL | VI(Path1),
|
||||
| ^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `Path1`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper1 + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required because it appears within the type `Path1`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
@ -180,7 +180,7 @@ LL | VJ{x: Path2},
|
||||
| ^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `Path2`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper2 + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required because it appears within the type `Path2`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
@ -191,7 +191,7 @@ LL | VK(isize, Path3),
|
||||
| ^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `Path3`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper3 + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required because it appears within the type `Path3`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
@ -202,7 +202,7 @@ LL | VL{u: isize, x: Path4},
|
||||
| ^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `Path4`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper4 + 'static)`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: required because it appears within the type `Path4`
|
||||
= note: no field of an enum variant may have a dynamically sized type
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user