summary refs log tree commit diff
path: root/src/liblog/macros.rs
AgeCommit message (Collapse)AuthorLines
2015-05-02fix doc:#1398 stop passing --cfg ndebug and uses -C debug-assertionsXuefeng Wu-1/+1
2015-03-15Strip all leading/trailing newlinesTamir Duberstein-1/+0
2015-03-11Example -> ExamplesSteve Klabnik-6/+6
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-05rustc: Add a debug_assertions #[cfg] directiveAlex Crichton-2/+2
This commit is an implementation of [RFC 563][rfc] which adds a new `cfg(debug_assertions)` directive which is specially recognized and calculated by the compiler. The flag is turned off at any optimization level greater than 1 and may also be explicitly controlled through the `-C debug-assertions` flag. [rfc]: https://github.com/rust-lang/rfcs/pull/563 The `debug_assert!` and `debug_assert_eq!` macros now respect this instead of the `ndebug` variable and `ndebug` no longer holds any meaning to the standard library. Code which was previously relying on `not(ndebug)` to gate expensive code should be updated to rely on `debug_assertions` instead. Closes #22492 [breaking-change]
2015-02-27register snapshot 880fb89Flavio Percoco-7/+0
2015-02-21Resolve barriers to changing column!() / line!() return type to u32 in ↵Brian Brooks-1/+8
#19284 . Address review comments in #21769 .
2015-02-21Resolve includeme.fragment conflict.Brian Brooks-1/+1
2015-02-02More deprecating of i/u suffixesAlfie John-3/+3
2015-01-30Remove all `i` suffixesTobias Bucher-2/+2
2015-01-05Revert "Remove i suffix in docs"Alex Crichton-2/+2
This reverts commit f031671c6ea79391eeb3e1ad8f06fe0e436103fb. Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
2015-01-05rollup merge of #20482: kmcallister/macro-reformAlex Crichton-14/+6
Conflicts: src/libflate/lib.rs src/libstd/lib.rs src/libstd/macros.rs src/libsyntax/feature_gate.rs src/libsyntax/parse/parser.rs src/libsyntax/show_span.rs src/test/auxiliary/macro_crate_test.rs src/test/compile-fail/lint-stability.rs src/test/run-pass/intrinsics-math.rs src/test/run-pass/tcp-connect-timeouts.rs
2015-01-05Replace #[phase] with #[plugin] / #[macro_use] / #[no_link]Keegan McAllister-12/+6
2015-01-05Remove i suffix in docsSteve Klabnik-2/+2
2015-01-05Stop using macro_escape as an inner attributeKeegan McAllister-2/+0
In preparation for the rename.
2014-12-30Register new snapshotsAlex Crichton-57/+0
2014-12-27Fallout of changing format_args!(f, args) to f(format_args!(args)).Eduard Burtescu-0/+57
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-12/+13
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-08-29doc: Runnable examples logging.Jonas Hietala-27/+88
Also use //! Instead of /*! in liblog.
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-5/+5
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-09Use phase(plugin) in other cratesKeegan McAllister-6/+6
2014-05-05log: Logger receiveis a LogRecordSean McArthur-1/+6
The logging macros now create a LogRecord, and pass that to the Logger, instead of passing a `level` and `args`. The new signature is: trait Logger { fn log(&mut self, record: &LogRecord); } The LogRecord includes additional values that may be useful to custom loggers, and also allows for further expansion if not values are found useful. DefaultLogger's formatting was taken from Python's default formatting: `LEVEL:from: message` Also included: fmt::Arguments now implement Show, so they can be used to extend format strings. [breaking-change]
2014-04-04Fix inner attribute syntax from `#[foo];` to `#![foo]`Timothée Ravier-6/+6
From the 0.10 changelog: * The inner attribute syntax has changed from `#[foo];` to `#![foo]`.
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-1/+1
Closes #2569
2014-03-15log: Introduce liblog, the old std::loggingAlex Crichton-0/+141
This commit moves all logging out of the standard library into an external crate. This crate is the new crate which is responsible for all logging macros and logging implementation. A few reasons for this change are: * The crate map has always been a bit of a code smell among rust programs. It has difficulty being loaded on almost all platforms, and it's used almost exclusively for logging and only logging. Removing the crate map is one of the end goals of this movement. * The compiler has a fair bit of special support for logging. It has the __log_level() expression as well as generating a global word per module specifying the log level. This is unfairly favoring the built-in logging system, and is much better done purely in libraries instead of the compiler itself. * Initialization of logging is much easier to do if there is no reliance on a magical crate map being available to set module log levels. * If the logging library can be written outside of the standard library, there's no reason that it shouldn't be. It's likely that we're not going to build the highest quality logging library of all time, so third-party libraries should be able to provide just as high-quality logging systems as the default one provided in the rust distribution. With a migration such as this, the change does not come for free. There are some subtle changes in the behavior of liblog vs the previous logging macros: * The core change of this migration is that there is no longer a physical log-level per module. This concept is still emulated (it is quite useful), but there is now only a global log level, not a local one. This global log level is a reflection of the maximum of all log levels specified. The previously generated logging code looked like: if specified_level <= __module_log_level() { println!(...) } The newly generated code looks like: if specified_level <= ::log::LOG_LEVEL { if ::log::module_enabled(module_path!()) { println!(...) } } Notably, the first layer of checking is still intended to be "super fast" in that it's just a load of a global word and a compare. The second layer of checking is executed to determine if the current module does indeed have logging turned on. This means that if any module has a debug log level turned on, all modules with debug log levels get a little bit slower (they all do more expensive dynamic checks to determine if they're turned on or not). Semantically, this migration brings no change in this respect, but runtime-wise, this will have a perf impact on some code. * A `RUST_LOG=::help` directive will no longer print out a list of all modules that can be logged. This is because the crate map will no longer specify the log levels of all modules, so the list of modules is not known. Additionally, warnings can no longer be provided if a malformed logging directive was supplied. The new "hello world" for logging looks like: #[phase(syntax, link)] extern crate log; fn main() { debug!("Hello, world!"); }