Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const fn-ify what can be const of the API #31

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

korken89
Copy link
Contributor

This helps to remove lazy initialization to initialize global static variables containing FxHashMap/FxHashSet.

This helps to remove lazy initialization to initialize
global static variables containing `FxHashMap`/`FxHashSet`.
Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

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

Thanks!

@WaffleLapkin WaffleLapkin merged commit 0450dc7 into rust-lang:master Feb 29, 2024
3 checks passed
FxHasher { hash: seed }
}

/// Create a default `fq` hasher.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: fq

Copy link
Contributor

Choose a reason for hiding this comment

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

Also: what's the point of creating a default function in this impl when Default is already impl'd? I'm actually surprised this even works.

Copy link
Member

Choose a reason for hiding this comment

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

The point is that it can be const. I think a different name would be nicer though.

Copy link
Member

@fmease fmease Feb 29, 2024

Choose a reason for hiding this comment

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

Default is not a #[const_trait] yet and feature const_trait_impl/effects is still very much WIP. The inherent associated function default can be used in const contexts contrary to the trait associated function. Inherent associated items have precedence over their trait counterpart.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, it could be called new

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.

5 participants