Suggest correct path in include_bytes!
This commit is contained in:
parent
89ceced6f6
commit
826ddb3018
6 changed files with 209 additions and 37 deletions
|
@ -1376,6 +1376,15 @@ pub fn get_single_str_from_tts(
|
|||
tts: TokenStream,
|
||||
name: &str,
|
||||
) -> ExpandResult<Result<Symbol, ErrorGuaranteed>, ()> {
|
||||
get_single_str_spanned_from_tts(cx, span, tts, name).map(|res| res.map(|(s, _)| s))
|
||||
}
|
||||
|
||||
pub fn get_single_str_spanned_from_tts(
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
span: Span,
|
||||
tts: TokenStream,
|
||||
name: &str,
|
||||
) -> ExpandResult<Result<(Symbol, Span), ErrorGuaranteed>, ()> {
|
||||
let mut p = cx.new_parser_from_tts(tts);
|
||||
if p.token == token::Eof {
|
||||
let guar = cx.dcx().emit_err(errors::OnlyOneArgument { span, name });
|
||||
|
@ -1390,7 +1399,13 @@ pub fn get_single_str_from_tts(
|
|||
if p.token != token::Eof {
|
||||
cx.dcx().emit_err(errors::OnlyOneArgument { span, name });
|
||||
}
|
||||
expr_to_string(cx, ret, "argument must be a string literal").map(|s| s.map(|(s, _)| s))
|
||||
expr_to_spanned_string(cx, ret, "argument must be a string literal").map(|res| {
|
||||
res.map_err(|err| match err {
|
||||
Ok((err, _)) => err.emit(),
|
||||
Err(guar) => guar,
|
||||
})
|
||||
.map(|(symbol, _style, span)| (symbol, span))
|
||||
})
|
||||
}
|
||||
|
||||
/// Extracts comma-separated expressions from `tts`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue