Skip to content

coercions do not reach into aggregates - converging coercions #52075

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

Open
gnzlbg opened this issue Jul 5, 2018 · 2 comments
Open

coercions do not reach into aggregates - converging coercions #52075

gnzlbg opened this issue Jul 5, 2018 · 2 comments
Labels
A-coercions Area: implicit and explicit `expr as Type` coercions C-enhancement Category: An issue proposing an enhancement or a PR with one. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 5, 2018

This (playground):

fn foo() {}
fn bar() {}
fn main() {
    let _ = [(foo), (bar)]; // OK
    let _ = [(foo,), (bar,)]; // FAILS
}

fails to compile with the following error:

error[E0308]: mismatched types
 --> src/main.rs:5:23
  |
5 |     let _ = [(foo,), (bar,)]; // FAILS
  |                       ^^^ expected fn item, found a different fn item
  |
  = note: expected type `fn() {foo}`
             found type `fn() {bar}`
@gnzlbg gnzlbg changed the title coercions do not reach into aggregates coercions do not reach into aggregates - converging coercions Jul 5, 2018
@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jul 5, 2018

cc @eddyb

@hanna-kruppe
Copy link
Contributor

Aside: as @eddyb's working example shows, my description of coercions "not reaching into aggregates" is not actually correct.

@memoryruins memoryruins added the A-coercions Area: implicit and explicit `expr as Type` coercions label Sep 15, 2018
@Enselic Enselic added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coercions Area: implicit and explicit `expr as Type` coercions C-enhancement Category: An issue proposing an enhancement or a PR with one. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants