Make [e]println macros eagerly drop temporaries (for backport)
This commit is contained in:
parent
69a5d2481e
commit
3a8f81aac9
4 changed files with 9 additions and 9 deletions
|
@ -99,9 +99,9 @@ macro_rules! println {
|
||||||
() => {
|
() => {
|
||||||
$crate::print!("\n")
|
$crate::print!("\n")
|
||||||
};
|
};
|
||||||
($($arg:tt)*) => {
|
($($arg:tt)*) => {{
|
||||||
$crate::io::_print($crate::format_args_nl!($($arg)*))
|
$crate::io::_print($crate::format_args_nl!($($arg)*));
|
||||||
};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prints to the standard error.
|
/// Prints to the standard error.
|
||||||
|
@ -164,9 +164,9 @@ macro_rules! eprintln {
|
||||||
() => {
|
() => {
|
||||||
$crate::eprint!("\n")
|
$crate::eprint!("\n")
|
||||||
};
|
};
|
||||||
($($arg:tt)*) => {
|
($($arg:tt)*) => {{
|
||||||
$crate::io::_eprint($crate::format_args_nl!($($arg)*))
|
$crate::io::_eprint($crate::format_args_nl!($($arg)*));
|
||||||
};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prints and returns the value of a given expression for quick and dirty
|
/// Prints and returns the value of a given expression for quick and dirty
|
||||||
|
|
|
@ -9,5 +9,5 @@ extern crate std;
|
||||||
// pp-exact:dollar-crate.pp
|
// pp-exact:dollar-crate.pp
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"], &[]));
|
{ ::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"], &[])); };
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,5 +5,5 @@ LL | println!("Hello, World!");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: expanding `println! { "Hello, World!" }`
|
= note: expanding `println! { "Hello, World!" }`
|
||||||
= note: to `$crate :: io :: _print($crate :: format_args_nl! ("Hello, World!"))`
|
= note: to `{ $crate :: io :: _print($crate :: format_args_nl! ("Hello, World!")) ; }`
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ LL | struct Foo(isize, isize);
|
||||||
= note: the matched value is of type `Foo`
|
= note: the matched value is of type `Foo`
|
||||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||||
|
|
|
|
||||||
LL ~ Foo(2, b) => println!("{}", b),
|
LL ~ Foo(2, b) => println!("{}", b)
|
||||||
LL + Foo(_, _) => todo!()
|
LL + Foo(_, _) => todo!()
|
||||||
|
|
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue