Skip to content

Instantly share code, notes, and snippets.

@zeonin

zeonin/output Secret

Created January 26, 2016 18:02
Show Gist options
  • Save zeonin/346e717a3bbdb161baf0 to your computer and use it in GitHub Desktop.
Save zeonin/346e717a3bbdb161baf0 to your computer and use it in GitHub Desktop.
rust-log macro expansion failure
<log macros>:1:37: 1:50 error: unresolved name `log::INFO` [E0425]
<log macros>:1 ( $ ( $ arg : tt ) * ) => ( log ! ( :: log:: INFO , $ ( $ arg ) * ) )
^~~~~~~~~~~~~
<log macros>:1:29: 1:68 note: in this expansion of log! (defined in <log macros>)
temp.rs:36:5: 36:27 note: in this expansion of info! (defined in <log macros>)
<log macros>:1:37: 1:50 help: run `rustc --explain E0425` to see a detailed explanation
<log macros>:3:28: 3:42 error: unresolved name `log::DEBUG` [E0425]
<log macros>:3 let lvl = $ lvl ; ( lvl != :: log:: DEBUG || cfg ! ( debug_assertions ) ) &&
^~~~~~~~~~~~~~
<log macros>:5:24: 5:45 note: in this expansion of log_enabled! (defined in <log macros>)
<log macros>:1:29: 1:68 note: in this expansion of log! (defined in <log macros>)
temp.rs:36:5: 36:27 note: in this expansion of info! (defined in <log macros>)
<log macros>:3:28: 3:42 help: run `rustc --explain E0425` to see a detailed explanation
<log macros>:4:8: 4:26 error: unresolved name `log::log_level` [E0425]
<log macros>:4 lvl <= :: log:: log_level ( ) && :: log:: mod_enabled (
^~~~~~~~~~~~~~~~~~
<log macros>:5:24: 5:45 note: in this expansion of log_enabled! (defined in <log macros>)
<log macros>:1:29: 1:68 note: in this expansion of log! (defined in <log macros>)
temp.rs:36:5: 36:27 note: in this expansion of info! (defined in <log macros>)
<log macros>:4:8: 4:26 help: run `rustc --explain E0425` to see a detailed explanation
<log macros>:4:35: 4:55 error: unresolved name `log::mod_enabled` [E0425]
<log macros>:4 lvl <= :: log:: log_level ( ) && :: log:: mod_enabled (
^~~~~~~~~~~~~~~~~~~~
<log macros>:5:24: 5:45 note: in this expansion of log_enabled! (defined in <log macros>)
<log macros>:1:29: 1:68 note: in this expansion of log! (defined in <log macros>)
temp.rs:36:5: 36:27 note: in this expansion of info! (defined in <log macros>)
<log macros>:4:35: 4:55 help: run `rustc --explain E0425` to see a detailed explanation
<log macros>:6:1: 6:13 error: unresolved name `log::log` [E0425]
<log macros>:6 :: log:: log ( lvl , & LOC , format_args ! ( $ ( $ arg ) + ) ) } } )
^~~~~~~~~~~~
<log macros>:1:29: 1:68 note: in this expansion of log! (defined in <log macros>)
temp.rs:36:5: 36:27 note: in this expansion of info! (defined in <log macros>)
<log macros>:6:1: 6:13 help: run `rustc --explain E0425` to see a detailed explanation
<log macros>:4:1: 4:5 error: structure `log::LogLocation` has no field named `line`
<log macros>:4 line : line ! ( ) , file : file ! ( ) , module_path : module_path ! ( ) , }
^~~~
<log macros>:4:1: 4:5 help: did you mean `__line`?
<log macros>:4 line : line ! ( ) , file : file ! ( ) , module_path : module_path ! ( ) , }
^~~~
<log macros>:4:22: 4:26 error: structure `log::LogLocation` has no field named `file`
<log macros>:4 line : line ! ( ) , file : file ! ( ) , module_path : module_path ! ( ) , }
^~~~
<log macros>:4:22: 4:26 help: did you mean `__file`?
<log macros>:4 line : line ! ( ) , file : file ! ( ) , module_path : module_path ! ( ) , }
^~~~
<log macros>:4:43: 4:54 error: structure `log::LogLocation` has no field named `module_path`
<log macros>:4 line : line ! ( ) , file : file ! ( ) , module_path : module_path ! ( ) , }
^~~~~~~~~~~
<log macros>:4:43: 4:54 help: did you mean `__module_path`?
<log macros>:4 line : line ! ( ) , file : file ! ( ) , module_path : module_path ! ( ) , }
^~~~~~~~~~~
error: aborting due to 8 previous errors
#![feature(lang_items,start)]
#![no_std]
#![no_main]
#[macro_use]
extern crate log;
#[lang = "panic_fmt"]
extern fn panic_fmt(args: &core::fmt::Arguments, file: &str, line: usize) -> ! {
loop {}
}
#[lang = "eh_personality"] extern fn eh_personality() {}
struct DummyLog;
impl log::Log for DummyLog {
fn enabled(&self, metadata: &log::LogMetadata) -> bool {
true
}
fn log(&self, record: &log::LogRecord) {}
}
#[start]
fn start() {
unsafe {
log::set_logger_raw(|max_log_level| {
static LOGGER: DummyLog = DummyLog;
max_log_level.set(log::LogLevelFilter::Info);
&DummyLog
});
}
info!("Hello World!");
loop {}
}
{
static LOC: ::log::LogLocation =
::log::LogLocation{line: 36u32,
file: "temp.rs",
module_path: "temp",};
let lvl = ::log::INFO;
if {
let lvl = lvl;
(lvl != ::log::DEBUG || true) && lvl <= ::log::log_level() &&
::log::mod_enabled(lvl, "temp")
} {
::log::log(lvl, &LOC,
::core::fmt::Arguments::new_v1({
static __STATIC_FMTSTR:
&'static [&'static str]
=
&["Hello World!"];
__STATIC_FMTSTR
},
&match () {
() => [],
}))
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment