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

assert_eq! fails with const { .. } in Rust 2024 #133081

Closed
traviscross opened this issue Nov 15, 2024 · 8 comments · Fixed by #138162
Closed

assert_eq! fails with const { .. } in Rust 2024 #133081

traviscross opened this issue Nov 15, 2024 · 8 comments · Fixed by #138162
Labels
A-edition-2024 Area: The 2024 edition A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-edition-triaged Issue: This issue has been reviewed and triaged by the Edition team. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@traviscross
Copy link
Contributor

This code fails to compile in Rust 2024 when it should pass:

//@ edition:2024
fn main() {
    assert_eq!(0, const { 0 });
    //~^ ERROR no rules expected keyword `const`
}

This will be fixed, I expect, by migrating the standard library to Rust 2024, and when doing that, by using the :expr rather than :expr_2021 macro fragment specifier in assert_eq and similar macros.

cc @rust-lang/wg-macros @compiler-errors @ehuss

@traviscross traviscross added A-edition-2024 Area: The 2024 edition A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 15, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 15, 2024
@traviscross traviscross changed the title assert_eq fails with const { .. } in Rust 2024 assert_eq! fails with const { .. } in Rust 2024 Nov 15, 2024
@compiler-errors
Copy link
Member

Yeah, this will begin working as soon as the standard library is upgraded to 2024. I don't think there's anything actionable to do here.

@tgross35
Copy link
Contributor

Maybe this could go in tests/crashes (without the //~) so it gets noted once that upgrade happens and it starts passing? Not sure if tests/crashes is only crashes or just a more general xfail.

@compiler-errors
Copy link
Member

Crashes is for ICEs only

@traviscross traviscross removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 15, 2024
@traviscross
Copy link
Contributor Author

It could go in as a known-bug UI test I would expect.

@ehuss
Copy link
Contributor

ehuss commented Nov 15, 2024

I think this is mostly a duplicate of #126459. No standard library macros with expr will work with bare const{} until the standard library is updated (regardless of the calling crate's edition). This isn't specific to assert_eq. The same goes for any user crates which have exported macros.

@nikomatsakis

This comment has been minimized.

@nikomatsakis

This comment has been minimized.

@ehuss

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this issue Mar 7, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081

(Draft while I do some try jobs, as this is a high-risk of breakage.)

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: arm-android
try-job: armhf-gnu
try-job: dist-aarch64-apple
try-job: dist-aarch64-linux
try-job: dist-aarch64-msvc
try-job: dist-android
try-job: dist-apple-various
try-job: dist-arm-linux
try-job: dist-armhf-linux
try-job: dist-armv7-linux
try-job: dist-i586-gnu-i586-i686-musl
try-job: dist-i686-linux
try-job: dist-i686-mingw
try-job: dist-i686-msvc
try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
try-job: dist-ohos
try-job: dist-powerpc-linux
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 7, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081

(Draft while I do some try jobs, as this is a high-risk of breakage.)

try-job: dist-powerpc64-linux
try-job: dist-powerpc64le-linux
try-job: dist-riscv64-linux
try-job: dist-s390x-linux
try-job: dist-various-1
try-job: dist-various-2
try-job: dist-x86_64-apple
try-job: dist-x86_64-freebsd
try-job: dist-x86_64-illumos
try-job: dist-x86_64-linux
try-job: dist-x86_64-mingw
try-job: dist-x86_64-msvc
try-job: dist-x86_64-musl
try-job: dist-x86_64-netbsd
try-job: i686-gnu-1
try-job: i686-gnu-2
try-job: i686-mingw-1
try-job: i686-mingw-2
try-job: i686-mingw-3
try-job: i686-msvc-1
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 8, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081

(Draft while I do some try jobs, as this is a high-risk of breakage.)

try-job: dist-powerpc64le-linux
try-job: i686-gnu-1
try-job: i686-msvc-1
try-job: i686-msvc-2
try-job: mingw-check
try-job: test-various
try-job: x86_64-apple-1
try-job: x86_64-apple-2
try-job: x86_64-fuchsia
try-job: x86_64-gnu-distcheck
try-job: x86_64-gnu-tools
try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: x86_64-msvc-ext1
try-job: x86_64-msvc-ext2
try-job: x86_64-msvc-ext3
try-job: x86_64-rust-for-linux
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 8, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081

(Draft while I do some try jobs, as this is a high-risk of breakage.)

try-job: dist-powerpc64le-linux
try-job: i686-gnu-1
try-job: i686-msvc-1
try-job: i686-msvc-2
try-job: x86_64-apple-1
try-job: x86_64-gnu-tools
try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: x86_64-msvc-ext1
try-job: x86_64-msvc-ext2
try-job: x86_64-msvc-ext3
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 10, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081

(Draft while I do some try jobs, as this is a high-risk of breakage.)

try-job: dist-powerpc64le-linux
try-job: i686-gnu-1
try-job: i686-msvc-1
try-job: i686-msvc-2
try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
try-job: x86_64-msvc-1
try-job: x86_64-msvc-ext1
try-job: x86_64-msvc-ext3
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 11, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081

(Draft while I do some try jobs, as this is a high-risk of breakage.)

try-job: dist-powerpc64le-linux
try-job: i686-gnu-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1
try-job: x86_64-msvc-1
try-job: x86_64-msvc-ext1
try-job: x86_64-msvc-ext3
jieyouxu added a commit to jieyouxu/rust that referenced this issue Mar 12, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081
jieyouxu added a commit to jieyouxu/rust that referenced this issue Mar 12, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 13, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081
@bors bors closed this as completed in 448aa30 Mar 13, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 13, 2025
Rollup merge of rust-lang#138162 - ehuss:library-2024, r=cuviper

Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Mar 14, 2025
Update the standard library to Rust 2024

This updates the standard library to Rust 2024. This includes the following notable changes:

- Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now.
- Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)).

Fixes rust-lang#133081
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2024 Area: The 2024 edition A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-edition-triaged Issue: This issue has been reviewed and triaged by the Edition team. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants