Properly display note/expected details#39905
Conversation
|
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
0d0793d to
b2f1fb2
Compare
|
Can we get a ui regression test (the more the better – even a UI test derived from one of affected (with red diff) compile-fail tests would be nice). Other than that it LGTM. |
|
📌 Commit b2f1fb2 has been approved by |
b2f1fb2 to
4781db3
Compare
|
@arielb1 Had to fix typo in test. |
4781db3 to
b72f768
Compare
b72f768 to
038a166
Compare
|
Are these the only tests affected? I would have thought dozens of tests would need to be updated. |
|
@jonathandturner I thought the same thing, but after a cursory check the specific cases where this error would trigger (type errors where the inner There were a few tests that could have triggered this, had they not used structs or enums defined in the test for the arg types. This triggers the error: fn takes_cb(f: fn(i8)) {}
fn main() {
fn callback(x: i32) {}
takes_cb(callback)
}while this doesn't: struct A {}
struct B {}
fn takes_cb(f: fn(A)) {}
fn main() {
fn callback(x: B) {}
takes_cb(callback)
} |
|
@bors r=arielb1 |
|
📌 Commit 038a166 has been approved by |
Properly display note/expected details
Given a file
```rust
fn takes_cb(f: fn(i8)) {}
fn main() {
fn callback(x: i32) {}
takes_cb(callback)
}
```
output
```rust
error[E0308]: mismatched types
--> file2.rs:5:22
|
5 | takes_cb(callback)
| ^^^^^^^^ expected i8, found i32
|
= note: expected type `fn(i8)`
found type `fn(i32) {main::callback}`
```
Fix rust-lang#39343.
Properly display note/expected details
Given a file
```rust
fn takes_cb(f: fn(i8)) {}
fn main() {
fn callback(x: i32) {}
takes_cb(callback)
}
```
output
```rust
error[E0308]: mismatched types
--> file2.rs:5:22
|
5 | takes_cb(callback)
| ^^^^^^^^ expected i8, found i32
|
= note: expected type `fn(i8)`
found type `fn(i32) {main::callback}`
```
Fix rust-lang#39343.
Properly display note/expected details
Given a file
```rust
fn takes_cb(f: fn(i8)) {}
fn main() {
fn callback(x: i32) {}
takes_cb(callback)
}
```
output
```rust
error[E0308]: mismatched types
--> file2.rs:5:22
|
5 | takes_cb(callback)
| ^^^^^^^^ expected i8, found i32
|
= note: expected type `fn(i8)`
found type `fn(i32) {main::callback}`
```
Fix rust-lang#39343.
Rollup of 28 pull requests - Successful merges: #39859, #39864, #39888, #39903, #39905, #39914, #39945, #39950, #39953, #39961, #39980, #39988, #39993, #39995, #40019, #40020, #40022, #40024, #40025, #40026, #40027, #40031, #40035, #40037, #40038, #40064, #40069, #40086 - Failed merges: #39927, #40008, #40047
|
Trying to fix bors, please ignore @bors r- |
Given a file
output
Fix #39343.