Skip to content

Commit

Permalink
Merge pull request 1431 from smoelius/compile-error
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 30, 2023
2 parents c58aceb + 07601a8 commit 4d1fd26
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,19 @@ impl ErrorMessage {
None => (Span::call_site(), Span::call_site()),
};

// compile_error!($message)
// core::compile_error!($message)
TokenStream::from_iter(vec![
TokenTree::Ident(Ident::new("core", start)),
TokenTree::Punct({
let mut punct = Punct::new(':', Spacing::Joint);
punct.set_span(start);
punct
}),
TokenTree::Punct({
let mut punct = Punct::new(':', Spacing::Alone);
punct.set_span(start);
punct
}),
TokenTree::Ident(Ident::new("compile_error", start)),
TokenTree::Punct({
let mut punct = Punct::new('!', Spacing::Alone);
Expand Down

0 comments on commit 4d1fd26

Please sign in to comment.