]> git.lizzy.rs Git - rust.git/blob - src/librustc_builtin_macros/compile_error.rs
Auto merge of #66899 - msizanoen1:riscv-std, r=alexcrichton
[rust.git] / src / librustc_builtin_macros / compile_error.rs
1 // The compiler code necessary to support the compile_error! extension.
2
3 use rustc_expand::base::{self, *};
4 use rustc_span::Span;
5 use syntax::tokenstream::TokenStream;
6
7 pub fn expand_compile_error<'cx>(
8     cx: &'cx mut ExtCtxt<'_>,
9     sp: Span,
10     tts: TokenStream,
11 ) -> Box<dyn base::MacResult + 'cx> {
12     let var = match get_single_str_from_tts(cx, sp, tts, "compile_error!") {
13         None => return DummyResult::any(sp),
14         Some(v) => v,
15     };
16
17     cx.span_err(sp, &var);
18
19     DummyResult::any(sp)
20 }