1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 macro_rules! register_diagnostic {
13 ($code:tt, $description:tt) => (__register_diagnostic! { $code, $description });
14 ($code:tt) => (__register_diagnostic! { $code })
18 macro_rules! span_fatal {
19 ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({
20 __diagnostic_used!($code);
21 $session.span_fatal_with_code($span, &format!($($message)*), stringify!($code))
26 macro_rules! span_err {
27 ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({
28 __diagnostic_used!($code);
29 $session.span_err_with_code($span, &format!($($message)*), stringify!($code))
34 macro_rules! span_warn {
35 ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({
36 __diagnostic_used!($code);
37 $session.span_warn_with_code($span, &format!($($message)*), stringify!($code))
42 macro_rules! span_note {
43 ($session:expr, $span:expr, $($message:tt)*) => ({
44 ($session).span_note($span, &format!($($message)*))
49 macro_rules! span_help {
50 ($session:expr, $span:expr, $($message:tt)*) => ({
51 ($session).span_help($span, &format!($($message)*))
56 macro_rules! fileline_help {
57 ($session:expr, $span:expr, $($message:tt)*) => ({
58 ($session).fileline_help($span, &format!($($message)*))
63 macro_rules! register_diagnostics {
65 $(register_diagnostic! { $code })*
68 $(register_diagnostic! { $code })*
73 macro_rules! register_long_diagnostics {
74 ($($code:tt: $description:tt),*) => (
75 $(register_diagnostic! { $code, $description })*