Skip to content

cargo check fails oddly on binaries #3419

@alexcrichton

Description

@alexcrichton

Not entirely sure what's going on here....

// Cargo.toml
[package]
name = "lib"
version = "0.1.0"
authors = []

[dependencies]
rustc-serialize = "*"

// src/lib.rs
extern crate rustc_serialize;

use rustc_serialize::Decodable;

pub fn take<T: Decodable>() {}

// src/main.rs
extern crate rustc_serialize;

extern crate lib;

#[derive(RustcDecodable)]
pub struct Foo;

fn main() {
    lib::take::<Foo>();
}

With that structure:

$ cargo check
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling rustc-serialize v0.3.22
   Compiling lib v0.1.0 (file:///home/alex/code/lol)
error[E0277]: the trait bound `Foo: rustc_serialize::serialize::Decodable` is not satisfied
 --> src/main.rs:9:5
  |
9 |     lib::take::<Foo>();
  |     ^^^^^^^^^^^^^^^^ the trait `rustc_serialize::serialize::Decodable` is not implemented for `Foo`
  |
  = note: required by `lib::take`

error: aborting due to previous error

error: Could not compile `lib`.

To learn more, run the command again with --verbose.

@nrc mind taking a look?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions