forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#2251 - dtolnay-contrib:rustfmt4, r=RalfJung
Format tests with rustfmt (201-224 of 300) Extracted from rust-lang#2097. Last of the easy cases which do not involve moving around a comment.
- Loading branch information
Showing
40 changed files
with
210 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
// error-pattern: pointer to 4 bytes starting at offset 0 is out-of-bounds | ||
|
||
fn main() { unsafe { | ||
let ptr = Box::into_raw(Box::new(0u16)); | ||
Box::from_raw(ptr as *mut u32); | ||
} } | ||
fn main() { | ||
unsafe { | ||
let ptr = Box::into_raw(Box::new(0u16)); | ||
Box::from_raw(ptr as *mut u32); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
// error-pattern: is not a valid pointer | ||
use std::ptr::NonNull; | ||
|
||
fn main() { unsafe { | ||
let ptr = NonNull::<i32>::dangling(); | ||
Box::from_raw(ptr.as_ptr()); | ||
} } | ||
fn main() { | ||
unsafe { | ||
let ptr = NonNull::<i32>::dangling(); | ||
Box::from_raw(ptr.as_ptr()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions
22
tests/fail/stacked_borrows/mut_exclusive_violation1.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
use std::ptr::NonNull; | ||
|
||
fn main() { unsafe { | ||
let x = &mut 0; | ||
let mut ptr1 = NonNull::from(x); | ||
let mut ptr2 = ptr1.clone(); | ||
let raw1 = ptr1.as_mut(); | ||
let _raw2 = ptr2.as_mut(); | ||
let _val = *raw1; //~ ERROR borrow stack | ||
} } | ||
fn main() { | ||
unsafe { | ||
let x = &mut 0; | ||
let mut ptr1 = NonNull::from(x); | ||
let mut ptr2 = ptr1.clone(); | ||
let raw1 = ptr1.as_mut(); | ||
let _raw2 = ptr2.as_mut(); | ||
let _val = *raw1; //~ ERROR borrow stack | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.