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#99863 - Dylan-DPC:rollup-lq9w047, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - rust-lang#99628 (add more docs regarding ideographic numbers) - rust-lang#99689 (Revert `write!` and `writeln!` to late drop temporaries) - rust-lang#99807 (Fix PermissionDenied UI tests on WSL) - rust-lang#99817 (rustdoc: remove Clean trait impls for more items) - rust-lang#99851 (Fix small typo in Cargo.toml comment) - rust-lang#99856 (fix: remove fake no_dead_strip for osx) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
11 changed files
with
215 additions
and
95 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
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,10 @@ | ||
// build-fail | ||
// dont-check-compiler-stderr | ||
// compile-flags: -C linker=llllll -C linker-flavor=ld | ||
// error-pattern: linker `llllll` not found | ||
// error-pattern: `llllll` | ||
|
||
// Before, the error-pattern checked for "not found". On WSL with appendWindowsPath=true, running | ||
// in invalid command returns a PermissionDenied instead. | ||
|
||
fn main() { | ||
} |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// check-pass | ||
// edition:2021 | ||
|
||
use std::fmt::{self, Display}; | ||
use std::future::Future; | ||
use std::io; | ||
use std::pin::Pin; | ||
use std::task::{Context, Poll}; | ||
|
||
struct AsyncStdout; | ||
|
||
impl AsyncStdout { | ||
fn write_fmt<'a>(&'a mut self, _args: fmt::Arguments) -> WriteFmtFuture<'a, Self> | ||
where | ||
Self: Unpin, | ||
{ | ||
WriteFmtFuture(self) | ||
} | ||
} | ||
|
||
struct WriteFmtFuture<'a, T>(&'a mut T); | ||
|
||
impl<'a, T> Future for WriteFmtFuture<'a, T> { | ||
type Output = io::Result<()>; | ||
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
async fn async_main() { | ||
let _write = write!(&mut AsyncStdout, "...").await; | ||
let _writeln = writeln!(&mut AsyncStdout, "...").await; | ||
} | ||
|
||
fn main() { | ||
let _ = async_main; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// check-fail | ||
|
||
use std::fmt::{self, Display}; | ||
|
||
struct Mutex; | ||
|
||
impl Mutex { | ||
fn lock(&self) -> MutexGuard { | ||
MutexGuard(self) | ||
} | ||
} | ||
|
||
struct MutexGuard<'a>(&'a Mutex); | ||
|
||
impl<'a> Drop for MutexGuard<'a> { | ||
fn drop(&mut self) { | ||
// Empty but this is a necessary part of the repro. Otherwise borrow | ||
// checker is fine with 'a dangling at the time that MutexGuard goes out | ||
// of scope. | ||
} | ||
} | ||
|
||
struct Out; | ||
|
||
impl Out { | ||
fn write_fmt(&self, _args: fmt::Arguments) {} | ||
} | ||
|
||
impl<'a> Display for MutexGuard<'a> { | ||
fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result { | ||
Ok(()) | ||
} | ||
} | ||
|
||
fn main() { | ||
// FIXME(dtolnay): We actually want both of these to work. I think it's | ||
// sadly unimplementable today though. | ||
|
||
let _write = { | ||
let mutex = Mutex; | ||
write!(Out, "{}", mutex.lock()) /* no semicolon */ | ||
//~^ ERROR `mutex` does not live long enough | ||
}; | ||
|
||
let _writeln = { | ||
let mutex = Mutex; | ||
writeln!(Out, "{}", mutex.lock()) /* no semicolon */ | ||
//~^ ERROR `mutex` does not live long enough | ||
}; | ||
} |
43 changes: 43 additions & 0 deletions
43
src/test/ui/macros/format-args-temporaries-in-write.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
error[E0597]: `mutex` does not live long enough | ||
--> $DIR/format-args-temporaries-in-write.rs:41:27 | ||
| | ||
LL | write!(Out, "{}", mutex.lock()) /* no semicolon */ | ||
| ^^^^^^^^^^^^ | ||
| | | ||
| borrowed value does not live long enough | ||
| a temporary with access to the borrow is created here ... | ||
LL | | ||
LL | }; | ||
| -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `MutexGuard` | ||
| | | ||
| `mutex` dropped here while still borrowed | ||
| | ||
help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | ||
--> $SRC_DIR/core/src/macros/mod.rs:LL:COL | ||
| | ||
LL | $dst.write_fmt($crate::format_args!($($arg)*)); | ||
| + | ||
|
||
error[E0597]: `mutex` does not live long enough | ||
--> $DIR/format-args-temporaries-in-write.rs:47:29 | ||
| | ||
LL | writeln!(Out, "{}", mutex.lock()) /* no semicolon */ | ||
| ^^^^^^^^^^^^ | ||
| | | ||
| borrowed value does not live long enough | ||
| a temporary with access to the borrow is created here ... | ||
LL | | ||
LL | }; | ||
| -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `MutexGuard` | ||
| | | ||
| `mutex` dropped here while still borrowed | ||
| | ||
help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | ||
--> $SRC_DIR/core/src/macros/mod.rs:LL:COL | ||
| | ||
LL | $dst.write_fmt($crate::format_args_nl!($($arg)*)); | ||
| + | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0597`. |
Oops, something went wrong.