]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-4025.rs
Auto merge of #106827 - alexcrichton:update-llvm-to-15.0.7, r=cuviper
[rust.git] / tests / ui / issues / issue-4025.rs
1 // check-pass
2 #![allow(dead_code)]
3 #![allow(unused_mut)]
4 /*
5 # if b { x } else { y } requires identical types for x and y
6 */
7
8 fn print1(b: bool, s1: &str, s2: &str) {
9     println!("{}", if b { s1 } else { s2 });
10 }
11 fn print2<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) {
12     println!("{}", if b { s1 } else { s2 });
13 }
14 fn print3(b: bool, s1: &str, s2: &str) {
15     let mut s: &str;
16     if b { s = s1; } else { s = s2; }
17     println!("{}", s);
18 }
19 fn print4<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) {
20     let mut s: &str;
21     if b { s = s1; } else { s = s2; }
22     println!("{}", s);
23 }
24
25 pub fn main() {}