Skip to content

Explicitly export core and std macros #139493

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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

Voultapher
Copy link
Contributor

@Voultapher Voultapher commented Apr 7, 2025

Currently all core and std macros are automatically added to the prelude via #[macro_use]. However a situation arose where we want to add a new macro assert_matches but don't want to pull it into the standard prelude for compatibility reasons. By explicitly exporting the macros found in the core and std crates we get to decide on a per macro basis and can later add them via the rust_20xx preludes.

Closes #53977
Unlocks #137487

@rustbot
Copy link
Collaborator

rustbot commented Apr 7, 2025

r? @ChrisDenton

rustbot has assigned @ChrisDenton.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 7, 2025
@Voultapher
Copy link
Contributor Author

r? @Amanieu

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Voultapher
Copy link
Contributor Author

@Amanieu the tidy issue highlights an annoying and unforeseen side-effect of this change. The vec module is now part of the prelude. In effect this means that for example this code:

fn xx(i: vec::IntoIter<i32>) {
    let _ = i.as_slice();
}

fn main() {}

that currently doesn't compile on stable would now compile. Initially I thought this would cause name collisions if users define their own vec module but so far I wasn't able to produce those, it seems to always prefer the local module. But regardless, I think we don't want to allow access to a standard library namespace without going through std, alloc or core. AFAIK there is no way to pub use only the macro and not the module namespace without modifications. I have two ideas how to tackle this, maybe we can rename vec to vec_xx internally and have separate use expressions or we have to add another crate that we can #[macro_use] inject into the prelude that only contains the vec macro. Thoughts?

@traviscross
Copy link
Contributor

@petrochenkov
Copy link
Contributor

There's an issue for this change - #53977.

@dtolnay
Copy link
Member

dtolnay commented Apr 8, 2025

@Voultapher, avoiding the vec module re-export can be done like this:

#[macro_export]
macro_rules! myvec {
    () => {};
}

pub mod myvec {
    pub struct Vec;
}

pub mod prelude {
    // Bad: re-exports both macro and type namespace
    // pub use crate::myvec;
    
    mod vec_macro_only {
        #[allow(hidden_glob_reexports)]
        mod myvec {}
        pub use crate::*;
    }
    pub use self::vec_macro_only::myvec;
}

