Resolve possible inference disruption by removing unneeded From impl #398

Merged
dtolnay merged 1 commit from ra_hir_def into master 2020-06-03 23:05:51 -05:00
dtolnay commented 2020-06-03 21:04:45 -05:00 (Migrated from github.com)

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

github.com/rust-analyzer/rust-analyzer@1dba84019e/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 https://github.com/rust-lang/log/issues/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 ```console $ 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 https://github.com/rust-lang/log/issues/397.
KodrAus (Migrated from github.com) approved these changes 2020-06-03 23:05:44 -05:00
KodrAus (Migrated from github.com) left a comment

Thanks @dtolnay!

Thanks @dtolnay!
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-rust-lang/log!398
No description provided.