Skip to content

document const items #3341

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

Closed
jesse99 opened this issue Sep 1, 2012 · 2 comments
Closed

document const items #3341

jesse99 opened this issue Sep 1, 2012 · 2 comments
Milestone

Comments

@jesse99
Copy link
Contributor

jesse99 commented Sep 1, 2012

Not sure these are documented at all, but it would be nice to list which types can be used with const items. In particular I think vectors and strings (yay!) can now be const items.

@kud1ing
Copy link

kud1ing commented Sep 6, 2012

I'd be happy if you could explain the need for the extra "const" keyword.
I was surprised when i found

const REPEAT: int = 5;

in the tutorial. Wouldn't it be possible to do

let REPEAT: int = 5;

also for global constants? Since REPEAT is not mutable it is constant?
Could you also have

const REPEAT: mut int = 5;

?

@brson
Copy link
Contributor

brson commented Oct 5, 2012

I added a section to the tutorial on constants, but haven't addressed @Lenny222's concerns.

jaisnan pushed a commit to jaisnan/rust-dev that referenced this issue Jul 29, 2024
Update Rust toolchain from nightly-2024-07-14 to nightly-2024-07-15
without any other source changes.
This is an automatically generated pull request. If any of the CI checks
fail, manual intervention is required. In such a case, review the
changes at https://github.com/rust-lang/rust from
rust-lang@fcaa6fd
up to
rust-lang@d9284af.
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

No branches or pull requests

4 participants