fn main() {
    prelude::myvec!();
    let _: prelude::myvec::Vec; // error
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=5e50828c593e04ba0e98f48c9d8696b4

@Voultapher
Copy link
Contributor Author

I've applied the suggestion by @dtolnay local tests seem promising. @Kobzol could we please do a timer run to see if this PR impacts compile-times.

@petrochenkov
Copy link
Contributor

env and panic (and maybe something else now?) need to be treated in the same way as vec.

@rust-log-analyzer

This comment has been minimized.

@Kobzol
Copy link
Member

Kobzol commented Apr 8, 2025

@Voultapher Based on the CI failure I think that a try build would fail now.

@Voultapher
Copy link
Contributor Author

Ok, I'll try to get the CI passing first.

@Voultapher
Copy link
Contributor Author

@petrochenkov I went through all macros and searched the docs and env and panic seem to be the only other ones affected.

@rust-log-analyzer

This comment has been minimized.

@Voultapher
Copy link
Contributor Author

@Amanieu this program previously worked:

use std::*;

fn main() {
    panic!("panic works")
}

and now runs into:

error[E0659]: `panic` is ambiguous
   --> src/main.rs:4:5
    |
4   |     panic!("panic works")
    |     ^^^^^ ambiguous name
    |
    = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution
note: `panic` could refer to the macro imported here
   --> src/main.rs:1:5
    |
1   | use std::*;
    |     ^^^^^^
    = help: consider adding an explicit import of `panic` to disambiguate
    = help: or use `crate::panic` to refer to this macro unambiguously
note: `panic` could also refer to the macro defined here
   --> rust/library/std/src/prelude/mod.rs:157:13
    |
157 |     pub use super::v1::*;
    |             ^^^^^^^^^

I don't see how we can resolve that without changing language import rules and or special casing the prelude import.

@Amanieu
Copy link
Member

Amanieu commented Apr 9, 2025

@petrochenkov Do you have any ideas about that?

@petrochenkov petrochenkov self-assigned this Apr 9, 2025
@petrochenkov
Copy link
Contributor

Could you add a test making sure that the modules vec, env and panic are not in prelude?

@petrochenkov
Copy link
Contributor

@petrochenkov Do you have any ideas about that?

The ambiguity wouldn't happen if it was the same panic in std root and in the stdlib prelude.
However, std and core have two different panic macros.

Previously #[macro_use] extern crate std; would add the std's panic to macro_use prelude, and #[macro_use] extern crate core; would add the core's panic.
This PR always adds the core's panic.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 13, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Voultapher
Copy link
Contributor Author

I'll try to get to it next week.

@Voultapher Voultapher force-pushed the explicitly-export-core-and-std-macros branch from 87be0d7 to 46800d5 Compare June 25, 2025 11:49
@Voultapher
Copy link
Contributor Author

Voultapher commented Jun 25, 2025

I've rebased the branch on master and fixed some outstanding issues. However there is still one issue remaining and that's related to the where-allowed test. Digging into it I found the following code works on nightly, but not with this version:

#![feature(custom_inner_attributes)]
#![rustfmt::skip]
use std::fmt::Debug;

fn in_parameters(_: impl Debug) { todo!() }

fn main() {}
error: cannot determine resolution for the macro `todo`
 --> src/main.rs:6:35
  |
6 | fn in_parameters(_: impl Debug) { todo!() }
  |                                   ^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

If #![rustfmt::skip] is uncommented both versions can compile it. Intuitively I fail to see how the additional #![rustfmt::skip] attributes should get the resolver stuck. I suspect it's some kind of compiler bug, maybe connected to the bug that makes some errors disappear in the where-allowed test. I'm looking into it, but don't feel particularly hopeful that I'll find the issue, given my lack of knowledge in the area.

EDIT: This is likely a red herring for another issue. Ignore it for now.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 27, 2025

☔ The latest upstream changes (presumably #143057) made this pull request unmergeable. Please resolve the merge conflicts.

@Voultapher
Copy link
Contributor Author

There was another issue with the alloctests, that I managed to resolve, the where-allowed and potentially unrelated custom_inner_attributes issue are still under investigation. To progress further, I've temporarily disabled the where-allowed test to see if there are other outstanding CI issue.

Voultapher added 15 commits July 7, 2025 13:15
Currently all core and std macros are automatically added to the prelude
via #[macro_use]. However a situation arose where we want to add a new macro
`assert_matches` but don't want to pull it into the standard prelude for
compatibility reasons. By explicitly exporting the macros found in the core and
std crates we get to decide on a per macro basis and can later add them via
the rust_20xx preludes.
@Voultapher Voultapher force-pushed the explicitly-export-core-and-std-macros branch from f5936bc to 6e59600 Compare July 7, 2025 11:23
@rust-log-analyzer

This comment has been minimized.

Missing `#[doc(no_inline)]` for ambiguous_macro_only_std resulted in new and broken doc html files.
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jul 10, 2025

stdarch is developed in its own repository. If possible, consider making this change to rust-lang/stdarch instead.

cc @Amanieu, @folkertdev, @sayantn

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tests/ui/size_of_in_element_count/expressions.rs ... ok
tests/ui/size_of_in_element_count/functions.rs ... ok

FAILED TEST: tests/ui/unused_unit.rs (revision `edition2021`)
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-6681f8146a189268.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-2cfe97ff89475e4f.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2deedaed4dcb5fea.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-61649d905f62a78f.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-0a3d91086cb47ebb.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-4e781ae82660a8a8.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-44c06c422445d361.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-7321c4692c6ba926.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-3968c457025d4ba0.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-fba40911c42d38fa.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-c833cd5365d9a149.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-38bfe94792b02ed8.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-4b28f9b7250646c7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/unused_unit.rs" "--edition" "2021" "--cfg=edition2021" "-Cextra-filename=edition2021"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/unused_unit.edition2021.stderr` to the actual output
--- tests/ui/unused_unit.edition2021.stderr
+++ <stderr output>
---
+error: cannot determine resolution for the macro `todo`
-  --> tests/ui/unused_unit.rs:22:28
+  --> tests/ui/unused_unit.rs:136:24
    |
-LL |     pub fn get_unit<F: Fn() -> (), G>(&self, f: F, _g: G) -> ()
-   |                            ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:25:18
+LL |         run(|| -> () { todo!() }); 
+   |                        ^^^^
    |
-LL |     where G: Fn() -> () {
-   |                  ^^^^^^ help: remove the `-> ()`
+   = note: import resolution is stuck, try simplifying macro imports
 
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:22:58
-   |
-LL |     pub fn get_unit<F: Fn() -> (), G>(&self, f: F, _g: G) -> ()
-   |                                                          ^^^^^^ help: remove the `-> ()`
+error: aborting due to 3 previous errors
 
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:27:26
-   |
-LL |         let _y: &dyn Fn() -> () = &f;
-   |                          ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:35:18
-   |
-LL |     fn into(self) -> () {
-   |                  ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:43:29
-   |
-LL |     fn redundant<F: FnOnce() -> (), G, H>(&self, _f: F, _g: G, _h: H)
-   |                             ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:46:19
-   |
-LL |         G: FnMut() -> (),
-   |                   ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:48:16
-   |
-LL |         H: Fn() -> ();
-   |                ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:53:29
-   |
-LL |     fn redundant<F: FnOnce() -> (), G, H>(&self, _f: F, _g: G, _h: H)
-   |                             ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:56:19
-   |
-LL |         G: FnMut() -> (),
---
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:95:10
-   |
-LL | fn test()->(){}
-   |          ^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:99:11
-   |
-LL | fn test2() ->(){}
-   |           ^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:103:11
-   |
-LL | fn test3()-> (){}
-   |           ^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:136:15
-   |
-LL |         run(|| -> () { todo!() }); 
-   |               ^^^^^^ help: remove the `-> ()`
-
-error: aborting due to 20 previous errors
-

Full unnormalized output:
---

error: cannot determine resolution for the macro `todo`
##[error]  --> tests/ui/unused_unit.rs:136:24
   |
LL |         run(|| -> () { todo!() }); 
   |                        ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: aborting due to 3 previous errors
---

error: diagnostic code `clippy::unused_unit` not found on line 62
##[error]  --> tests/ui/unused_unit.rs:64:6
   |
64 | //~| unused_unit
   |      ^^^^^^^^^^^ expected because of this pattern
   |

error: diagnostic code `clippy::unused_unit` not found on line 74
##[error]  --> tests/ui/unused_unit.rs:75:14
---

error: diagnostic code `clippy::unused_unit` not found on line 136
##[error]   --> tests/ui/unused_unit.rs:137:27
    |
137 |         //~[edition2021]^ unused_unit
    |                           ^^^^^^^^^^^ expected because of this pattern
    |

error: there were 1 unmatched diagnostics
##[error]   --> tests/ui/unused_unit.rs:136:24
    |
136 |         run(|| -> () { todo!() }); 
    |                        ^^^^ Error: cannot determine resolution for the macro `todo`
    |

full stderr:
error: unneeded unit expression
##[error]  --> tests/ui/unused_unit.rs:37:9
---

error: cannot determine resolution for the macro `todo`
##[error]  --> tests/ui/unused_unit.rs:136:24
   |
LL |         run(|| -> () { todo!() }); 
   |                        ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: aborting due to 3 previous errors


full stdout:



FAILED TEST: tests/ui/unused_unit.rs (revision `edition2024`)
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-6681f8146a189268.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-2cfe97ff89475e4f.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-2deedaed4dcb5fea.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-61649d905f62a78f.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-0a3d91086cb47ebb.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-4e781ae82660a8a8.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-44c06c422445d361.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-7321c4692c6ba926.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-3968c457025d4ba0.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-fba40911c42d38fa.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-c833cd5365d9a149.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-38bfe94792b02ed8.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-4b28f9b7250646c7.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/unused_unit.rs" "--edition" "2024" "--cfg=edition2024" "-Cextra-filename=edition2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/unused_unit.edition2024.stderr` to the actual output
--- tests/ui/unused_unit.edition2024.stderr
+++ <stderr output>
---
+error: cannot determine resolution for the macro `todo`
-  --> tests/ui/unused_unit.rs:22:28
+  --> tests/ui/unused_unit.rs:136:24
    |
-LL |     pub fn get_unit<F: Fn() -> (), G>(&self, f: F, _g: G) -> ()
-   |                            ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:25:18
+LL |         run(|| -> () { todo!() }); 
+   |                        ^^^^
    |
-LL |     where G: Fn() -> () {
-   |                  ^^^^^^ help: remove the `-> ()`
+   = note: import resolution is stuck, try simplifying macro imports
 
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:22:58
-   |
-LL |     pub fn get_unit<F: Fn() -> (), G>(&self, f: F, _g: G) -> ()
-   |                                                          ^^^^^^ help: remove the `-> ()`
+error: aborting due to 3 previous errors
 
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:27:26
-   |
-LL |         let _y: &dyn Fn() -> () = &f;
-   |                          ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:35:18
-   |
-LL |     fn into(self) -> () {
-   |                  ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:43:29
-   |
-LL |     fn redundant<F: FnOnce() -> (), G, H>(&self, _f: F, _g: G, _h: H)
-   |                             ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:46:19
-   |
-LL |         G: FnMut() -> (),
-   |                   ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:48:16
-   |
-LL |         H: Fn() -> ();
-   |                ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:53:29
-   |
-LL |     fn redundant<F: FnOnce() -> (), G, H>(&self, _f: F, _g: G, _h: H)
-   |                             ^^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:56:19
-   |
-LL |         G: FnMut() -> (),
---
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:95:10
-   |
-LL | fn test()->(){}
-   |          ^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:99:11
-   |
-LL | fn test2() ->(){}
-   |           ^^^^^ help: remove the `-> ()`
-
-error: unneeded unit return type
-  --> tests/ui/unused_unit.rs:103:11
-   |
-LL | fn test3()-> (){}
-   |           ^^^^^ help: remove the `-> ()`
-
-error: aborting due to 19 previous errors
-

Full unnormalized output:
---

error: cannot determine resolution for the macro `todo`
##[error]  --> tests/ui/unused_unit.rs:136:24
   |
LL |         run(|| -> () { todo!() }); 
   |                        ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: aborting due to 3 previous errors
---

error: diagnostic code `clippy::unused_unit` not found on line 62
##[error]  --> tests/ui/unused_unit.rs:64:6
   |
64 | //~| unused_unit
   |      ^^^^^^^^^^^ expected because of this pattern
   |

error: diagnostic code `clippy::unused_unit` not found on line 74
##[error]  --> tests/ui/unused_unit.rs:75:14
---

error: there were 1 unmatched diagnostics
##[error]   --> tests/ui/unused_unit.rs:136:24
    |
136 |         run(|| -> () { todo!() }); 
    |                        ^^^^ Error: cannot determine resolution for the macro `todo`
    |

full stderr:
error: unneeded unit expression
##[error]  --> tests/ui/unused_unit.rs:37:9
---

error: cannot determine resolution for the macro `todo`
##[error]  --> tests/ui/unused_unit.rs:136:24
   |
LL |         run(|| -> () { todo!() }); 
   |                        ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: aborting due to 3 previous errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not apply #[macro_use] to implicitly injected extern crate std;, use standard library prelude instead