Automatic prelude import

I know is it not possible to have automatic prelude import on stable, but what about nightly? There is a feature called 'prelude_import' used here: lib.rs - source. I tried to make a simple example of "fake" libstd with no_std and another crate using it. It seems that the feature does nothing. The crate using the fake libstd still has to import the module marked as prelude.

What do you mean by "automatic prelude import"?

It looks like the #[prelude_import] attribute just exists to tell the type system "this is the official prelude you should import in every module" and isn't intended as a feature for downstream users to define their own preludes. I imagine there are a bunch of other rustc-private things involved besides annotating a glob import with that attribute.

https://github.com/rust-lang/rust/issues/21490

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.