Skip to content

Conversation

@estebank
Copy link

When the "nightly" feature is enabled, implement const Default for FxHasher and FxBuildHasher. This allows for types like FxHashMap to be used through Default::default() on const contexts. Specifically, this will make it easier to dogfood feature(default_field_values) more extensively in the compiler, by being able to use field: FxHashSet<DefId> = Default::default() instead of field: FxHashSet<DefId> = FxHashSet::with_hasher(FxBuildHasher).

@Noratrieb
Copy link
Member

@oli-obk @fee1-dead @fmease are you fine with this?

@estebank
Copy link
Author

CC rust-lang/rust#151190

@fee1-dead
Copy link
Member

I think it is fine, yeah - just document why using a macro is necessary

When the "nightly" feature is enabled, implement `const Default` for
`FxHasher` and `FxBuildHasher`. This allows for types like `FxHashMap`
to be used through `Default::default()` on `const` contexts.
@estebank
Copy link
Author

Added comment. It is because impl const gets gated in the parser on stable, so just having the definition anywhere is a parse error. Putting it behind a gated macro side-steps the issue.

Copy link
Member

@Noratrieb Noratrieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me then, I just wanted to make sure this doesn't create a significant burden for future const trait refactors.

@Noratrieb
Copy link
Member

it would be nice if you could set up release-plz for the releases, like many other rust-lang repos :3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants