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

Support negative, char & bool const generics #12778

Merged

Conversation

Logarithmus
Copy link
Contributor

@Logarithmus Logarithmus commented Jul 17, 2022

Before:
Before

After:
After

I tried to implement stuff like Const<{NUM1 + 3 + NUM2}> by using already existing constant evaluation mechanism for ordinary constants, but turned out to be harder than I thought, maybe because I've never ever tinkered with compilers before

@Logarithmus Logarithmus changed the title feature/fix negative const generics Support negative, char & bool const generics Jul 17, 2022
* feat: support `bool` & `char` const generics
@Logarithmus Logarithmus force-pushed the feature/fix-negative-const-generics branch from cee0781 to a96f0aa Compare July 17, 2022 01:22
@flodiebold flodiebold self-assigned this Jul 17, 2022
Copy link
Member

@flodiebold flodiebold left a comment

Choose a reason for hiding this comment

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

Thanks! Handling non-trivial expressions is indeed currently blocked on some larger refactorings to actually handle const expressions (that I have been not making much progress on for a while now...).

lib/la-arena/src/lib.rs Outdated Show resolved Hide resolved
crates/hir-def/src/body/lower.rs Outdated Show resolved Hide resolved
crates/hir-def/src/path/lower.rs Outdated Show resolved Hide resolved
crates/hir-def/src/type_ref.rs Outdated Show resolved Hide resolved
crates/hir-ty/src/infer/pat.rs Show resolved Hide resolved
crates/hir-ty/src/consteval.rs Outdated Show resolved Hide resolved
crates/hir-ty/src/interner.rs Show resolved Hide resolved
crates/hir-ty/src/tests/simple.rs Outdated Show resolved Hide resolved
@Logarithmus Logarithmus requested a review from flodiebold July 17, 2022 15:22
@Logarithmus
Copy link
Contributor Author

@flodiebold please, take a look again after CI is passed

@flodiebold
Copy link
Member

LGTM, thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Jul 17, 2022

📌 Commit 83177a7 has been approved by flodiebold

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jul 17, 2022

⌛ Testing commit 83177a7 with merge db6a85d...

@bors
Copy link
Contributor

bors commented Jul 17, 2022

☀️ Test successful - checks-actions
Approved by: flodiebold
Pushing db6a85d to master...

@bors bors merged commit db6a85d into rust-lang:master Jul 17, 2022
@Logarithmus Logarithmus deleted the feature/fix-negative-const-generics branch July 17, 2022 17:27
bors added a commit that referenced this pull request Jul 17, 2022
…s, r=Veykril

fix: un-inline `ConstScalarOrPath::from_expr_opt`

Sorry, but I missed these from #12778 `@flodiebold`
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.

3 participants