mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 13:13:18 +00:00 
			
		
		
		
	Fix false positive "Missing match arm".
This commit is contained in:
		
							parent
							
								
									6c0f20d79f
								
							
						
					
					
						commit
						2abb4c99fe
					
				@ -1119,6 +1119,7 @@ fn main() {
 | 
			
		||||
        (true, false, true) => (),
 | 
			
		||||
        (true) => (),
 | 
			
		||||
    }
 | 
			
		||||
    match (true, false) { (true,) => {} }
 | 
			
		||||
    match (0) { () => () }
 | 
			
		||||
    match Unresolved::Bar { Unresolved::Baz => () }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -126,11 +126,12 @@ impl<'a> InferenceContext<'a> {
 | 
			
		||||
                    _ => &[],
 | 
			
		||||
                };
 | 
			
		||||
 | 
			
		||||
                let (pre, post) = match ellipsis {
 | 
			
		||||
                    Some(idx) => args.split_at(idx),
 | 
			
		||||
                    None => (&args[..], &[][..]),
 | 
			
		||||
                let ((pre, post), n_uncovered_patterns) = match ellipsis {
 | 
			
		||||
                    Some(idx) => {
 | 
			
		||||
                        (args.split_at(idx), expectations.len().saturating_sub(args.len()))
 | 
			
		||||
                    }
 | 
			
		||||
                    None => ((&args[..], &[][..]), 0),
 | 
			
		||||
                };
 | 
			
		||||
                let n_uncovered_patterns = expectations.len().saturating_sub(args.len());
 | 
			
		||||
                let err_ty = self.err_ty();
 | 
			
		||||
                let mut expectations_iter =
 | 
			
		||||
                    expectations.iter().map(|a| a.assert_ty_ref(&Interner)).chain(repeat(&err_ty));
 | 
			
		||||
 | 
			
		||||
@ -732,7 +732,7 @@ fn foo(tuple: (u8, i16, f32)) {
 | 
			
		||||
            111..112 'a': u8
 | 
			
		||||
            114..115 'b': i16
 | 
			
		||||
            124..126 '{}': ()
 | 
			
		||||
            136..142 '(a, b)': (u8, i16, f32)
 | 
			
		||||
            136..142 '(a, b)': (u8, i16)
 | 
			
		||||
            137..138 'a': u8
 | 
			
		||||
            140..141 'b': i16
 | 
			
		||||
            146..161 '{/*too short*/}': ()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user