You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: declaration of a nonstandard #[main] function may change over time, for now a top-level `fn main()` is required (see issue #29634)
But on nightly it just says:
error: main function not found
This is because since #32846, complete feature-gate-checking is done after #[test] items are stripped. It sounds to me easy to fix, but I'm wondering if feature-gate-checking is really the right place to catch this error. After all, we do not check #[test] items for correctness, so we shouldn't feature-gate-check them either, just like #[cfg()]-guarded items. Maybe the new message is fine after all.
we do not check #[test] items for correctness, so we shouldn't feature-gate-check them either, just like #[cfg()]-guarded items. Maybe the new message is fine after all.
Agreed. I think #[test] should behave the same as #[cfg(test)] when we aren't testing.
Treat `#[test]` like `#[cfg(test)]` in non-test builds
This PR treats `#[test]` like `#[cfg(test)]` in non-test builds. In particular, like `#[cfg(test)]`,
- `#[test]` nodes are stripped during `cfg` processing, and
- `#[test]` is disallowed on non-optional expressions.
Closes#33946.
r? @nrc
On stable, it gives the expected error:
But on nightly it just says:
This is because since #32846, complete feature-gate-checking is done after
#[test]
items are stripped. It sounds to me easy to fix, but I'm wondering if feature-gate-checking is really the right place to catch this error. After all, we do not check#[test]
items for correctness, so we shouldn't feature-gate-check them either, just like#[cfg()]
-guarded items. Maybe the new message is fine after all.cc @jseyfried
The text was updated successfully, but these errors were encountered: