-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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_evaluatable_unchecked
doesn't correctly deal with non default substs
#94293
Comments
Anonymous constants currently inherit all of their parents generics, so for This would mean that pretty much all anonymous constants would cause that lint, so we add a flag to their MIR to detect whether they actually use any generic parameter: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Body.html#structfield.is_polymorphic.
We should just disable the cc @BoxyUwU |
Another similar. Short example failing on Nightly (thanks to ilyvion#9946 for narrowing it down): https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=c133c09b2fa155bb3f4b9ee45e6c011e: #![feature(generic_const_exprs)]
trait Foo<const N: usize>
where
[(); check_empty_array_size(N)]: Sized,
{
type Narr: Foo<0>;
}
#[allow(unused_variables)]
pub const fn check_empty_array_size(array_size: usize) -> usize {
0
} My use case: https://github.com/ranging-rs/slicing-rs/blob/main/src/slices/mod.rs#L48=. I know it's a semantic/voluntary constraint only, and it's quite recursive, but I believe it deserves its place. (Alternatives I tried are at ranging-rs/slicing-rs#1.) |
this has been fixed, needs test to close |
Signed-off-by: Yuki Okushi <[email protected]>
Add regression test for rust-lang#94293 Closes rust-lang#94293 r? `@lcnr` Signed-off-by: Yuki Okushi <[email protected]>
Add regression test for rust-lang#94293 Closes rust-lang#94293 r? ``@lcnr`` Signed-off-by: Yuki Okushi <[email protected]>
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#105567 (KCFI test: Also support LLVM 16 output) - rust-lang#105847 (Ensure param-env is const before calling `eval_to_valtree`) - rust-lang#105983 (Add a missing early return in drop tracking `handle_uninhabited_return`) - rust-lang#106027 (rustdoc: simplify CSS and DOM for more-scraped-examples) - rust-lang#106035 (Migrate search tab title color to CSS variable) - rust-lang#106037 (Add regression test for rust-lang#94293) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#105567 (KCFI test: Also support LLVM 16 output) - rust-lang#105847 (Ensure param-env is const before calling `eval_to_valtree`) - rust-lang#105983 (Add a missing early return in drop tracking `handle_uninhabited_return`) - rust-lang#106027 (rustdoc: simplify CSS and DOM for more-scraped-examples) - rust-lang#106035 (Migrate search tab title color to CSS variable) - rust-lang#106037 (Add regression test for rust-lang#94293) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
While checking whether the fixed crate can be ported from typenum to nightly with
generic_const_exprs
, I hit this warning. I am not sure whether it's a false positive or whether the behavior I want is meant to be disallowed, but I think it should be allowed when enablinggeneric_const_exprs
.I've reduced the code though I left some stuff to show why it would be useful.
Originally posted by @tspiteri in #76200 (comment)
The text was updated successfully, but these errors were encountered: