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/issues/issue-21400.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/issues/issue-21400.rs')
-rw-r--r-- | src/test/ui/issues/issue-21400.rs | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/test/ui/issues/issue-21400.rs b/src/test/ui/issues/issue-21400.rs deleted file mode 100644 index 4a85158d9..000000000 --- a/src/test/ui/issues/issue-21400.rs +++ /dev/null @@ -1,56 +0,0 @@ -// run-pass -// Regression test for #21400 which itself was extracted from -// stackoverflow.com/questions/28031155/is-my-borrow-checker-drunk/28031580 - -fn main() { - let mut t = Test; - assert_eq!(t.method1("one"), Ok(1)); - assert_eq!(t.method2("two"), Ok(2)); - assert_eq!(t.test(), Ok(2)); -} - -struct Test; - -impl Test { - fn method1(&mut self, _arg: &str) -> Result<usize, &str> { - Ok(1) - } - - fn method2(self: &mut Test, _arg: &str) -> Result<usize, &str> { - Ok(2) - } - - fn test(self: &mut Test) -> Result<usize, &str> { - let s = format!("abcde"); - // (Originally, this invocation of method2 was saying that `s` - // does not live long enough.) - let data = match self.method2(&*s) { - Ok(r) => r, - Err(e) => return Err(e) - }; - Ok(data) - } -} - -// Below is a closer match for the original test that was failing to compile - -pub struct GitConnect; - -impl GitConnect { - fn command(self: &mut GitConnect, _s: &str) -> Result<Vec<Vec<u8>>, &str> { - unimplemented!() - } - - pub fn git_upload_pack(self: &mut GitConnect) -> Result<String, &str> { - let c = format!("git-upload-pack"); - - let mut out = String::new(); - let data = self.command(&c)?; - - for line in data.iter() { - out.push_str(&format!("{:?}", line)); - } - - Ok(out) - } -} |