Skip to content

Regression in what path is chosen for error messages #45070

Closed
@dtolnay

Description

@dtolnay
#[macro_use]
extern crate serde_derive;

#[derive(Serialize)]
struct S;

fn main() {
    i32::from(""); // error
}

Error with rustc 1.21.0-beta.3 (ea1fd7d 2017-09-15):

error[E0277]: the trait bound `i32: std::convert::From<&str>` is not satisfied
 --> src/main.rs:8:5
  |
8 |     i32::from(""); // error
  |     ^^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `i32`

Error with rustc 1.22.0-nightly (417c738 2017-10-05):

error[E0277]: the trait bound `i32: _IMPL_SERIALIZE_FOR_S::_serde::export::From<&str>` is not satisfied
 --> src/main.rs:8:5
  |
8 |     i32::from(""); // error
  |     ^^^^^^^^^ the trait `_IMPL_SERIALIZE_FOR_S::_serde::export::From<&str>` is not implemented for `i32`

I would expect the error message to show std::convert::From, not Serde's re-export at least in code that has nothing to do with Serde.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions