Skip to content

Commit 228d901

Browse files
Icxoludavidhewitt
andcommitted
simplify hash without frozen error message
Co-authored-by: David Hewitt <[email protected]>
1 parent 68a2cd7 commit 228d901

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

pyo3-macros-backend/src/pyclass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ fn pyclass_hash(
16721672
ctx: &Ctx,
16731673
) -> Result<(Option<syn::ImplItemFn>, Option<MethodAndSlotDef>)> {
16741674
if options.hash.is_some() && options.frozen.is_none() {
1675-
bail_spanned!(options.hash.span() => "The `hash` option can only be using in conjunction with `frozen`.");
1675+
bail_spanned!(options.hash.span() => "The `hash` option requires the `frozen` option.");
16761676
}
16771677
// FIXME: Use hash.map(...).unzip() on MSRV >= 1.66
16781678
match options.hash {

tests/ui/invalid_pyclass_args.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ error: a `#[pyclass]` cannot be both a `mapping` and a `sequence`
5858
31 | struct CannotBeMappingAndSequence {}
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6060

61-
error: The `hash` option can only be using in conjunction with `frozen`.
61+
error: The `hash` option requires the `frozen` option.
6262
--> tests/ui/invalid_pyclass_args.rs:36:11
6363
|
6464
36 | #[pyclass(hash)]

tests/ui/invalid_pyclass_enum.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ error: `constructor` can't be used on a simple enum variant
3030
26 | #[pyo3(constructor = (a, b))]
3131
| ^^^^^^^^^^^
3232

33-
error: The `hash` option can only be using in conjunction with `frozen`.
33+
error: The `hash` option requires the `frozen` option.
3434
--> tests/ui/invalid_pyclass_enum.rs:37:11
3535
|
3636
37 | #[pyclass(hash)]

0 commit comments

Comments
 (0)