Skip to content

Commit 8d0ebb2

Browse files
committed
Auto merge of #64958 - Centril:rollup-8k5m97o, r=Centril
Rollup of 5 pull requests Successful merges: - #63416 (apfloat: improve doc comments) - #64404 (Add long error explanation for E0495) - #64910 (syntax: cleanup param, method, and misc parsing) - #64912 (Remove unneeded `fn main` blocks from docs) - #64952 (Update cargo.) Failed merges: r? @ghost
2 parents 702b45e + 98344d7 commit 8d0ebb2

File tree

70 files changed

+865
-960
lines changed

Some content is hidden

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

70 files changed

+865
-960
lines changed

Cargo.lock

+7-8
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ dependencies = [
265265

266266
[[package]]
267267
name = "cargo"
268-
version = "0.40.0"
268+
version = "0.41.0"
269269
dependencies = [
270270
"atty",
271271
"bytesize",
@@ -600,7 +600,7 @@ checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
600600

601601
[[package]]
602602
name = "crates-io"
603-
version = "0.28.0"
603+
version = "0.29.0"
604604
dependencies = [
605605
"curl",
606606
"failure",
@@ -730,25 +730,24 @@ dependencies = [
730730

731731
[[package]]
732732
name = "curl"
733-
version = "0.4.21"
733+
version = "0.4.24"
734734
source = "registry+https://github.com/rust-lang/crates.io-index"
735-
checksum = "a85f2f95f2bd277d316d1aa8a477687ab4a6942258c7db7c89c187534669979c"
735+
checksum = "d08ad3cb89d076a36b0ce5749eec2c9964f70c0c58480ab6b75a91ec4fc206d8"
736736
dependencies = [
737737
"curl-sys",
738-
"kernel32-sys",
739738
"libc",
740739
"openssl-probe",
741740
"openssl-sys",
742741
"schannel",
743742
"socket2",
744-
"winapi 0.2.8",
743+
"winapi 0.3.6",
745744
]
746745

747746
[[package]]
748747
name = "curl-sys"
749-
version = "0.4.18"
748+
version = "0.4.21"
750749
source = "registry+https://github.com/rust-lang/crates.io-index"
751-
checksum = "9d91a0052d5b982887d8e829bee0faffc7218ea3c6ebd3d6c2c8f678a93c9a42"
750+
checksum = "520594da9914c1dc77ce3be450fc1c74fde67c82966d80f8e93c6d460eb0e9ae"
752751
dependencies = [
753752
"cc",
754753
"libc",

src/liballoc/boxed.rs

+21-33
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@
2929
//! Nil,
3030
//! }
3131
//!
32-
//! fn main() {
33-
//! let list: List<i32> = List::Cons(1, Box::new(List::Cons(2, Box::new(List::Nil))));
34-
//! println!("{:?}", list);
35-
//! }
32+
//! let list: List<i32> = List::Cons(1, Box::new(List::Cons(2, Box::new(List::Nil))));
33+
//! println!("{:?}", list);
3634
//! ```
3735
//!
3836
//! This will print `Cons(1, Cons(2, Nil))`.
@@ -375,14 +373,12 @@ impl<T: ?Sized> Box<T> {
375373
/// ```
376374
/// #![feature(box_into_raw_non_null)]
377375
///
378-
/// fn main() {
379-
/// let x = Box::new(5);
380-
/// let ptr = Box::into_raw_non_null(x);
376+
/// let x = Box::new(5);
377+
/// let ptr = Box::into_raw_non_null(x);
381378
///
382-
/// // Clean up the memory by converting the NonNull pointer back
383-
/// // into a Box and letting the Box be dropped.
384-
/// let x = unsafe { Box::from_raw(ptr.as_ptr()) };
385-
/// }
379+
/// // Clean up the memory by converting the NonNull pointer back
380+
/// // into a Box and letting the Box be dropped.
381+
/// let x = unsafe { Box::from_raw(ptr.as_ptr()) };
386382
/// ```
387383
#[unstable(feature = "box_into_raw_non_null", issue = "47336")]
388384
#[inline]
@@ -428,23 +424,19 @@ impl<T: ?Sized> Box<T> {
428424
/// Simple usage:
429425
///
430426
/// ```
431-
/// fn main() {
432-
/// let x = Box::new(41);
433-
/// let static_ref: &'static mut usize = Box::leak(x);
434-
/// *static_ref += 1;
435-
/// assert_eq!(*static_ref, 42);
436-
/// }
427+
/// let x = Box::new(41);
428+
/// let static_ref: &'static mut usize = Box::leak(x);
429+
/// *static_ref += 1;
430+
/// assert_eq!(*static_ref, 42);
437431
/// ```
438432
///
439433
/// Unsized data:
440434
///
441435
/// ```
442-
/// fn main() {
443-
/// let x = vec![1, 2, 3].into_boxed_slice();
444-
/// let static_ref = Box::leak(x);
445-
/// static_ref[0] = 4;
446-
/// assert_eq!(*static_ref, [4, 2, 3]);
447-
/// }
436+
/// let x = vec![1, 2, 3].into_boxed_slice();
437+
/// let static_ref = Box::leak(x);
438+
/// static_ref[0] = 4;
439+
/// assert_eq!(*static_ref, [4, 2, 3]);
448440
/// ```
449441
#[stable(feature = "box_leak", since = "1.26.0")]
450442
#[inline]
@@ -780,11 +772,9 @@ impl Box<dyn Any> {
780772
/// }
781773
/// }
782774
///
783-
/// fn main() {
784-
/// let my_string = "Hello World".to_string();
785-
/// print_if_string(Box::new(my_string));
786-
/// print_if_string(Box::new(0i8));
787-
/// }
775+
/// let my_string = "Hello World".to_string();
776+
/// print_if_string(Box::new(my_string));
777+
/// print_if_string(Box::new(0i8));
788778
/// ```
789779
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<dyn Any>> {
790780
if self.is::<T>() {
@@ -814,11 +804,9 @@ impl Box<dyn Any + Send> {
814804
/// }
815805
/// }
816806
///
817-
/// fn main() {
818-
/// let my_string = "Hello World".to_string();
819-
/// print_if_string(Box::new(my_string));
820-
/// print_if_string(Box::new(0i8));
821-
/// }
807+
/// let my_string = "Hello World".to_string();
808+
/// print_if_string(Box::new(my_string));
809+
/// print_if_string(Box::new(0i8));
822810
/// ```
823811
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<dyn Any + Send>> {
824812
<Box<dyn Any>>::downcast(self).map_err(|s| unsafe {

src/liballoc/collections/btree/map.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2226,14 +2226,12 @@ impl<'a, K: Ord, V: Default> Entry<'a, K, V> {
22262226
/// # Examples
22272227
///
22282228
/// ```
2229-
/// # fn main() {
22302229
/// use std::collections::BTreeMap;
22312230
///
22322231
/// let mut map: BTreeMap<&str, Option<usize>> = BTreeMap::new();
22332232
/// map.entry("poneyland").or_default();
22342233
///
22352234
/// assert_eq!(map["poneyland"], None);
2236-
/// # }
22372235
/// ```
22382236
pub fn or_default(self) -> &'a mut V {
22392237
match self {

src/liballoc/rc.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -861,11 +861,9 @@ impl Rc<dyn Any> {
861861
/// }
862862
/// }
863863
///
864-
/// fn main() {
865-
/// let my_string = "Hello World".to_string();
866-
/// print_if_string(Rc::new(my_string));
867-
/// print_if_string(Rc::new(0i8));
868-
/// }
864+
/// let my_string = "Hello World".to_string();
865+
/// print_if_string(Rc::new(my_string));
866+
/// print_if_string(Rc::new(0i8));
869867
/// ```
870868
pub fn downcast<T: Any>(self) -> Result<Rc<T>, Rc<dyn Any>> {
871869
if (*self).is::<T>() {

src/liballoc/slice.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -412,20 +412,15 @@ impl<T> [T] {
412412
///
413413
/// ```
414414
/// #![feature(repeat_generic_slice)]
415-
///
416-
/// fn main() {
417-
/// assert_eq!([1, 2].repeat(3), vec![1, 2, 1, 2, 1, 2]);
418-
/// }
415+
/// assert_eq!([1, 2].repeat(3), vec![1, 2, 1, 2, 1, 2]);
419416
/// ```
420417
///
421418
/// A panic upon overflow:
422419
///
423420
/// ```should_panic
424421
/// #![feature(repeat_generic_slice)]
425-
/// fn main() {
426-
/// // this will panic at runtime
427-
/// b"0123456789abcdef".repeat(usize::max_value());
428-
/// }
422+
/// // this will panic at runtime
423+
/// b"0123456789abcdef".repeat(usize::max_value());
429424
/// ```
430425
#[unstable(feature = "repeat_generic_slice",
431426
reason = "it's on str, why not on slice?",

src/liballoc/str.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,8 @@ impl str {
500500
/// A panic upon overflow:
501501
///
502502
/// ```should_panic
503-
/// fn main() {
504-
/// // this will panic at runtime
505-
/// "0123456789abcdef".repeat(usize::max_value());
506-
/// }
503+
/// // this will panic at runtime
504+
/// "0123456789abcdef".repeat(usize::max_value());
507505
/// ```
508506
#[stable(feature = "repeat_str", since = "1.16.0")]
509507
pub fn repeat(&self, n: usize) -> String {

src/liballoc/string.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,8 @@ use crate::vec::Vec;
164164
///
165165
/// fn example_func<A: TraitExample>(example_arg: A) {}
166166
///
167-
/// fn main() {
168-
/// let example_string = String::from("example_string");
169-
/// example_func(&example_string);
170-
/// }
167+
/// let example_string = String::from("example_string");
168+
/// example_func(&example_string);
171169
/// ```
172170
///
173171
/// There are two options that would work instead. The first would be to

src/liballoc/sync.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1244,11 +1244,9 @@ impl Arc<dyn Any + Send + Sync> {
12441244
/// }
12451245
/// }
12461246
///
1247-
/// fn main() {
1248-
/// let my_string = "Hello World".to_string();
1249-
/// print_if_string(Arc::new(my_string));
1250-
/// print_if_string(Arc::new(0i8));
1251-
/// }
1247+
/// let my_string = "Hello World".to_string();
1248+
/// print_if_string(Arc::new(my_string));
1249+
/// print_if_string(Arc::new(0i8));
12521250
/// ```
12531251
pub fn downcast<T>(self) -> Result<Arc<T>, Self>
12541252
where

src/liballoc/vec.rs

+20-24
Original file line numberDiff line numberDiff line change
@@ -389,28 +389,26 @@ impl<T> Vec<T> {
389389
/// use std::ptr;
390390
/// use std::mem;
391391
///
392-
/// fn main() {
393-
/// let mut v = vec![1, 2, 3];
394-
///
395-
/// // Pull out the various important pieces of information about `v`
396-
/// let p = v.as_mut_ptr();
397-
/// let len = v.len();
398-
/// let cap = v.capacity();
392+
/// let mut v = vec![1, 2, 3];
399393
///
400-
/// unsafe {
401-
/// // Cast `v` into the void: no destructor run, so we are in
402-
/// // complete control of the allocation to which `p` points.
403-
/// mem::forget(v);
394+
/// // Pull out the various important pieces of information about `v`
395+
/// let p = v.as_mut_ptr();
396+
/// let len = v.len();
397+
/// let cap = v.capacity();
404398
///
405-
/// // Overwrite memory with 4, 5, 6
406-
/// for i in 0..len as isize {
407-
/// ptr::write(p.offset(i), 4 + i);
408-
/// }
399+
/// unsafe {
400+
/// // Cast `v` into the void: no destructor run, so we are in
401+
/// // complete control of the allocation to which `p` points.
402+
/// mem::forget(v);
409403
///
410-
/// // Put everything back together into a Vec
411-
/// let rebuilt = Vec::from_raw_parts(p, len, cap);
412-
/// assert_eq!(rebuilt, [4, 5, 6]);
404+
/// // Overwrite memory with 4, 5, 6
405+
/// for i in 0..len as isize {
406+
/// ptr::write(p.offset(i), 4 + i);
413407
/// }
408+
///
409+
/// // Put everything back together into a Vec
410+
/// let rebuilt = Vec::from_raw_parts(p, len, cap);
411+
/// assert_eq!(rebuilt, [4, 5, 6]);
414412
/// }
415413
/// ```
416414
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1391,12 +1389,10 @@ impl<T> Vec<T> {
13911389
/// ```
13921390
/// #![feature(vec_leak)]
13931391
///
1394-
/// fn main() {
1395-
/// let x = vec![1, 2, 3];
1396-
/// let static_ref: &'static mut [usize] = Vec::leak(x);
1397-
/// static_ref[0] += 1;
1398-
/// assert_eq!(static_ref, &[2, 2, 3]);
1399-
/// }
1392+
/// let x = vec![1, 2, 3];
1393+
/// let static_ref: &'static mut [usize] = Vec::leak(x);
1394+
/// static_ref[0] += 1;
1395+
/// assert_eq!(static_ref, &[2, 2, 3]);
14001396
/// ```
14011397
#[unstable(feature = "vec_leak", issue = "62195")]
14021398
#[inline]

0 commit comments

Comments
 (0)