Skip to content

Commit

Permalink
simplify hash without frozen error message
Browse files Browse the repository at this point in the history
Co-authored-by: David Hewitt <[email protected]>
  • Loading branch information
Icxolu and davidhewitt committed May 26, 2024
1 parent 68a2cd7 commit 228d901
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyo3-macros-backend/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ fn pyclass_hash(
ctx: &Ctx,
) -> Result<(Option<syn::ImplItemFn>, Option<MethodAndSlotDef>)> {
if options.hash.is_some() && options.frozen.is_none() {
bail_spanned!(options.hash.span() => "The `hash` option can only be using in conjunction with `frozen`.");
bail_spanned!(options.hash.span() => "The `hash` option requires the `frozen` option.");
}
// FIXME: Use hash.map(...).unzip() on MSRV >= 1.66
match options.hash {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/invalid_pyclass_args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ error: a `#[pyclass]` cannot be both a `mapping` and a `sequence`
31 | struct CannotBeMappingAndSequence {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: The `hash` option can only be using in conjunction with `frozen`.
error: The `hash` option requires the `frozen` option.
--> tests/ui/invalid_pyclass_args.rs:36:11
|
36 | #[pyclass(hash)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/invalid_pyclass_enum.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ error: `constructor` can't be used on a simple enum variant
26 | #[pyo3(constructor = (a, b))]
| ^^^^^^^^^^^

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

0 comments on commit 228d901

Please sign in to comment.