Skip to content

Commit 27e766d

Browse files
authored
Auto merge of #34898 - sanxiyn:rollup, r=sanxiyn
Rollup of 5 pull requests - Successful merges: #34807, #34853, #34875, #34884, #34889 - Failed merges:
2 parents 92400cf + 88b37b6 commit 27e766d

File tree

6 files changed

+62
-3
lines changed

6 files changed

+62
-3
lines changed

src/doc/book/inline-assembly.md

+8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ asm!("xor %eax, %eax"
6060
: "eax"
6161
);
6262
# } }
63+
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
64+
# fn main() {}
6365
```
6466

6567
Whitespace also doesn't matter:
@@ -70,6 +72,8 @@ Whitespace also doesn't matter:
7072
# fn main() { unsafe {
7173
asm!("xor %eax, %eax" ::: "eax");
7274
# } }
75+
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
76+
# fn main() {}
7377
```
7478

7579
## Operands
@@ -129,6 +133,8 @@ stay valid.
129133
// Put the value 0x200 in eax
130134
asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax");
131135
# } }
136+
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
137+
# fn main() {}
132138
```
133139

134140
Input and output registers need not be listed since that information
@@ -164,6 +170,8 @@ unsafe {
164170
}
165171
println!("eax is currently {}", result);
166172
# }
173+
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
174+
# fn main() {}
167175
```
168176

169177
## More Information

src/libcollections/string.rs

+6
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,12 @@ impl String {
701701
/// Violating these may cause problems like corrupting the allocator's
702702
/// internal datastructures.
703703
///
704+
/// The ownership of `ptr` is effectively transferred to the
705+
/// `String` which may then deallocate, reallocate or change the
706+
/// contents of memory pointed to by the pointer at will. Ensure
707+
/// that nothing else uses the pointer after calling this
708+
/// function.
709+
///
704710
/// # Examples
705711
///
706712
/// Basic usage:

src/libcollections/vec.rs

+35-2
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,18 @@ impl<T> Vec<T> {
342342
///
343343
/// * `ptr` needs to have been previously allocated via `String`/`Vec<T>`
344344
/// (at least, it's highly likely to be incorrect if it wasn't).
345-
/// * `length` needs to be the length that less than or equal to `capacity`.
345+
/// * `length` needs to be less than or equal to `capacity`.
346346
/// * `capacity` needs to be the capacity that the pointer was allocated with.
347347
///
348348
/// Violating these may cause problems like corrupting the allocator's
349349
/// internal datastructures.
350350
///
351+
/// The ownership of `ptr` is effectively transferred to the
352+
/// `Vec<T>` which may then deallocate, reallocate or change the
353+
/// contents of memory pointed to by the pointer at will. Ensure
354+
/// that nothing else uses the pointer after calling this
355+
/// function.
356+
///
351357
/// # Examples
352358
///
353359
/// ```
@@ -479,18 +485,45 @@ impl<T> Vec<T> {
479485
}
480486
}
481487

482-
/// Shorten a vector to be `len` elements long, dropping excess elements.
488+
/// Shortens the vector, keeping the first `len` elements and dropping
489+
/// the rest.
483490
///
484491
/// If `len` is greater than the vector's current length, this has no
485492
/// effect.
486493
///
494+
/// The [`drain`] method can emulate `truncate`, but causes the excess
495+
/// elements to be returned instead of dropped.
496+
///
487497
/// # Examples
488498
///
499+
/// Truncating a five element vector to two elements:
500+
///
489501
/// ```
490502
/// let mut vec = vec![1, 2, 3, 4, 5];
491503
/// vec.truncate(2);
492504
/// assert_eq!(vec, [1, 2]);
493505
/// ```
506+
///
507+
/// No truncation occurs when `len` is greater than the vector's current
508+
/// length:
509+
///
510+
/// ```
511+
/// let mut vec = vec![1, 2, 3];
512+
/// vec.truncate(8);
513+
/// assert_eq!(vec, [1, 2, 3]);
514+
/// ```
515+
///
516+
/// Truncating when `len == 0` is equivalent to calling the [`clear`]
517+
/// method.
518+
///
519+
/// ```
520+
/// let mut vec = vec![1, 2, 3];
521+
/// vec.truncate(0);
522+
/// assert_eq!(vec, []);
523+
/// ```
524+
///
525+
/// [`clear`]: #method.clear
526+
/// [`drain`]: #method.drain
494527
#[stable(feature = "rust1", since = "1.0.0")]
495528
pub fn truncate(&mut self, len: usize) {
496529
unsafe {

src/libcore/slice.rs

+10
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,8 @@ macro_rules! make_mut_slice {
902902

903903
/// Immutable slice iterator
904904
///
905+
/// This struct is created by the [`iter`] method on [slices].
906+
///
905907
/// # Examples
906908
///
907909
/// Basic usage:
@@ -915,6 +917,9 @@ macro_rules! make_mut_slice {
915917
/// println!("{}", element);
916918
/// }
917919
/// ```
920+
///
921+
/// [`iter`]: ../../std/primitive.slice.html#method.iter
922+
/// [slices]: ../../std/primitive.slice.html
918923
#[stable(feature = "rust1", since = "1.0.0")]
919924
pub struct Iter<'a, T: 'a> {
920925
ptr: *const T,
@@ -993,6 +998,8 @@ impl<'a, T> Clone for Iter<'a, T> {
993998

994999
/// Mutable slice iterator.
9951000
///
1001+
/// This struct is created by the [`iter_mut`] method on [slices].
1002+
///
9961003
/// # Examples
9971004
///
9981005
/// Basic usage:
@@ -1010,6 +1017,9 @@ impl<'a, T> Clone for Iter<'a, T> {
10101017
/// // We now have "[2, 3, 4]":
10111018
/// println!("{:?}", slice);
10121019
/// ```
1020+
///
1021+
/// [`iter_mut`]: ../../std/primitive.slice.html#method.iter_mut
1022+
/// [slices]: ../../std/primitive.slice.html
10131023
#[stable(feature = "rust1", since = "1.0.0")]
10141024
pub struct IterMut<'a, T: 'a> {
10151025
ptr: *mut T,

src/librustc_mir/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ fn write_basic_block(tcx: TyCtxt,
195195
ALIGN,
196196
comment(tcx, data.terminator().source_info))?;
197197

198-
writeln!(w, "{}}}\n", INDENT)
198+
writeln!(w, "{}}}", INDENT)
199199
}
200200

201201
fn comment(tcx: TyCtxt, SourceInfo { span, scope }: SourceInfo) -> String {

src/test/debuginfo/type-names.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// ignore-tidy-linelength
1212
// ignore-lldb
1313
// ignore-android: FIXME(#24958)
14+
// ignore-arm: FIXME(#24958)
15+
// ignore-aarch64: FIXME(#24958)
1416

1517
// compile-flags:-g
1618

0 commit comments

Comments
 (0)