Commit eff2afa
committed
Make conflict order deterministic
Without this the following struct can be generated in many different ways:
```rust
struct StructFieldAttribute {
#[attribute(conflicts = [size_fn, ignore])]
size: Option<usize>,
#[attribute(conflicts = [size, ignore])]
size_fn: Option<syn::Ident>,
#[attribute(conflicts = [size, size_fn])]
ignore: bool,
}
```
Here's a diff from two consecutive runs of `cargo expand` on it:
```diff
$ diff -rup <(cargo expand) <(cargo expand)
...
--- /dev/fd/63 2025-09-22 19:25:06
+++ /dev/fd/62 2025-09-22 19:25:06
@@ -540,7 +540,7 @@ const _: () = {
__partial: StructFieldAttributePartial,
) -> ::attribute_derive::__private::syn::Result<Self> {
if let (::core::prelude::v1::Some(__a), ::core::prelude::v1::Some(__b)) = (
- &__partial.ignore,
+ &__partial.size,
&__partial.size_fn,
) {
if let ::core::prelude::v1::Some(__joined_span) = __a
@@ -550,19 +550,19 @@ const _: () = {
return ::core::prelude::v1::Err(
::attribute_derive::__private::syn::Error::new(
__joined_span,
- "`ignore` conflicts with mutually exclusive `size_fn`",
+ "`size` conflicts with mutually exclusive `size_fn`",
),
);
} else {
let mut __error = ::attribute_derive::__private::syn::Error::new(
__a.error_span(),
- "`ignore` conflicts with mutually exclusive `size_fn`",
+ "`size` conflicts with mutually exclusive `size_fn`",
);
__error
...
```
This in turn makes it harder for sccache to do its job. Having a sorted
vector of conflicts rather than an ordered hashset fixes this problem.1 parent 16cbc65 commit eff2afa
2 files changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
464 | 469 | | |
465 | 470 | | |
466 | 471 | | |
| |||
0 commit comments