Skip to content

Commit

Permalink
Absolute path to refer to core crate in compile_error expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 30, 2023
1 parent 4d1fd26 commit cc7cf99
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,18 @@ impl ErrorMessage {
None => (Span::call_site(), Span::call_site()),
};

// core::compile_error!($message)
// ::core::compile_error!($message)
TokenStream::from_iter(vec![
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("core", start)),
TokenTree::Punct({
let mut punct = Punct::new(':', Spacing::Joint);
Expand Down

0 comments on commit cc7cf99

Please sign in to comment.