mirror of
https://github.com/rust-lang/rust
synced 2024-09-05 16:57:03 +00:00
b1575b71d4
When gathering locals, we introduce a `Sized` obligation for each binding in the pattern. *After* doing so, we typecheck the init expression. If this has a type failure, we store `{type error}`, for both the expression and the pattern. But later we store an inference variable for the pattern. We now avoid any override of an existing type on a hir node when they've already been marked as `{type error}`, and on E0277, when it comes from `VariableType` we silence the error in support of the type error. Fix #117846.
23 lines
297 B
Rust
23 lines
297 B
Rust
#![allow(warnings)]
|
|
|
|
fn issue_117846_repro() {
|
|
let (a, _) = if true {
|
|
produce()
|
|
} else {
|
|
(Vec::new(), &[]) //~ ERROR E0308
|
|
};
|
|
|
|
accept(&a);
|
|
}
|
|
|
|
struct Foo;
|
|
struct Bar;
|
|
|
|
fn produce() -> (Vec<Foo>, &'static [Bar]) {
|
|
todo!()
|
|
}
|
|
|
|
fn accept(c: &[Foo]) {}
|
|
|
|
fn main() {}
|