Skip to content

Resolve possible inference disruption by removing unneeded From impl#398

Merged
KodrAus merged 1 commit into
rust-lang:masterfrom
dtolnay:ra_hir_def
Jun 4, 2020
Merged

Resolve possible inference disruption by removing unneeded From impl#398
KodrAus merged 1 commit into
rust-lang:masterfrom
dtolnay:ra_hir_def

Conversation

@dtolnay
Copy link
Copy Markdown
Member

@dtolnay dtolnay commented Jun 4, 2020

This impl breaks some code in rust-analyzer's ra_hir_def crate.

https://github.com/rust-analyzer/rust-analyzer/blob/1dba84019e0f3e7175f204624629a52013332e52/crates/ra_hir_def/src/path.rs#L273-L307

$ cargo check --manifest-path crates/ra_hir_def/Cargo.toml
    Checking ra_hir_def v0.1.0
    Finished dev [unoptimized] target(s) in 0.75s

$ cargo check --manifest-path crates/ra_hir_def/Cargo.toml --features log/kv_unstable
    Checking ra_hir_def v0.1.0
error[E0282]: type annotations needed for the closure `fn(&str) -> std::result::Result<(), _>`
   --> crates/ra_hir_def/src/path.rs:278:17
    |
278 |                 f.write_str("::")?;
    |                 ^^^^^^^^^^^^^^^^^^ cannot infer type
    |
help: give this closure an explicit return type without `_` placeholders
    |
276 |         let mut add_segment = |s| -> std::result::Result<(), _> {
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Closes #397.

This impl breaks some code in rust-analyzer's ra_hir_def crate.

https://github.com/rust-analyzer/rust-analyzer/blob/1dba84019e0f3e7175f204624629a52013332e52/crates/ra_hir_def/src/path.rs#L273-L307

    $ cargo check --manifest-path crates/ra_hir_def/Cargo.toml
        Checking ra_hir_def v0.1.0
        Finished dev [unoptimized] target(s) in 0.75s

    $ cargo check --manifest-path crates/ra_hir_def/Cargo.toml --features log/kv_unstable
        Checking ra_hir_def v0.1.0
    error[E0282]: type annotations needed for the closure `fn(&str) -> std::result::Result<(), _>`
       --> crates/ra_hir_def/src/path.rs:278:17
        |
    278 |                 f.write_str("::")?;
        |                 ^^^^^^^^^^^^^^^^^^ cannot infer type
        |
    help: give this closure an explicit return type without `_` placeholders
        |
    276 |         let mut add_segment = |s| -> std::result::Result<(), _> {
        |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@dtolnay dtolnay requested a review from KodrAus June 4, 2020 02:04
Copy link
Copy Markdown
Contributor

@KodrAus KodrAus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dtolnay!

@KodrAus KodrAus merged commit c5c8e48 into rust-lang:master Jun 4, 2020
@dtolnay dtolnay deleted the ra_hir_def branch June 6, 2020 23:47
EFanZh pushed a commit to EFanZh/log that referenced this pull request Jul 23, 2023
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.

Enabling kv_unstable causes inference breakage

2 participants