diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/nll/issue-54556-used-vs-unused-tails.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/nll/issue-54556-used-vs-unused-tails.rs')
-rw-r--r-- | src/test/ui/nll/issue-54556-used-vs-unused-tails.rs | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs b/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs deleted file mode 100644 index a111acca6..000000000 --- a/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs +++ /dev/null @@ -1,56 +0,0 @@ -// This test case is exploring the space of how blocks with tail -// expressions and statements can be composed, trying to keep each -// case on one line so that we can compare them via a vertical scan -// with the human eye. - -// Each comment on the right side of the line is summarizing the -// expected suggestion from the diagnostic for issue #54556. - -fn main() { - { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` -//~^ ERROR does not live long enough - - { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;` -//~^ ERROR does not live long enough - - { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;` -//~^ ERROR does not live long enough - - let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` -//~^ ERROR does not live long enough - - let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;` -//~^ ERROR does not live long enough - - let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` -//~^ ERROR does not live long enough - let _x = { let mut _t1 = D(Box::new("t1")); let x = D(&_t1).end(); x } ; // no error - - let mut _y; - _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` -//~^ ERROR does not live long enough - _y = { let mut _t1 = D(Box::new("t1")); let x = D(&_t1).end(); x } ; // no error -} - -fn f_param_ref(_t1: D<Box<&'static str>>) { D(&_t1).unit() } // no error - -fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;` -//~^ ERROR does not live long enough - -fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x` -//~^ ERROR does not live long enough - -#[derive(Debug)] -struct D<T: std::fmt::Debug>(T); - -impl<T: std::fmt::Debug> Drop for D<T> { - fn drop(&mut self) { - println!("dropping {:?})", self); - } -} - -impl<T: std::fmt::Debug> D<T> { - fn next<U: std::fmt::Debug>(&self, _other: U) -> D<U> { D(_other) } - fn end(&self) -> String { format!("End({:?})", self.0) } - fn unit(&self) { } -} |