Add #[rustc_test_entrypoint_marker]#158854
Conversation
|
Some changes occurred in compiler/rustc_hir/src/attrs Some changes occurred in compiler/rustc_attr_parsing Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
|
|
26da690 to
1e795a9
Compare
This comment has been minimized.
This comment has been minimized.
|
(this might take me a few days to get to, should have time to take a look on friday) |
…nathanBrouwer Add `#[rustc_test_entrypoint_marker]` r? @JonathanBrouwer cc: @Nadrieril @N1ark @aDotInTheVoid Some context: a bunch of tooling around rustc likes to find entry points. This is easy for `main`, it's a lang item. But tests aren't as easy. There is already a similar marker for the data structure associated with tests, but if you want to do for example dynamic analysis, you want just the defid of the function you can call to start the tests. This is that marker. There's a test using a rustc driver that the attr indeed shows up and marks the test functions. @Nadrieril and @N1ark asked for this kind of behavior. I talked to @aDotInTheVoid about whether we should do things like this where we cannot really guarantee the stability or even use it inside rustc. The thing is, we don't provide staboility guarantees, it's just a useful little thing to have for as long as its there and it doesn't bother anyone either. It's up to tool authors to deal with breakage we may introduce.
…uwer Rollup of 7 pull requests Successful merges: - #157690 (codegen_ssa: pack small const aggregates into immediate stores) - #159005 (Use `as_lang_item` instead of repeatedly matching) - #156735 (Move NativeLib::filename to the rmeta-link archive member) - #158732 (Apply MCP 1003 and move diagnostics.rs into its own module) - #158854 (Add `#[rustc_test_entrypoint_marker]`) - #158965 (Add codegen test for Result is_ok unwrap) - #159050 (assert only opaques with sub unified hidden infer are non-rigid)
|
💔 I suspect this PR failed tests as part of a rollup After fixing the problem, consider running a try job for the failed job before re-approving. Link to failure: #159068 (comment) |
|
This pull request was unapproved. This PR was contained in a rollup (#159068), which was unapproved. |
0133252 to
b80ee35
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors try jobs=x86_64-gnu-llvm-21-3 |
This comment has been minimized.
This comment has been minimized.
Add `#[rustc_test_entrypoint_marker]` try-job: x86_64-gnu-llvm-21-3
|
💔 Test for 97c51aa failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
b80ee35 to
843639b
Compare
|
This should fix it |
|
@bors try jobs=x86_64-gnu-llvm-21-3 |
This comment has been minimized.
This comment has been minimized.
Add `#[rustc_test_entrypoint_marker]` try-job: x86_64-gnu-llvm-21-3
|
yeah, it got past the problem test. @bors r=jonathanbrouwer |
…nathanbrouwer Add `#[rustc_test_entrypoint_marker]` r? @JonathanBrouwer cc: @Nadrieril @N1ark @aDotInTheVoid Some context: a bunch of tooling around rustc likes to find entry points. This is easy for `main`, it's a lang item. But tests aren't as easy. There is already a similar marker for the data structure associated with tests, but if you want to do for example dynamic analysis, you want just the defid of the function you can call to start the tests. This is that marker. There's a test using a rustc driver that the attr indeed shows up and marks the test functions. @Nadrieril and @N1ark asked for this kind of behavior. I talked to @aDotInTheVoid about whether we should do things like this where we cannot really guarantee the stability or even use it inside rustc. The thing is, we don't provide staboility guarantees, it's just a useful little thing to have for as long as its there and it doesn't bother anyone either. It's up to tool authors to deal with breakage we may introduce.
…uwer Rollup of 13 pull requests Successful merges: - #159039 (resolve: fix effective visibilities for items in ambiguous glob sets) - #157706 (Deny `todo!()` in tidy) - #156712 (Pointer authentication config and user facing options) - #158535 (Support `#[track_caller]` on EII declarations) - #158632 (First steps of late-bound turbofishing (place FnDef behind a dummy binder)) - #159002 (Small refactorings in `need_type_info` module) - #159202 (Bump rustc-demangle to 0.1.28) - #159216 (Avoid using probe self_ty for delegation arguments) - #159222 (semicolon_in_expressions_from_macros: Lint on non-local macros too) - #156609 (Consider structurally impossible Sized predicates in MIR) - #158854 (Add `#[rustc_test_entrypoint_marker]`) - #158998 (Some minor ast validation and visiting cleanups) - #159123 (doc: clarify attr parser APIs)
…nathanbrouwer Add `#[rustc_test_entrypoint_marker]` r? @JonathanBrouwer cc: @Nadrieril @N1ark @aDotInTheVoid Some context: a bunch of tooling around rustc likes to find entry points. This is easy for `main`, it's a lang item. But tests aren't as easy. There is already a similar marker for the data structure associated with tests, but if you want to do for example dynamic analysis, you want just the defid of the function you can call to start the tests. This is that marker. There's a test using a rustc driver that the attr indeed shows up and marks the test functions. @Nadrieril and @N1ark asked for this kind of behavior. I talked to @aDotInTheVoid about whether we should do things like this where we cannot really guarantee the stability or even use it inside rustc. The thing is, we don't provide staboility guarantees, it's just a useful little thing to have for as long as its there and it doesn't bother anyone either. It's up to tool authors to deal with breakage we may introduce.
…uwer Rollup of 14 pull requests Successful merges: - #159039 (resolve: fix effective visibilities for items in ambiguous glob sets) - #157706 (Deny `todo!()` in tidy) - #158535 (Support `#[track_caller]` on EII declarations) - #158632 (First steps of late-bound turbofishing (place FnDef behind a dummy binder)) - #158846 (Fix unused variable warnings for diverging expressions) - #159002 (Small refactorings in `need_type_info` module) - #159202 (Bump rustc-demangle to 0.1.28) - #159216 (Avoid using probe self_ty for delegation arguments) - #159222 (semicolon_in_expressions_from_macros: Lint on non-local macros too) - #156609 (Consider structurally impossible Sized predicates in MIR) - #157993 (Expose more info about ADTs and functions in rustc_public) - #158854 (Add `#[rustc_test_entrypoint_marker]`) - #158998 (Some minor ast validation and visiting cleanups) - #159123 (doc: clarify attr parser APIs)
…nathanbrouwer Add `#[rustc_test_entrypoint_marker]` r? @JonathanBrouwer cc: @Nadrieril @N1ark @aDotInTheVoid Some context: a bunch of tooling around rustc likes to find entry points. This is easy for `main`, it's a lang item. But tests aren't as easy. There is already a similar marker for the data structure associated with tests, but if you want to do for example dynamic analysis, you want just the defid of the function you can call to start the tests. This is that marker. There's a test using a rustc driver that the attr indeed shows up and marks the test functions. @Nadrieril and @N1ark asked for this kind of behavior. I talked to @aDotInTheVoid about whether we should do things like this where we cannot really guarantee the stability or even use it inside rustc. The thing is, we don't provide staboility guarantees, it's just a useful little thing to have for as long as its there and it doesn't bother anyone either. It's up to tool authors to deal with breakage we may introduce.
…uwer Rollup of 15 pull requests Successful merges: - #159039 (resolve: fix effective visibilities for items in ambiguous glob sets) - #157706 (Deny `todo!()` in tidy) - #156047 (Fix trait method resolution on an adjusted never type) - #158535 (Support `#[track_caller]` on EII declarations) - #158632 (First steps of late-bound turbofishing (place FnDef behind a dummy binder)) - #158846 (Fix unused variable warnings for diverging expressions) - #159002 (Small refactorings in `need_type_info` module) - #159202 (Bump rustc-demangle to 0.1.28) - #159216 (Avoid using probe self_ty for delegation arguments) - #156609 (Consider structurally impossible Sized predicates in MIR) - #157993 (Expose more info about ADTs and functions in rustc_public) - #158804 (Clarify `as_uninit_mut` may point to uninitialized memory) - #158854 (Add `#[rustc_test_entrypoint_marker]`) - #158998 (Some minor ast validation and visiting cleanups) - #159123 (doc: clarify attr parser APIs)
…uwer Rollup of 13 pull requests Successful merges: - #157706 (Deny `todo!()` in tidy) - #158535 (Support `#[track_caller]` on EII declarations) - #158632 (First steps of late-bound turbofishing (place FnDef behind a dummy binder)) - #158846 (Fix unused variable warnings for diverging expressions) - #159002 (Small refactorings in `need_type_info` module) - #159202 (Bump rustc-demangle to 0.1.28) - #159216 (Avoid using probe self_ty for delegation arguments) - #156609 (Consider structurally impossible Sized predicates in MIR) - #157993 (Expose more info about ADTs and functions in rustc_public) - #158804 (Clarify `as_uninit_mut` may point to uninitialized memory) - #158854 (Add `#[rustc_test_entrypoint_marker]`) - #158998 (Some minor ast validation and visiting cleanups) - #159123 (doc: clarify attr parser APIs)
Rollup merge of #158854 - jdonszelmann:test-entrypoint, r=jonathanbrouwer Add `#[rustc_test_entrypoint_marker]` r? @JonathanBrouwer cc: @Nadrieril @N1ark @aDotInTheVoid Some context: a bunch of tooling around rustc likes to find entry points. This is easy for `main`, it's a lang item. But tests aren't as easy. There is already a similar marker for the data structure associated with tests, but if you want to do for example dynamic analysis, you want just the defid of the function you can call to start the tests. This is that marker. There's a test using a rustc driver that the attr indeed shows up and marks the test functions. @Nadrieril and @N1ark asked for this kind of behavior. I talked to @aDotInTheVoid about whether we should do things like this where we cannot really guarantee the stability or even use it inside rustc. The thing is, we don't provide staboility guarantees, it's just a useful little thing to have for as long as its there and it doesn't bother anyone either. It's up to tool authors to deal with breakage we may introduce.
…nszelmann Construct `tokens` for attrs made by `mk_attr_word` and other variants Fixes rust-lang#159261 `tokens` won't be constructed for generated built-in attrs before, so that after rust-lang#158854, `#[rustc_test_entrypoint_marker]` without `tokens` would be added when expanding `#[test]`. Then later expansions would cause the ICE when they wanna get the attr's `tokens`. This PR makes `tokens` constructed for such attrs, although this specific ICE only need editing `mk_attr_word`, but I think it would be good to also edit `mk_attr_nested_word` and `mk_attr_name_value_str`.
…nszelmann Construct `tokens` for attrs made by `mk_attr_word` and other variants Fixes rust-lang#159261 `tokens` won't be constructed for generated built-in attrs before, so that after rust-lang#158854, `#[rustc_test_entrypoint_marker]` without `tokens` would be added when expanding `#[test]`. Then later expansions would cause the ICE when they wanna get the attr's `tokens`. This PR makes `tokens` constructed for such attrs, although this specific ICE only need editing `mk_attr_word`, but I think it would be good to also edit `mk_attr_nested_word` and `mk_attr_name_value_str`.
…nszelmann Construct `tokens` for attrs made by `mk_attr_word` and other variants Fixes rust-lang#159261 `tokens` won't be constructed for generated built-in attrs before, so that after rust-lang#158854, `#[rustc_test_entrypoint_marker]` without `tokens` would be added when expanding `#[test]`. Then later expansions would cause the ICE when they wanna get the attr's `tokens`. This PR makes `tokens` constructed for such attrs, although this specific ICE only need editing `mk_attr_word`, but I think it would be good to also edit `mk_attr_nested_word` and `mk_attr_name_value_str`.
View all comments
r? @JonathanBrouwer
cc: @Nadrieril @N1ark @aDotInTheVoid
Some context: a bunch of tooling around rustc likes to find entry points. This is easy for
main, it's a lang item. But tests aren't as easy. There is already a similar marker for the data structure associated with tests, but if you want to do for example dynamic analysis, you want just the defid of the function you can call to start the tests. This is that marker. There's a test using a rustc driver that the attr indeed shows up and marks the test functions.@Nadrieril and @N1ark asked for this kind of behavior. I talked to @aDotInTheVoid about whether we should do things like this where we cannot really guarantee the stability or even use it inside rustc. The thing is, we don't provide staboility guarantees, it's just a useful little thing to have for as long as its there and it doesn't bother anyone either. It's up to tool authors to deal with breakage we may introduce.