Skip to content
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

fix: Fix lowering of FnOnce() without return type #8987

Merged
merged 2 commits into from May 25, 2021

Conversation

flodiebold
Copy link
Member

This should result in an implicit -> (), not leaving out the binding.

This should result in an implicit `-> ()`, not leaving out the binding.
@flodiebold
Copy link
Member Author

bors r+

bors bot added a commit that referenced this pull request May 25, 2021
8987: Fix lowering of FnOnce() without return type r=flodiebold a=flodiebold

This should result in an implicit `-> ()`, not leaving out the binding.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
@bors
Copy link
Contributor

bors bot commented May 25, 2021

Build failed:

@lnicola
Copy link
Member

lnicola commented May 25, 2021

thread 'inlay_hints::tests::fn_hints' panicked at 'assertion failed: `(left == right)`
  left: `[(473..476, "impl Fn()"), (516..519, "impl Fn(f64)"), (563..566, "impl Fn(f64, f64)"), (615..618, "impl Fn(f64, f64) -> u32"), (674..677, "&dyn Fn(f64, f64) -> u32"), (733..736, "&dyn Fn(&dyn Fn(f64, f64) -> u32, f64) -> u32"), (813..816, "impl Fn(f64, f64) -> u32 + Sized"), (880..883, "*const (impl Fn(f64, f64) -> u32 + Sized)")]`,
 right: `[(473..476, "impl Fn() -> ()"), (516..519, "impl Fn(f64) -> ()"), (563..566, "impl Fn(f64, f64) -> ()"), (615..618, "impl Fn(f64, f64) -> u32"), (674..677, "&dyn Fn(f64, f64) -> u32"), (733..736, "&dyn Fn(&dyn Fn(f64, f64) -> u32, f64) -> u32"), (813..816, "impl Fn(f64, f64) -> u32 + Sized"), (880..883, "*const (impl Fn(f64, f64) -> u32 + Sized)")]`: 
Expected:
[
    (
        473..476,
        "impl Fn()",
    ),
    (
        516..519,
        "impl Fn(f64)",
    ),
    (
        563..566,
        "impl Fn(f64, f64)",
    ),
    (
        615..618,
        "impl Fn(f64, f64) -> u32",
    ),
    (
        674..677,
        "&dyn Fn(f64, f64) -> u32",
    ),
    (
        733..736,
        "&dyn Fn(&dyn Fn(f64, f64) -> u32, f64) -> u32",
    ),
    (
        813..816,
        "impl Fn(f64, f64) -> u32 + Sized",
    ),
    (
        880..883,
        "*const (impl Fn(f64, f64) -> u32 + Sized)",
    ),
]

Actual:
[
    (
        473..476,
        "impl Fn() -> ()",
    ),
    (
        516..519,
        "impl Fn(f64) -> ()",
    ),
    (
        563..566,
        "impl Fn(f64, f64) -> ()",
    ),
    (
        615..618,
        "impl Fn(f64, f64) -> u32",
    ),
    (
        674..677,
        "&dyn Fn(f64, f64) -> u32",
    ),
    (
        733..736,
        "&dyn Fn(&dyn Fn(f64, f64) -> u32, f64) -> u32",
    ),
    (
        813..816,
        "impl Fn(f64, f64) -> u32 + Sized",
    ),
    (
        880..883,
        "*const (impl Fn(f64, f64) -> u32 + Sized)",
    ),
]'

Looks like we display extra -> ()s.

Also,

image

Is this the --nocapture we're passing?

@flodiebold
Copy link
Member Author

bors r+

Is this the --nocapture we're passing?

Probably?

@bors
Copy link
Contributor

bors bot commented May 25, 2021

@bors bors bot merged commit 33fdd51 into rust-lang:master May 25, 2021
@flodiebold flodiebold deleted the closure-returning-unit branch May 25, 2021 13:33
@lnicola
Copy link
Member

lnicola commented May 25, 2021

As seen in the metrics:

image

@Veykril Veykril changed the title Fix lowering of FnOnce() without return type fix: Fix lowering of FnOnce() without return type May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants