mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 05:57:03 +03:00
Add test.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
//@ check-pass
|
||||
|
||||
fn temp() -> (String, i32) {
|
||||
(String::from("Hello"), 1)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let a = &temp();
|
||||
let b = [(&temp(),)];
|
||||
let c = &temp().0;
|
||||
let d = &temp().0[..];
|
||||
let e = {
|
||||
let _ = 123;
|
||||
&(*temp().0)[..]
|
||||
};
|
||||
let f = if true {
|
||||
&temp()
|
||||
} else {
|
||||
&temp()
|
||||
};
|
||||
let g = match true {
|
||||
true => &temp(),
|
||||
false => {
|
||||
let _ = 123;
|
||||
&temp()
|
||||
}
|
||||
};
|
||||
println!("{a:?} {b:?} {c:?} {d:?} {e:?} {f:?} {g:?}");
|
||||
}
|
||||
Reference in New Issue
Block a user