-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Revert "Add rustc_test_entrypoint_marker" #161931
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
Merged
rust-bors
merged 4 commits into
rust-lang:main
from
JonathanBrouwer:revert-test-entry-point
Aug 31, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3ff3976
Add regression test for "use of an internal attribute"
JonathanBrouwer ca095da
Add regression test for "expected item after attributes"
JonathanBrouwer 58f825e
Add regression test for "use of an internal attribute" with a `macro_…
JonathanBrouwer 9b70ab0
Revert "Add `rustc_test_entrypoint_marker`"
JonathanBrouwer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //@ check-pass | ||
| //@ compile-flags: --test | ||
| // Test that we can pass a test through a macro_rules! macro that removes the span of the item | ||
| // Regression test for https://github.com/rust-lang/rust/issues/161917 | ||
| #![feature(macro_attr)] | ||
|
|
||
| macro_rules! ohno { | ||
| attr() { $(#[$a:meta])* fn $name:ident () $body: block } => { | ||
| $(#[$a])* | ||
| fn $name () $body | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| #[ohno] | ||
| fn my_test() {} | ||
|
|
||
| fn main() {} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| extern crate proc_macro; | ||
| use proc_macro::TokenStream; | ||
|
|
||
| #[proc_macro_attribute] | ||
| pub fn assert_no_attributes(_attr: TokenStream, item: TokenStream) -> TokenStream { | ||
| // This will count the "attributes" (in reality the number of hash symbols) on the item. | ||
| assert_eq!(item.to_string().chars().filter(|c| *c == '#').count(), 0); | ||
| item | ||
| } | ||
|
|
||
| #[proc_macro_attribute] | ||
| pub fn assert_one_attribute(_attr: TokenStream, item: TokenStream) -> TokenStream { | ||
| // This will count the "attributes" (in reality the number of hash symbols) on the item. | ||
| assert_eq!(item.to_string().chars().filter(|c| *c == '#').count(), 1); | ||
| item | ||
| } | ||
|
|
||
| #[proc_macro_attribute] | ||
| pub fn assert_two_attributes(_attr: TokenStream, item: TokenStream) -> TokenStream { | ||
| // This will count the "attributes" (in reality the number of hash symbols) on the item. | ||
| assert_eq!(item.to_string().chars().filter(|c| *c == '#').count(), 2); | ||
| item | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| extern crate proc_macro; | ||
| use proc_macro::TokenStream; | ||
|
|
||
| #[proc_macro_attribute] | ||
| pub fn remove_span(_attr: TokenStream, item: TokenStream) -> TokenStream { | ||
| // `.to_string().parse()` will lose the span of the token stream | ||
| item.to_string().parse().unwrap() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| //@ check-pass | ||
| //@ proc-macro: test-count-attributes.rs | ||
| //@ compile-flags: --test | ||
| // Tests whether attributes on tests can be observed by proc macros | ||
| // Regression test for https://github.com/rust-lang/rust/issues/161920 | ||
|
|
||
| #[test] | ||
| #[test_count_attributes::assert_no_attributes] | ||
| fn meow1() {} | ||
|
|
||
| #[test_count_attributes::assert_one_attribute] | ||
| #[test] | ||
| fn meow2() {} | ||
|
|
||
| #[test] | ||
| #[should_panic] | ||
| #[test_count_attributes::assert_one_attribute] | ||
| fn meow3() {} | ||
|
|
||
| #[test] | ||
| #[test_count_attributes::assert_one_attribute] | ||
| #[should_panic] | ||
| fn meow4() {} | ||
|
|
||
| #[test_count_attributes::assert_two_attributes] | ||
| #[test] | ||
| #[should_panic] | ||
| fn meow5() {} | ||
|
|
||
| fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| //@ check-pass | ||
| //@ proc-macro: test-re-emit.rs | ||
| //@ compile-flags: --test | ||
| // Test that we can pass a test through a proc macro that removes the span of the item | ||
| // Regression test for https://github.com/rust-lang/rust/issues/161917 | ||
|
|
||
| #[test] | ||
| #[test_re_emit::remove_span] | ||
| fn meow1() {} | ||
|
|
||
| #[test_re_emit::remove_span] | ||
| #[test] | ||
| fn meow2() {} | ||
|
|
||
| fn main() {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh whooops that's terrible, thanks for catching that!