mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Continue generating other symbols if an expr is not supported
This commit is contained in:
parent
65f0253334
commit
1078250f48
@ -60,6 +60,7 @@ enum Value {
|
|||||||
SameAsName,
|
SameAsName,
|
||||||
String(LitStr),
|
String(LitStr),
|
||||||
Env(LitStr),
|
Env(LitStr),
|
||||||
|
Unsupported(Expr),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for Symbol {
|
impl Parse for Symbol {
|
||||||
@ -88,13 +89,7 @@ impl Parse for Value {
|
|||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
Err(syn::Error::new_spanned(
|
Ok(Value::Unsupported(expr))
|
||||||
expr,
|
|
||||||
concat!(
|
|
||||||
"unsupported expression for symbol value; implement support for this in ",
|
|
||||||
file!(),
|
|
||||||
),
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +218,17 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
|
|||||||
let value = match &symbol.value {
|
let value = match &symbol.value {
|
||||||
Value::SameAsName => name.to_string(),
|
Value::SameAsName => name.to_string(),
|
||||||
Value::String(lit) => lit.value(),
|
Value::String(lit) => lit.value(),
|
||||||
Value::Env(_) => continue,
|
Value::Env(_) => continue, // in another loop below
|
||||||
|
Value::Unsupported(expr) => {
|
||||||
|
errors.list.push(syn::Error::new_spanned(
|
||||||
|
expr,
|
||||||
|
concat!(
|
||||||
|
"unsupported expression for symbol value; implement support for this in ",
|
||||||
|
file!(),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let idx = entries.insert(symbol.name.span(), &value, &mut errors);
|
let idx = entries.insert(symbol.name.span(), &value, &mut errors);
|
||||||
|
|
||||||
@ -249,7 +254,7 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
|
|||||||
for symbol in &input.symbols {
|
for symbol in &input.symbols {
|
||||||
let env_var = match &symbol.value {
|
let env_var = match &symbol.value {
|
||||||
Value::Env(lit) => lit,
|
Value::Env(lit) => lit,
|
||||||
_ => continue,
|
Value::SameAsName | Value::String(_) | Value::Unsupported(_) => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let value = match proc_macro::tracked_env::var(env_var.value()) {
|
let value = match proc_macro::tracked_env::var(env_var.value()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user