Skip to content
Myr

Add ui test of temporary value in anyhow macro

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent f9419cd · Browse files · 2 files+14 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−0 removed

  • tests:+14 added−0 removed

2 files+14 added−0 removed

added:tests/ui/temporary-value.rs+5 added
1use anyhow::anyhow;23fn main() {4 let _ = anyhow!(&String::new());5}
added:tests/ui/temporary-value.stderr+9 added
1error[E0716]: temporary value dropped while borrowed2 --> $DIR/temporary-value.rs:4:223 |44 | let _ = anyhow!(&String::new());5 | ---------^^^^^^^^^^^^^-6 | | |7 | | creates a temporary which is freed while still in use8 | temporary value is freed at the end of this statement9 | argument requires that borrow lasts for `'static`