-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Non-'static Lifetimes in Const Generics #74052
Labels
A-const-generics
Area: const generics (parameters and arguments)
A-lifetimes
Area: Lifetimes / regions
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Comments
jonas-schievink
added
A-const-generics
Area: const generics (parameters and arguments)
A-lifetimes
Area: Lifetimes / regions
F-const_generics
`#![feature(const_generics)]`
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
labels
Jul 5, 2020
JohnTitor
added
the
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
label
Jul 5, 2020
This is "just" an implementation limitation, correct? |
Mostly, it should be theoretically fine, but ends up with similar problems to what #74113 ended up solving. It also has some open design questions IMO, which I don't want to care about for now 😆 |
github-actions bot
pushed a commit
to rust-lang/glacier
that referenced
this issue
Jul 23, 2020
=== stdout === === stderr === warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes --> /home/runner/work/glacier/glacier/ices/56445-2.rs:1:12 | 1 | #![feature(const_generics)] | ^^^^^^^^^^^^^^ | = note: `#[warn(incomplete_features)]` on by default = note: see issue #44580 <rust-lang/rust#44580> for more information error[E0771]: use of non-static lifetime `'a` in const generic --> /home/runner/work/glacier/glacier/ices/56445-2.rs:6:26 | 6 | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); | ^^ | = note: for more information, see issue #74052 <rust-lang/rust#74052> error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0771`. ==============
github-actions bot
pushed a commit
to rust-lang/glacier
that referenced
this issue
Jul 23, 2020
=== stdout === === stderr === warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes --> /home/runner/work/glacier/glacier/ices/60814.rs:1:12 | 1 | #![feature(const_generics)] | ^^^^^^^^^^^^^^ | = note: `#[warn(incomplete_features)]` on by default = note: see issue #44580 <rust-lang/rust#44580> for more information error[E0771]: use of non-static lifetime `'a` in const generic --> /home/runner/work/glacier/glacier/ices/60814.rs:3:45 | 3 | pub fn function_with_str<'a, const STRING: &'a str>() { | ^^ | = note: for more information, see issue #74052 <rust-lang/rust#74052> error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0771`. ==============
BoxyUwU
added
F-adt_const_params
`#![feature(adt_const_params)]`
and removed
F-const_generics
`#![feature(const_generics)]`
labels
Jun 28, 2022
This is part of generic const parameter types. The design work for that is tracked in rust-lang/project-const-generics#28. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-const-generics
Area: const generics (parameters and arguments)
A-lifetimes
Area: Lifetimes / regions
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
We currently don't correctly handle non-
'static
lifetimes in const generics. Until #74051 is merged we ICE when a non-'static
lifetime is hit, as seen in #60814.Many uses for const generics does not hit this limitation, but the following case has been brought up:
as quoted from @lcnr on Zulip
@varkor @eddyb @nikomatsakis
The text was updated successfully, but these errors were encountered: