Skip to content

Commit b0bd5f2

Browse files
committed
Auto merge of #62452 - Centril:rollup-5jww3h7, r=Centril
Rollup of 5 pull requests Successful merges: - #60081 (Refactor unicode.py script) - #61862 (Make the Weak::{into,as}_raw methods) - #62243 (Improve documentation for built-in macros) - #62422 (Remove some uses of mem::uninitialized) - #62436 (normalize use of backticks/lowercase in compiler messages for librustc_mir) Failed merges: r? @ghost
2 parents dfd52ba + 7ef02dc commit b0bd5f2

File tree

64 files changed

+1745
-702
lines changed

Some content is hidden

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

64 files changed

+1745
-702
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ __pycache__/
3636
/src/libcore/unicode/Scripts.txt
3737
/src/libcore/unicode/SpecialCasing.txt
3838
/src/libcore/unicode/UnicodeData.txt
39+
/src/libcore/unicode/downloaded
3940
/stage[0-9]+/
4041
/target
4142
target/

src/liballoc/rc.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -1291,26 +1291,26 @@ impl<T> Weak<T> {
12911291
/// ```
12921292
/// #![feature(weak_into_raw)]
12931293
///
1294-
/// use std::rc::{Rc, Weak};
1294+
/// use std::rc::Rc;
12951295
/// use std::ptr;
12961296
///
12971297
/// let strong = Rc::new("hello".to_owned());
12981298
/// let weak = Rc::downgrade(&strong);
12991299
/// // Both point to the same object
1300-
/// assert!(ptr::eq(&*strong, Weak::as_raw(&weak)));
1300+
/// assert!(ptr::eq(&*strong, weak.as_raw()));
13011301
/// // The strong here keeps it alive, so we can still access the object.
1302-
/// assert_eq!("hello", unsafe { &*Weak::as_raw(&weak) });
1302+
/// assert_eq!("hello", unsafe { &*weak.as_raw() });
13031303
///
13041304
/// drop(strong);
1305-
/// // But not any more. We can do Weak::as_raw(&weak), but accessing the pointer would lead to
1305+
/// // But not any more. We can do weak.as_raw(), but accessing the pointer would lead to
13061306
/// // undefined behaviour.
1307-
/// // assert_eq!("hello", unsafe { &*Weak::as_raw(&weak) });
1307+
/// // assert_eq!("hello", unsafe { &*weak.as_raw() });
13081308
/// ```
13091309
///
13101310
/// [`null`]: ../../std/ptr/fn.null.html
13111311
#[unstable(feature = "weak_into_raw", issue = "60728")]
1312-
pub fn as_raw(this: &Self) -> *const T {
1313-
match this.inner() {
1312+
pub fn as_raw(&self) -> *const T {
1313+
match self.inner() {
13141314
None => ptr::null(),
13151315
Some(inner) => {
13161316
let offset = data_offset_sized::<T>();
@@ -1341,7 +1341,7 @@ impl<T> Weak<T> {
13411341
///
13421342
/// let strong = Rc::new("hello".to_owned());
13431343
/// let weak = Rc::downgrade(&strong);
1344-
/// let raw = Weak::into_raw(weak);
1344+
/// let raw = weak.into_raw();
13451345
///
13461346
/// assert_eq!(1, Rc::weak_count(&strong));
13471347
/// assert_eq!("hello", unsafe { &*raw });
@@ -1353,9 +1353,9 @@ impl<T> Weak<T> {
13531353
/// [`from_raw`]: struct.Weak.html#method.from_raw
13541354
/// [`as_raw`]: struct.Weak.html#method.as_raw
13551355
#[unstable(feature = "weak_into_raw", issue = "60728")]
1356-
pub fn into_raw(this: Self) -> *const T {
1357-
let result = Self::as_raw(&this);
1358-
mem::forget(this);
1356+
pub fn into_raw(self) -> *const T {
1357+
let result = self.as_raw();
1358+
mem::forget(self);
13591359
result
13601360
}
13611361

@@ -1382,18 +1382,18 @@ impl<T> Weak<T> {
13821382
///
13831383
/// let strong = Rc::new("hello".to_owned());
13841384
///
1385-
/// let raw_1 = Weak::into_raw(Rc::downgrade(&strong));
1386-
/// let raw_2 = Weak::into_raw(Rc::downgrade(&strong));
1385+
/// let raw_1 = Rc::downgrade(&strong).into_raw();
1386+
/// let raw_2 = Rc::downgrade(&strong).into_raw();
13871387
///
13881388
/// assert_eq!(2, Rc::weak_count(&strong));
13891389
///
1390-
/// assert_eq!("hello", &*Weak::upgrade(&unsafe { Weak::from_raw(raw_1) }).unwrap());
1390+
/// assert_eq!("hello", &*unsafe { Weak::from_raw(raw_1) }.upgrade().unwrap());
13911391
/// assert_eq!(1, Rc::weak_count(&strong));
13921392
///
13931393
/// drop(strong);
13941394
///
13951395
/// // Decrement the last weak count.
1396-
/// assert!(Weak::upgrade(&unsafe { Weak::from_raw(raw_2) }).is_none());
1396+
/// assert!(unsafe { Weak::from_raw(raw_2) }.upgrade().is_none());
13971397
/// ```
13981398
///
13991399
/// [`null`]: ../../std/ptr/fn.null.html

src/liballoc/sync.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -1080,26 +1080,26 @@ impl<T> Weak<T> {
10801080
/// ```
10811081
/// #![feature(weak_into_raw)]
10821082
///
1083-
/// use std::sync::{Arc, Weak};
1083+
/// use std::sync::Arc;
10841084
/// use std::ptr;
10851085
///
10861086
/// let strong = Arc::new("hello".to_owned());
10871087
/// let weak = Arc::downgrade(&strong);
10881088
/// // Both point to the same object
1089-
/// assert!(ptr::eq(&*strong, Weak::as_raw(&weak)));
1089+
/// assert!(ptr::eq(&*strong, weak.as_raw()));
10901090
/// // The strong here keeps it alive, so we can still access the object.
1091-
/// assert_eq!("hello", unsafe { &*Weak::as_raw(&weak) });
1091+
/// assert_eq!("hello", unsafe { &*weak.as_raw() });
10921092
///
10931093
/// drop(strong);
1094-
/// // But not any more. We can do Weak::as_raw(&weak), but accessing the pointer would lead to
1094+
/// // But not any more. We can do weak.as_raw(), but accessing the pointer would lead to
10951095
/// // undefined behaviour.
1096-
/// // assert_eq!("hello", unsafe { &*Weak::as_raw(&weak) });
1096+
/// // assert_eq!("hello", unsafe { &*weak.as_raw() });
10971097
/// ```
10981098
///
10991099
/// [`null`]: ../../std/ptr/fn.null.html
11001100
#[unstable(feature = "weak_into_raw", issue = "60728")]
1101-
pub fn as_raw(this: &Self) -> *const T {
1102-
match this.inner() {
1101+
pub fn as_raw(&self) -> *const T {
1102+
match self.inner() {
11031103
None => ptr::null(),
11041104
Some(inner) => {
11051105
let offset = data_offset_sized::<T>();
@@ -1130,7 +1130,7 @@ impl<T> Weak<T> {
11301130
///
11311131
/// let strong = Arc::new("hello".to_owned());
11321132
/// let weak = Arc::downgrade(&strong);
1133-
/// let raw = Weak::into_raw(weak);
1133+
/// let raw = weak.into_raw();
11341134
///
11351135
/// assert_eq!(1, Arc::weak_count(&strong));
11361136
/// assert_eq!("hello", unsafe { &*raw });
@@ -1142,9 +1142,9 @@ impl<T> Weak<T> {
11421142
/// [`from_raw`]: struct.Weak.html#method.from_raw
11431143
/// [`as_raw`]: struct.Weak.html#method.as_raw
11441144
#[unstable(feature = "weak_into_raw", issue = "60728")]
1145-
pub fn into_raw(this: Self) -> *const T {
1146-
let result = Self::as_raw(&this);
1147-
mem::forget(this);
1145+
pub fn into_raw(self) -> *const T {
1146+
let result = self.as_raw();
1147+
mem::forget(self);
11481148
result
11491149
}
11501150

@@ -1172,18 +1172,18 @@ impl<T> Weak<T> {
11721172
///
11731173
/// let strong = Arc::new("hello".to_owned());
11741174
///
1175-
/// let raw_1 = Weak::into_raw(Arc::downgrade(&strong));
1176-
/// let raw_2 = Weak::into_raw(Arc::downgrade(&strong));
1175+
/// let raw_1 = Arc::downgrade(&strong).into_raw();
1176+
/// let raw_2 = Arc::downgrade(&strong).into_raw();
11771177
///
11781178
/// assert_eq!(2, Arc::weak_count(&strong));
11791179
///
1180-
/// assert_eq!("hello", &*Weak::upgrade(&unsafe { Weak::from_raw(raw_1) }).unwrap());
1180+
/// assert_eq!("hello", &*unsafe { Weak::from_raw(raw_1) }.upgrade().unwrap());
11811181
/// assert_eq!(1, Arc::weak_count(&strong));
11821182
///
11831183
/// drop(strong);
11841184
///
11851185
/// // Decrement the last weak count.
1186-
/// assert!(Weak::upgrade(&unsafe { Weak::from_raw(raw_2) }).is_none());
1186+
/// assert!(unsafe { Weak::from_raw(raw_2) }.upgrade().is_none());
11871187
/// ```
11881188
///
11891189
/// [`null`]: ../../std/ptr/fn.null.html

src/libcore/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#![feature(const_fn)]
7676
#![feature(const_fn_union)]
7777
#![feature(custom_inner_attributes)]
78+
#![feature(decl_macro)]
7879
#![feature(doc_cfg)]
7980
#![feature(doc_spotlight)]
8081
#![feature(extern_types)]

0 commit comments

Comments
 (0)