about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-12-12 09:55:50 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-12-12 15:54:25 +1100
commit226edf64fa58e591d8abc6afef5e38c15c181698 (patch)
tree794954d943af6c79141f6a967b6d3dfb23ea2518 /tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parent57010939ed1d00076b4af0ed06a81ec69ea5e4a8 (diff)
downloadrust-226edf64fa58e591d8abc6afef5e38c15c181698.tar.gz
rust-226edf64fa58e591d8abc6afef5e38c15c181698.zip
Improve an error involving attribute values.
Attribute values must be literals. The error you get when that doesn't
hold is pretty bad, e.g.:
```
unexpected expression: 1 + 1
```
You also get the same error if the attribute value is a literal, but an
invalid literal, e.g.:
```
unexpected expression: "foo"suffix
```

This commit does two things.
- Changes the error message to "attribute value must be a literal",
  which gives a better idea of what the problem is and how to fix it. It
  also no longer prints the invalid expression, because the carets below
  highlight it anyway.
- Separates the "not a literal" case from the "invalid literal" case.
  Which means invalid literals now get the specific error at the literal
  level, rather than at the attribute level.
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions