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

Format specifiers and runtime-logging macros die horribly with "use std::*;" #7838

Closed
bblum opened this issue Jul 17, 2013 · 2 comments
Closed
Labels
A-syntaxext Area: Syntax extensions

Comments

@bblum
Copy link
Contributor

bblum commented Jul 17, 2013

use std::*;

fn main() {
    println(fmt!("%s", "hello world"));
}

This innocent-looking hello world program emits a zillion horrible errors. Using error!() or fail!() is not pretty either.

horrible.rs:4:23: 4:30 error: unresolved import: could not find `unstable` in `std::std`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: use of undeclared module `::std::unstable::extfmt::rt`
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: `std::unstable::extfmt::rt::Conv` does not name a structure
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved import: could not find `unstable` in `std::std`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: use of undeclared module `::std::unstable::extfmt::rt`
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved name `std::unstable::extfmt::rt::flag_none`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved import: could not find `unstable` in `std::std`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: use of undeclared module `::std::unstable::extfmt::rt`
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved name `std::unstable::extfmt::rt::CountImplied`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved import: could not find `unstable` in `std::std`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: use of undeclared module `::std::unstable::extfmt::rt`
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved name `std::unstable::extfmt::rt::CountImplied`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved import: could not find `unstable` in `std::std`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: use of undeclared module `::std::unstable::extfmt::rt`
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved name `std::unstable::extfmt::rt::TyDefault`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved import: could not find `unstable` in `std::std`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: use of undeclared module `::std::unstable::extfmt::rt`
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
horrible.rs:4:23: 4:30 error: unresolved name `std::unstable::extfmt::rt::conv_str`.
horrible.rs:4     println(fmt!("%s", "hello"));
                                     ^~~~~~~
note: in expansion of fmt!
horrible.rs:4:12: 4:32 note: expansion site
error: aborting due to 18 previous errors
@alexcrichton
Copy link
Member

Dup of #7580 (although it's not fail it's fmt)

@bblum
Copy link
Contributor Author

bblum commented Jul 17, 2013

oops thanks

flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 21, 2021
…anishearth

Warn on structs with a trailing zero-sized array but no `repr` attribute

Closes rust-lang#2868

changelog: Implement ``[`trailing_empty_array`]``, which warns if a struct is defined where the last field is a zero-sized array but there are no `repr` attributes. Zero-sized arrays aren't very useful in Rust itself, so such a struct is likely being created to pass to C code or in some other situation where control over memory layout matters. Either way, a `repr` attribute is needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntaxext Area: Syntax extensions
Projects
None yet
Development

No branches or pull requests

2 participants