Resolve infered types when complaining about unexpected call type #89202
Resolve infered types when complaining about unexpected call type #89202bors merged 2 commits intorust-lang:masterfrom
Conversation
|
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
| } | ||
| } | ||
|
|
||
| let callee_ty = self.resolve_vars_if_possible(callee_ty); |
There was a problem hiding this comment.
I wonder why callee_ty is an TyVar and not an IntVar, I think we should dig into this a bit instead of just patching up the diagnostic
There was a problem hiding this comment.
I'm guessing the TyVar is coming from the {} block's tail expression not having unified yet?
There was a problem hiding this comment.
If that were the case, wouldn't we also see the tyvar, when using a function type?
I think we're doing something odd when type checking the literal expression.
I'm currently somewhere deep in that code anyway, I'll check and post my findings
There was a problem hiding this comment.
Yea, you're right. The tail block expression will fall back to a type variable in case we don't know anything about the type. This happens in
So... I guess we can't avoid this at creation time. oh well...
|
r? @oli-obk |
|
@bors r+ rollup |
|
📌 Commit 072d107 has been approved by |
Resolve infered types when complaining about unexpected call type
```
error[E0618]: expected function, found `{integer}`
--> $DIR/call-block.rs:2:13
|
LL | let _ = {42}();
| ^^^^--
| |
| call expression requires function
```
instead of
```
error[E0618]: expected function, found `_`
--> $DIR/call-block.rs:2:13
|
LL | let _ = {42}();
| ^^^^--
| |
| call expression requires function
```
Resolve infered types when complaining about unexpected call type
```
error[E0618]: expected function, found `{integer}`
--> $DIR/call-block.rs:2:13
|
LL | let _ = {42}();
| ^^^^--
| |
| call expression requires function
```
instead of
```
error[E0618]: expected function, found `_`
--> $DIR/call-block.rs:2:13
|
LL | let _ = {42}();
| ^^^^--
| |
| call expression requires function
```
Resolve infered types when complaining about unexpected call type
```
error[E0618]: expected function, found `{integer}`
--> $DIR/call-block.rs:2:13
|
LL | let _ = {42}();
| ^^^^--
| |
| call expression requires function
```
instead of
```
error[E0618]: expected function, found `_`
--> $DIR/call-block.rs:2:13
|
LL | let _ = {42}();
| ^^^^--
| |
| call expression requires function
```
…arth Rollup of 8 pull requests Successful merges: - rust-lang#88782 (Fix ICE when `start` lang item has wrong generics) - rust-lang#89202 (Resolve infered types when complaining about unexpected call type ) - rust-lang#89248 (Suggest similarly named associated items in trait impls) - rust-lang#89303 (Add `#[must_not_suspend]` to some types in std) - rust-lang#89306 (thread: implements available_concurrency on haiku) - rust-lang#89314 (fix(lint): don't suggest refutable patterns to "fix" irrefutable bind) - rust-lang#89370 (CTFE: tweak aggregate rvalue handling) - rust-lang#89392 (bootstrap: Update comment in config.library.toml.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
instead of