-
Notifications
You must be signed in to change notification settings - Fork 13.3k
return the correct type for closures in type_of
#91055
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
Conversation
@lcnr This feels like a step backward to me. Can you say a bit more about what's motivating it? In general, I feel like the way things are expected to work is that |
yes, that is also my mental model for With this change you can now actually call ¹: that is a more precise description of my mental model for |
@lcnr that makes sense, but I'm a bit confused. Why did that not work before? I guess maybe the question is "what are these substs you are using". I would have expected them to be the closure substs, which would then give a value for those closure type arguments and so forth, right? |
here's an example in case that might help fn foo<T: Into<i32>, U>(x: T) -> i32 {
let x = |y: i32| y + x.into();
x(3)
} before this PR, the type returned by
while with this PR, the type returned by
Before this PR, the only way With this PR, we can simply call subst with arguments for |
📌 Commit 6bd534d has been approved by |
return the correct type for closures in `type_of` A bit unhappy about the way `typeck::check_crate` works rn. Would have preferred to not change `CollectItemTypesVisitor` in this way. r? `@nikomatsakis`
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#91055 (return the correct type for closures in `type_of`) - rust-lang#92207 (Delay remaining `span_bug`s in drop elaboration) - rust-lang#92417 (Fix spacing and ordering of words in pretty printed Impl) - rust-lang#92504 (Exit nonzero on rustc -Wall) - rust-lang#92559 (RustWrapper: adapt to new AttributeMask API) - rust-lang#92589 (Break the loop) - rust-lang#92607 (rustc_metadata: Some minor cleanups and optimizations) - rust-lang#92620 (Remove unused `ExtendDefault` struct) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
A bit unhappy about the way
typeck::check_crate
works rn. Would have preferred to not changeCollectItemTypesVisitor
in this way.r? @nikomatsakis