Skip to content

Resolve failures cause too many typechecking failures #31997

Closed
@alexcrichton

Description

@alexcrichton

I noticed that on #31618 there was a resolve failure from this line, specifically:

../src/libstd/sys/unix/pipe.rs:94:13: 94:25 error: unresolved name `libc::select` [E0425]
../src/libstd/sys/unix/pipe.rs:94             libc::select(max + 1, &mut read, 0 as *mut _, 0 as *mut _,
                                              ^~~~~~~~~~~~
../src/libstd/sys/unix/pipe.rs:90:9: 96:13 note: in this expansion of try! (defined in <core macros>)
../src/libstd/sys/unix/pipe.rs:94:13: 94:25 help: run `rustc --explain E0425` to see a detailed explanation
../src/libstd/sys/unix/pipe.rs:90:14: 90:19 error: the trait `core::num::One` is not implemented for the type `()` [E0277]
../src/libstd/sys/unix/pipe.rs:90         try!(cvt_r(|| unsafe {
                                               ^~~~~
../src/libstd/sys/unix/pipe.rs:90:9: 96:13 note: in this expansion of try! (defined in <core macros>)
../src/libstd/sys/unix/pipe.rs:90:14: 90:19 help: run `rustc --explain E0277` to see a detailed explanation
../src/libstd/sys/unix/pipe.rs:90:14: 90:19 note: required by `sys::cvt_r`
../src/libstd/sys/unix/pipe.rs:90:14: 90:19 error: the trait `core::ops::Neg` is not implemented for the type `()` [E0277]
../src/libstd/sys/unix/pipe.rs:90         try!(cvt_r(|| unsafe {
                                               ^~~~~
../src/libstd/sys/unix/pipe.rs:90:9: 96:13 note: in this expansion of try! (defined in <core macros>)
../src/libstd/sys/unix/pipe.rs:90:14: 90:19 help: run `rustc --explain E0277` to see a detailed explanation
../src/libstd/sys/unix/pipe.rs:90:14: 90:19 note: required by `sys::cvt_r`
../src/libstd/sys/unix/pipe.rs:94:46: 94:57 error: casting `usize` as `*mut _` is invalid
../src/libstd/sys/unix/pipe.rs:94             libc::select(max + 1, &mut read, 0 as *mut _, 0 as *mut _,
                                                                               ^~~~~~~~~~~
../src/libstd/sys/unix/pipe.rs:90:9: 96:13 note: in this expansion of try! (defined in <core macros>)
../src/libstd/sys/unix/pipe.rs:94:59: 94:70 error: casting `usize` as `*mut _` is invalid
../src/libstd/sys/unix/pipe.rs:94             libc::select(max + 1, &mut read, 0 as *mut _, 0 as *mut _,
                                                                                            ^~~~~~~~~~~
../src/libstd/sys/unix/pipe.rs:90:9: 96:13 note: in this expansion of try! (defined in <core macros>)
../src/libstd/sys/unix/pipe.rs:95:26: 95:37 error: casting `usize` as `*mut _` is invalid
../src/libstd/sys/unix/pipe.rs:95                          0 as *mut _)
                                                           ^~~~~~~~~~~
../src/libstd/sys/unix/pipe.rs:90:9: 96:13 note: in this expansion of try! (defined in <core macros>)

The only real error here is that libc::select doesn't exist. All other errors are spawned off of this. This unfortunately makes it pretty hard to hunt through errors and figure out which ones need to get fixed, and at this point I'm just training myself to only look at the first error as all others are likely not too useful.

I attempted to minimize this as well:

mod foo {}

fn bar<T: Clone>() {}

fn main() {
    bar(foo::bar());
}

But this yielded a different error message:

foo.rs:6:9: 6:17 error: unresolved name `foo::bar` [E0425]
foo.rs:6     bar(foo::bar());
                 ^~~~~~~~
foo.rs:6:9: 6:17 help: run `rustc --explain E0425` to see a detailed explanation
foo.rs:6:5: 6:20 error: this function takes 0 parameters but 1 parameter was supplied [E0061]
foo.rs:6     bar(foo::bar());
             ^~~~~~~~~~~~~~~
foo.rs:6:5: 6:20 help: run `rustc --explain E0061` to see a detailed explanation
error: aborting due to previous error

Note that on stable this yields a message which is actionable and concise:

foo.rs:6:9: 6:17 error: unresolved name `foo::bar` [E0425]
foo.rs:6     bar(foo::bar());
                 ^~~~~~~~
foo.rs:6:9: 6:17 help: run `rustc --explain E0425` to see a detailed explanation
error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions