Add variable name to const-evaluation error

This commit is contained in:
Tad Hardesty 2021-01-13 20:33:36 -08:00
parent a01f4116d6
commit 299f142b05

View file

@ -840,7 +840,7 @@ impl<'a> ConstantFolder<'a> {
while let Some(ty) = idx {
let location = self.location;
if self.tree.is_none() {
return Err(self.error("cannot reference variables in this context"));
return Err(self.error(format!("cannot reference variable {:?} in this context", ident)));
}
let tree = self.tree.as_mut().unwrap();
match constant_ident_lookup(tree, ty, &ident, must_be_const)