diff --git a/src/test/compile-fail/feature-gate-rustc-diagnostic-macros.rs b/src/test/compile-fail/feature-gate-rustc-diagnostic-macros.rs new file mode 100644 index 0000000000000..8286d833e8d22 --- /dev/null +++ b/src/test/compile-fail/feature-gate-rustc-diagnostic-macros.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that diagnostic macros are gated by `rustc_diagnostic_macros` feature +// gate + +__register_diagnostic!(E0001); +//~^ ERROR macro undefined: '__register_diagnostic!' + +fn main() { + __diagnostic_used!(E0001); + //~^ ERROR macro undefined: '__diagnostic_used!' +} + +__build_diagnostic_array!(DIAGNOSTICS); +//~^ ERROR macro undefined: '__build_diagnostic_array!'