Skip to content

Commit 278cb91

Browse files
committed
Satisfy tidy
1 parent 4839d8c commit 278cb91

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

src/libcore/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2902,7 +2902,7 @@ impl<T: Sized> NonNull<T> {
29022902
NonNull::new_unchecked(ptr)
29032903
}
29042904
}
2905-
2905+
29062906
/// Creates a new `NonNull` that is dangling, but well-aligned.
29072907
///
29082908
/// This is useful for initializing types which lazily allocate, like

src/test/run-pass/consts/const-ptr-nonnull.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const fn cast<T, U>(non_null: NonNull<T>) -> NonNull<U> {
1414

1515
pub fn main() {
1616
assert_eq!(dangling(), NonNull::dangling());
17-
17+
1818
let mut i: i32 = 10;
1919
let non_null_t = NonNull::new(&mut i).unwrap();
2020
let non_null_u: NonNull<u32> = cast(non_null_t);
+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use std::ptr::NonNull;
22

33
fn main() {
4-
let x: &'static NonNull<u32> = &(NonNull::dangling()); //~ ERROR borrowed value does not live long enough
5-
4+
let x: &'static NonNull<u32> = &(NonNull::dangling());
5+
//~^ ERROR borrowed value does not live long enough
6+
67
let mut i: i32 = 10;
78
let non_null = NonNull::new(&mut i).unwrap();
8-
let x: &'static NonNull<u32> = &(non_null.cast()); //~ ERROR borrowed value does not live long enough
9+
let x: &'static NonNull<u32> = &(non_null.cast());
10+
//~^ ERROR borrowed value does not live long enough
911
}

src/test/ui/consts/const-ptr-nonnull.stderr

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0597]: borrowed value does not live long enough
22
--> $DIR/const-ptr-nonnull.rs:4:37
33
|
4-
LL | let x: &'static NonNull<u32> = &(NonNull::dangling()); //~ ERROR borrowed value does not live long enough
4+
LL | let x: &'static NonNull<u32> = &(NonNull::dangling());
55
| ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
66
...
77
LL | }
@@ -10,10 +10,11 @@ LL | }
1010
= note: borrowed value must be valid for the static lifetime...
1111

1212
error[E0597]: borrowed value does not live long enough
13-
--> $DIR/const-ptr-nonnull.rs:8:37
13+
--> $DIR/const-ptr-nonnull.rs:9:37
1414
|
15-
LL | let x: &'static NonNull<u32> = &(non_null.cast()); //~ ERROR borrowed value does not live long enough
15+
LL | let x: &'static NonNull<u32> = &(non_null.cast());
1616
| ^^^^^^^^^^^^^^^^^ temporary value does not live long enough
17+
LL | //~^ ERROR borrowed value does not live long enough
1718
LL | }
1819
| - temporary value only lives until here
1920
|

src/test/ui/consts/const-ptr-unique.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ use std::ptr::Unique;
55
fn main() {
66
let mut i: u32 = 10;
77
let unique = Unique::new(&mut i).unwrap();
8-
let x: &'static *mut u32 = &(unique.as_ptr()); //~ ERROR borrowed value does not live long enough
8+
let x: &'static *mut u32 = &(unique.as_ptr());
9+
//~^ ERROR borrowed value does not live long enough
910
}

src/test/ui/consts/const-ptr-unique.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
error[E0597]: borrowed value does not live long enough
22
--> $DIR/const-ptr-unique.rs:8:33
33
|
4-
LL | let x: &'static *mut u32 = &(unique.as_ptr()); //~ ERROR borrowed value does not live long enough
4+
LL | let x: &'static *mut u32 = &(unique.as_ptr());
55
| ^^^^^^^^^^^^^^^^^ temporary value does not live long enough
6+
LL | //~^ ERROR borrowed value does not live long enough
67
LL | }
78
| - temporary value only lives until here
89
|

0 commit comments

Comments
 (0)