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

Explict kind declarations on types #3890

Closed
brson opened this issue Oct 31, 2012 · 3 comments
Closed

Explict kind declarations on types #3890

brson opened this issue Oct 31, 2012 · 3 comments
Labels
A-typesystem Area: The type system C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@brson
Copy link
Contributor

brson commented Oct 31, 2012

It's happened to me several times that I've known that a type needed to be Send or Const, but I didn't find out until after I had already defined it and tried to use it with a Send or Const type parameter that it wasn`t the right kind.

Something like this would maybe help:

struct Foo { ... }

impl Foo: Const;

It would basically not do anything except generate an error if it doesn't type check. I might actually prefer that even the kind traits must be declared explicitly.

@bblum
Copy link
Contributor

bblum commented Oct 31, 2012

that rule would make it the same as haskell's "deriving", no? My gut says it's nicer to have it automatically derive and have these as optional -- haskell gets by, but I think it's more often in rust that we rely on satisfying the inherent kinds.

@brson
Copy link
Contributor Author

brson commented Oct 31, 2012

Yes, it would be deriving, which is something we are adding for other purposes anyway.

@metajack
Copy link
Contributor

These traits are automatically inferred by the compiler now.

calebcartwright added a commit to calebcartwright/rust that referenced this issue Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants