Skip to content

Conversation

@PoignardAzur
Copy link

These uses of assert_eq will be broken by changes to how the prelude handles macros: rust-lang/rust#139493.

These uses of assert_eq will be broken by changes to how the prelude handles macros: rust-lang/rust#139493.
@stbuehler
Copy link
Owner

I'm rather unhappy with this.

First of all: this should be no_std compatible, i.e. not use std.

But assert_eq actually is available in core. But why isn't it in the prelude (actually: it seems the mentioned PR does add it?); or: why does this break, where is it documented, and what is the actual proper fix for it?

@PoignardAzur
Copy link
Author

I'm rather confused. I cloned your repo 5 days ago, and made this PR based on what was then the master branch. (And indeed, the master branch did fail the crater tests.)

But now I look at the master branch and I see commits from 2024 which fixed the problem. Did you perhaps write those commits in 2024 and then not push them until last week? Otherwise, I'm not sure what happened.

But assert_eq actually is available in core. But why isn't it in the prelude (actually: it seems the mentioned PR does add it?); or: why does this break, where is it documented, and what is the actual proper fix for it?

assert_eq was previously auto-imported through an implicit #[macro_use] statement inserted in every file. The linked PR removes that #[macro_use] and instead imports std/core macros by putting them in the prelude.

This breaks a previous version of your code which used the attribute #![no_implicit_prelude]. I think the code on the current master branch is fine.

I'm pretty sure you don't need to do anything.

@stbuehler
Copy link
Owner

Sorry, I should have mentioned that; your request triggered me to check the "health" of this project a bit and I discovered old commits from 2024 that weren't pushed yet, and pushed them yesterday with a couple of new fixes.

Thanks for explaining the connection to #![no_implicit_prelude]; so cleaning that up was the correct fix :)

(I think I used no_implicit_prelude to avoid accidental std-usage; so another possible fix could have been to import the core prelude explicitly.)

@stbuehler stbuehler closed this Nov 10, 2025
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.

2 participants