-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Point at expressions where inference refines an unexpected type #106400
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
...test/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
Outdated
Show resolved
Hide resolved
@compiler-errors I think I addressed all of your previous comments |
095a33e
to
b3488b2
Compare
Hm, I'm not sure if I fully grasp some of this method argument stuff, since it seems like this PR got rewritten since I last reviewed it. Need to spend some time reasoning with some of this logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nit: "make" here is a synonym of "cause" but I'm not sure if it works with the same construction?
r=me -- I may take a stab at this method code a bit later, but I don't want to block you and I'm still trying to think of a way to avoid theCollectAllMismatches
usage here.
@bors r=compiler-errors |
Point at expressions where inference refines an unexpected type Fix rust-lang#106355. Fix rust-lang#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); | + ```
⌛ Testing commit 25cf71e with merge cfbc12774406f0ed9a269e2c28275de9e0a45330... |
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
I'm very confused by this merge conflict, pulling and rebasing still builds 👀 |
- Only point at a the single expression where the found type was first inferred. - Find method call argument that might have caused the found type to be inferred. - Provide structured suggestion. - Apply some review comments. - Tweak wording.
```rust fn main() { let v = Vec::new(); v.push(0); v.push(0); v.push(""); } ``` now produces ``` error[E0308]: mismatched types --> $DIR/point-at-inference-3.rs:6:12 | LL | v.push(0); | - this is of type `{integer}`, which makes `v` to be inferred as `Vec<{integer}>` ... LL | v.push(""); | ---- ^^ expected integer, found `&str` | | | arguments to this function are incorrect | note: associated function defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ```
@bors r=compiler-errors |
⌛ Testing commit f98f2fc with merge 6660916f5ebc99a31603558493a43b72f7189242... |
💥 Test timed out |
@bors retry |
Rollup of 5 pull requests Successful merges: - rust-lang#106400 (Point at expressions where inference refines an unexpected type) - rust-lang#106491 (Fix error-index redirect to work with the back button.) - rust-lang#106494 (Add regression test for rust-lang#58355) - rust-lang#106499 (fix [type error] for error E0029 and E0277) - rust-lang#106502 (rustdoc: remove legacy user-select CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fix #106355. Fix #14007. (!)