Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #64958

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5faae38
apfloat: improve doc comments
RalfJung Aug 9, 2019
f290467
syntax: cleanup method parsing.
Centril Sep 29, 2019
378cc98
syntax: `is_named_argument` -> `is_named_param`.
Centril Sep 29, 2019
4fa9c3b
syntax refactor `parse_fn_params`
Centril Sep 29, 2019
40dc9da
syntax refactor `parse_self_param` (1)
Centril Sep 29, 2019
f688f8a
syntax refactor `parse_self_param` (2)
Centril Sep 29, 2019
ac454e9
syntax refactor `parse_self_param` (3)
Centril Sep 30, 2019
4306d00
syntax refactor `parse_self_param` (4)
Centril Sep 30, 2019
0492302
syntax refactor `parse_self_param` (5)
Centril Sep 30, 2019
347deac
syntax: reorder param parsing to make more sense.
Centril Sep 30, 2019
d9d0e5d
syntax: cleanup `parse_fn_decl`.
Centril Sep 30, 2019
5b80ead
syntax: misc cleanup
Centril Sep 30, 2019
66bf323
syntax: cleanup `parse_visibility`.
Centril Sep 30, 2019
573a8d8
syntax: extract `error_on_invalid_abi`.
Centril Sep 30, 2019
258e86a
syntax: fuse more code paths together.
Centril Sep 30, 2019
bea404f
syntax: stylistic cleanup in item parsing.
Centril Sep 30, 2019
151ce96
syntax: reduce repetition in fn parsing.
Centril Sep 30, 2019
df298b4
syntax: document some methods.
Centril Oct 1, 2019
30647d1
syntax: put helpers of `parse_self_param` in the method.
Centril Oct 1, 2019
49780d2
syntax: merge things back into `parse_visibility`.
Centril Oct 1, 2019
e046904
syntax: de-closure-ify `check_or_expected`.
Centril Oct 1, 2019
5c5dd80
syntax: reformat passing of `FnHeader` to `parse_item_fn`.
Centril Oct 1, 2019
3237ded
Add long error explanation for E0495
GuillaumeGomez Sep 12, 2019
be89e52
update ui tests
GuillaumeGomez Sep 12, 2019
e1d9f82
Update cargo.
michaelwoerister Oct 1, 2019
6c1b447
Remove unneeded `fn main` blocks from docs
tesuji Oct 1, 2019
3173a09
Update `Cargo.lock` for cargo update
alexcrichton Oct 1, 2019
185f8a9
Rollup merge of #63416 - RalfJung:apfloat, r=eddyb
Centril Oct 1, 2019
fd6212a
Rollup merge of #64404 - GuillaumeGomez:err-E0495, r=cramertj
Centril Oct 1, 2019
121a469
Rollup merge of #64910 - Centril:params-cleanup, r=petrochenkov
Centril Oct 1, 2019
b69acfa
Rollup merge of #64912 - lzutao:unneeded-main-doc, r=jonas-schievink
Centril Oct 1, 2019
98344d7
Rollup merge of #64952 - michaelwoerister:update-cargo, r=alexcrichton
Centril Oct 1, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ dependencies = [

[[package]]
name = "cargo"
version = "0.40.0"
version = "0.41.0"
dependencies = [
"atty",
"bytesize",
Expand Down Expand Up @@ -600,7 +600,7 @@ checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"

[[package]]
name = "crates-io"
version = "0.28.0"
version = "0.29.0"
dependencies = [
"curl",
"failure",
Expand Down Expand Up @@ -730,25 +730,24 @@ dependencies = [

[[package]]
name = "curl"
version = "0.4.21"
version = "0.4.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a85f2f95f2bd277d316d1aa8a477687ab4a6942258c7db7c89c187534669979c"
checksum = "d08ad3cb89d076a36b0ce5749eec2c9964f70c0c58480ab6b75a91ec4fc206d8"
dependencies = [
"curl-sys",
"kernel32-sys",
"libc",
"openssl-probe",
"openssl-sys",
"schannel",
"socket2",
"winapi 0.2.8",
"winapi 0.3.6",
]

[[package]]
name = "curl-sys"
version = "0.4.18"
version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d91a0052d5b982887d8e829bee0faffc7218ea3c6ebd3d6c2c8f678a93c9a42"
checksum = "520594da9914c1dc77ce3be450fc1c74fde67c82966d80f8e93c6d460eb0e9ae"
dependencies = [
"cc",
"libc",
Expand Down
54 changes: 21 additions & 33 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
//! Nil,
//! }
//!
//! fn main() {
//! let list: List<i32> = List::Cons(1, Box::new(List::Cons(2, Box::new(List::Nil))));
//! println!("{:?}", list);
//! }
//! let list: List<i32> = List::Cons(1, Box::new(List::Cons(2, Box::new(List::Nil))));
//! println!("{:?}", list);
//! ```
//!
//! This will print `Cons(1, Cons(2, Nil))`.
Expand Down Expand Up @@ -375,14 +373,12 @@ impl<T: ?Sized> Box<T> {
/// ```
/// #![feature(box_into_raw_non_null)]
///
/// fn main() {
/// let x = Box::new(5);
/// let ptr = Box::into_raw_non_null(x);
/// let x = Box::new(5);
/// let ptr = Box::into_raw_non_null(x);
///
/// // Clean up the memory by converting the NonNull pointer back
/// // into a Box and letting the Box be dropped.
/// let x = unsafe { Box::from_raw(ptr.as_ptr()) };
/// }
/// // Clean up the memory by converting the NonNull pointer back
/// // into a Box and letting the Box be dropped.
/// let x = unsafe { Box::from_raw(ptr.as_ptr()) };
/// ```
#[unstable(feature = "box_into_raw_non_null", issue = "47336")]
#[inline]
Expand Down Expand Up @@ -428,23 +424,19 @@ impl<T: ?Sized> Box<T> {
/// Simple usage:
///
/// ```
/// fn main() {
/// let x = Box::new(41);
/// let static_ref: &'static mut usize = Box::leak(x);
/// *static_ref += 1;
/// assert_eq!(*static_ref, 42);
/// }
/// let x = Box::new(41);
/// let static_ref: &'static mut usize = Box::leak(x);
/// *static_ref += 1;
/// assert_eq!(*static_ref, 42);
/// ```
///
/// Unsized data:
///
/// ```
/// fn main() {
/// let x = vec![1, 2, 3].into_boxed_slice();
/// let static_ref = Box::leak(x);
/// static_ref[0] = 4;
/// assert_eq!(*static_ref, [4, 2, 3]);
/// }
/// let x = vec![1, 2, 3].into_boxed_slice();
/// let static_ref = Box::leak(x);
/// static_ref[0] = 4;
/// assert_eq!(*static_ref, [4, 2, 3]);
/// ```
#[stable(feature = "box_leak", since = "1.26.0")]
#[inline]
Expand Down Expand Up @@ -780,11 +772,9 @@ impl Box<dyn Any> {
/// }
/// }
///
/// fn main() {
/// let my_string = "Hello World".to_string();
/// print_if_string(Box::new(my_string));
/// print_if_string(Box::new(0i8));
/// }
/// let my_string = "Hello World".to_string();
/// print_if_string(Box::new(my_string));
/// print_if_string(Box::new(0i8));
/// ```
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<dyn Any>> {
if self.is::<T>() {
Expand Down Expand Up @@ -814,11 +804,9 @@ impl Box<dyn Any + Send> {
/// }
/// }
///
/// fn main() {
/// let my_string = "Hello World".to_string();
/// print_if_string(Box::new(my_string));
/// print_if_string(Box::new(0i8));
/// }
/// let my_string = "Hello World".to_string();
/// print_if_string(Box::new(my_string));
/// print_if_string(Box::new(0i8));
/// ```
pub fn downcast<T: Any>(self) -> Result<Box<T>, Box<dyn Any + Send>> {
<Box<dyn Any>>::downcast(self).map_err(|s| unsafe {
Expand Down
2 changes: 0 additions & 2 deletions src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2226,14 +2226,12 @@ impl<'a, K: Ord, V: Default> Entry<'a, K, V> {
/// # Examples
///
/// ```
/// # fn main() {
/// use std::collections::BTreeMap;
///
/// let mut map: BTreeMap<&str, Option<usize>> = BTreeMap::new();
/// map.entry("poneyland").or_default();
///
/// assert_eq!(map["poneyland"], None);
/// # }
/// ```
pub fn or_default(self) -> &'a mut V {
match self {
Expand Down
8 changes: 3 additions & 5 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,11 +861,9 @@ impl Rc<dyn Any> {
/// }
/// }
///
/// fn main() {
/// let my_string = "Hello World".to_string();
/// print_if_string(Rc::new(my_string));
/// print_if_string(Rc::new(0i8));
/// }
/// let my_string = "Hello World".to_string();
/// print_if_string(Rc::new(my_string));
/// print_if_string(Rc::new(0i8));
/// ```
pub fn downcast<T: Any>(self) -> Result<Rc<T>, Rc<dyn Any>> {
if (*self).is::<T>() {
Expand Down
11 changes: 3 additions & 8 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,20 +412,15 @@ impl<T> [T] {
///
/// ```
/// #![feature(repeat_generic_slice)]
///
/// fn main() {
/// assert_eq!([1, 2].repeat(3), vec![1, 2, 1, 2, 1, 2]);
/// }
/// assert_eq!([1, 2].repeat(3), vec![1, 2, 1, 2, 1, 2]);
/// ```
///
/// A panic upon overflow:
///
/// ```should_panic
/// #![feature(repeat_generic_slice)]
/// fn main() {
/// // this will panic at runtime
/// b"0123456789abcdef".repeat(usize::max_value());
/// }
/// // this will panic at runtime
/// b"0123456789abcdef".repeat(usize::max_value());
/// ```
#[unstable(feature = "repeat_generic_slice",
reason = "it's on str, why not on slice?",
Expand Down
6 changes: 2 additions & 4 deletions src/liballoc/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,8 @@ impl str {
/// A panic upon overflow:
///
/// ```should_panic
/// fn main() {
/// // this will panic at runtime
/// "0123456789abcdef".repeat(usize::max_value());
/// }
/// // this will panic at runtime
/// "0123456789abcdef".repeat(usize::max_value());
/// ```
#[stable(feature = "repeat_str", since = "1.16.0")]
pub fn repeat(&self, n: usize) -> String {
Expand Down
6 changes: 2 additions & 4 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,8 @@ use crate::vec::Vec;
///
/// fn example_func<A: TraitExample>(example_arg: A) {}
///
/// fn main() {
/// let example_string = String::from("example_string");
/// example_func(&example_string);
/// }
/// let example_string = String::from("example_string");
/// example_func(&example_string);
/// ```
///
/// There are two options that would work instead. The first would be to
Expand Down
8 changes: 3 additions & 5 deletions src/liballoc/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1244,11 +1244,9 @@ impl Arc<dyn Any + Send + Sync> {
/// }
/// }
///
/// fn main() {
/// let my_string = "Hello World".to_string();
/// print_if_string(Arc::new(my_string));
/// print_if_string(Arc::new(0i8));
/// }
/// let my_string = "Hello World".to_string();
/// print_if_string(Arc::new(my_string));
/// print_if_string(Arc::new(0i8));
/// ```
pub fn downcast<T>(self) -> Result<Arc<T>, Self>
where
Expand Down
44 changes: 20 additions & 24 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,28 +389,26 @@ impl<T> Vec<T> {
/// use std::ptr;
/// use std::mem;
///
/// fn main() {
/// let mut v = vec![1, 2, 3];
///
/// // Pull out the various important pieces of information about `v`
/// let p = v.as_mut_ptr();
/// let len = v.len();
/// let cap = v.capacity();
/// let mut v = vec![1, 2, 3];
///
/// unsafe {
/// // Cast `v` into the void: no destructor run, so we are in
/// // complete control of the allocation to which `p` points.
/// mem::forget(v);
/// // Pull out the various important pieces of information about `v`
/// let p = v.as_mut_ptr();
/// let len = v.len();
/// let cap = v.capacity();
///
/// // Overwrite memory with 4, 5, 6
/// for i in 0..len as isize {
/// ptr::write(p.offset(i), 4 + i);
/// }
/// unsafe {
/// // Cast `v` into the void: no destructor run, so we are in
/// // complete control of the allocation to which `p` points.
/// mem::forget(v);
///
/// // Put everything back together into a Vec
/// let rebuilt = Vec::from_raw_parts(p, len, cap);
/// assert_eq!(rebuilt, [4, 5, 6]);
/// // Overwrite memory with 4, 5, 6
/// for i in 0..len as isize {
/// ptr::write(p.offset(i), 4 + i);
/// }
///
/// // Put everything back together into a Vec
/// let rebuilt = Vec::from_raw_parts(p, len, cap);
/// assert_eq!(rebuilt, [4, 5, 6]);
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -1391,12 +1389,10 @@ impl<T> Vec<T> {
/// ```
/// #![feature(vec_leak)]
///
/// fn main() {
/// let x = vec![1, 2, 3];
/// let static_ref: &'static mut [usize] = Vec::leak(x);
/// static_ref[0] += 1;
/// assert_eq!(static_ref, &[2, 2, 3]);
/// }
/// let x = vec![1, 2, 3];
/// let static_ref: &'static mut [usize] = Vec::leak(x);
/// static_ref[0] += 1;
/// assert_eq!(static_ref, &[2, 2, 3]);
/// ```
#[unstable(feature = "vec_leak", issue = "62195")]
#[inline]
Expand Down
Loading