Auto merge of #34898 - sanxiyn:rollup, r=sanxiyn
Rollup of 5 pull requests - Successful merges: #34807, #34853, #34875, #34884, #34889 - Failed merges:
This commit is contained in:
commit
27e766d7bc
@ -60,6 +60,8 @@ asm!("xor %eax, %eax"
|
||||
: "eax"
|
||||
);
|
||||
# } }
|
||||
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
# fn main() {}
|
||||
```
|
||||
|
||||
Whitespace also doesn't matter:
|
||||
@ -70,6 +72,8 @@ Whitespace also doesn't matter:
|
||||
# fn main() { unsafe {
|
||||
asm!("xor %eax, %eax" ::: "eax");
|
||||
# } }
|
||||
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
# fn main() {}
|
||||
```
|
||||
|
||||
## Operands
|
||||
@ -129,6 +133,8 @@ stay valid.
|
||||
// Put the value 0x200 in eax
|
||||
asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax");
|
||||
# } }
|
||||
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
# fn main() {}
|
||||
```
|
||||
|
||||
Input and output registers need not be listed since that information
|
||||
@ -164,6 +170,8 @@ unsafe {
|
||||
}
|
||||
println!("eax is currently {}", result);
|
||||
# }
|
||||
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
# fn main() {}
|
||||
```
|
||||
|
||||
## More Information
|
||||
|
@ -701,6 +701,12 @@ impl String {
|
||||
/// Violating these may cause problems like corrupting the allocator's
|
||||
/// internal datastructures.
|
||||
///
|
||||
/// The ownership of `ptr` is effectively transferred to the
|
||||
/// `String` which may then deallocate, reallocate or change the
|
||||
/// contents of memory pointed to by the pointer at will. Ensure
|
||||
/// that nothing else uses the pointer after calling this
|
||||
/// function.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
|
@ -342,12 +342,18 @@ impl<T> Vec<T> {
|
||||
///
|
||||
/// * `ptr` needs to have been previously allocated via `String`/`Vec<T>`
|
||||
/// (at least, it's highly likely to be incorrect if it wasn't).
|
||||
/// * `length` needs to be the length that less than or equal to `capacity`.
|
||||
/// * `length` needs to be less than or equal to `capacity`.
|
||||
/// * `capacity` needs to be the capacity that the pointer was allocated with.
|
||||
///
|
||||
/// Violating these may cause problems like corrupting the allocator's
|
||||
/// internal datastructures.
|
||||
///
|
||||
/// The ownership of `ptr` is effectively transferred to the
|
||||
/// `Vec<T>` which may then deallocate, reallocate or change the
|
||||
/// contents of memory pointed to by the pointer at will. Ensure
|
||||
/// that nothing else uses the pointer after calling this
|
||||
/// function.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
@ -479,18 +485,45 @@ impl<T> Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Shorten a vector to be `len` elements long, dropping excess elements.
|
||||
/// Shortens the vector, keeping the first `len` elements and dropping
|
||||
/// the rest.
|
||||
///
|
||||
/// If `len` is greater than the vector's current length, this has no
|
||||
/// effect.
|
||||
///
|
||||
/// The [`drain`] method can emulate `truncate`, but causes the excess
|
||||
/// elements to be returned instead of dropped.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Truncating a five element vector to two elements:
|
||||
///
|
||||
/// ```
|
||||
/// let mut vec = vec![1, 2, 3, 4, 5];
|
||||
/// vec.truncate(2);
|
||||
/// assert_eq!(vec, [1, 2]);
|
||||
/// ```
|
||||
///
|
||||
/// No truncation occurs when `len` is greater than the vector's current
|
||||
/// length:
|
||||
///
|
||||
/// ```
|
||||
/// let mut vec = vec![1, 2, 3];
|
||||
/// vec.truncate(8);
|
||||
/// assert_eq!(vec, [1, 2, 3]);
|
||||
/// ```
|
||||
///
|
||||
/// Truncating when `len == 0` is equivalent to calling the [`clear`]
|
||||
/// method.
|
||||
///
|
||||
/// ```
|
||||
/// let mut vec = vec![1, 2, 3];
|
||||
/// vec.truncate(0);
|
||||
/// assert_eq!(vec, []);
|
||||
/// ```
|
||||
///
|
||||
/// [`clear`]: #method.clear
|
||||
/// [`drain`]: #method.drain
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn truncate(&mut self, len: usize) {
|
||||
unsafe {
|
||||
|
@ -902,6 +902,8 @@ macro_rules! make_mut_slice {
|
||||
|
||||
/// Immutable slice iterator
|
||||
///
|
||||
/// This struct is created by the [`iter`] method on [slices].
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
@ -915,6 +917,9 @@ macro_rules! make_mut_slice {
|
||||
/// println!("{}", element);
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// [`iter`]: ../../std/primitive.slice.html#method.iter
|
||||
/// [slices]: ../../std/primitive.slice.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, T: 'a> {
|
||||
ptr: *const T,
|
||||
@ -993,6 +998,8 @@ impl<'a, T> Clone for Iter<'a, T> {
|
||||
|
||||
/// Mutable slice iterator.
|
||||
///
|
||||
/// This struct is created by the [`iter_mut`] method on [slices].
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
@ -1010,6 +1017,9 @@ impl<'a, T> Clone for Iter<'a, T> {
|
||||
/// // We now have "[2, 3, 4]":
|
||||
/// println!("{:?}", slice);
|
||||
/// ```
|
||||
///
|
||||
/// [`iter_mut`]: ../../std/primitive.slice.html#method.iter_mut
|
||||
/// [slices]: ../../std/primitive.slice.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IterMut<'a, T: 'a> {
|
||||
ptr: *mut T,
|
||||
|
@ -195,7 +195,7 @@ fn write_basic_block(tcx: TyCtxt,
|
||||
ALIGN,
|
||||
comment(tcx, data.terminator().source_info))?;
|
||||
|
||||
writeln!(w, "{}}}\n", INDENT)
|
||||
writeln!(w, "{}}}", INDENT)
|
||||
}
|
||||
|
||||
fn comment(tcx: TyCtxt, SourceInfo { span, scope }: SourceInfo) -> String {
|
||||
|
@ -11,6 +11,8 @@
|
||||
// ignore-tidy-linelength
|
||||
// ignore-lldb
|
||||
// ignore-android: FIXME(#24958)
|
||||
// ignore-arm: FIXME(#24958)
|
||||
// ignore-aarch64: FIXME(#24958)
|
||||
|
||||
// compile-flags:-g
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user