Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling --test with #[no_std] produces error span at first line #21021

Closed
nagisa opened this issue Jan 12, 2015 · 1 comment
Closed

Compiling --test with #[no_std] produces error span at first line #21021

nagisa opened this issue Jan 12, 2015 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@nagisa
Copy link
Member

nagisa commented Jan 12, 2015

#![crate_name="odd_span"]
#![no_std]

#[test]
fn t(){
}

will result in

test.rs:1:1: 1:4 error: unresolved import `std::slice::AsSlice`. Maybe a missing `extern crate std`?
test.rs:1 #![crate_name="odd_span"]
          ^~~
error: aborting due to previous error

Note the odd span and error location.

Since --test depends on libstd, maybe a following error message would be better?

test.rs:2:1: 1:4 error: Test harness binaries require std crate. Maybe a missing `extern crate std`?
test.rs:2 #![no_std]
          ^~~~~~~~~~
error: aborting due to previous error
@kmcallister kmcallister added A-diagnostics Area: Messages for errors, warnings, and lints A-freestanding labels Jan 12, 2015
@alexcrichton
Copy link
Member

Closing as a dupe of #18843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

3 participants