-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #106400 - estebank:type-errs, r=compiler-errors
Point at expressions where inference refines an unexpected type Fix #106355. Fix #14007. (!) ``` error[E0308]: mismatched types --> src/test/ui/type/type-check/point-at-inference.rs:12:9 | 9 | foo.push(i); | - this is of type `&{integer}`, which makes `foo` to be inferred as `Vec<&{integer}>` ... 12 | bar(foo); | --- ^^^ expected `i32`, found `&{integer}` | | | arguments to this function are incorrect | = note: expected struct `Vec<i32>` found struct `Vec<&{integer}>` note: function defined here --> src/test/ui/type/type-check/point-at-inference.rs:2:4 | 2 | fn bar(_: Vec<i32>) {} | ^^^ ----------- help: consider dereferencing the borrow | 9 | foo.push(*i); | + ```
- Loading branch information
Showing
13 changed files
with
409 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fn bar(_: Vec<i32>) {} | ||
fn baz(_: &Vec<&i32>) {} | ||
fn main() { | ||
let v = vec![&1]; | ||
bar(v); //~ ERROR E0308 | ||
let v = vec![]; | ||
baz(&v); | ||
baz(&v); | ||
bar(v); //~ ERROR E0308 | ||
let v = vec![]; | ||
baz(&v); | ||
bar(v); //~ ERROR E0308 | ||
} |
Oops, something went wrong.