treat no_mangle_generic_items as hard error instead of lint warning#154585
treat no_mangle_generic_items as hard error instead of lint warning#154585HerrCai0907 wants to merge 2 commits into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
r? @oli-obk |
|
|
|
Please make it a hard error and not a lint at all if crater doesn't show any significant regressions. For crater purposes this works. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
set no_mangle_generic_items deny by default
This comment has been minimized.
This comment has been minimized.
|
@craterbot check |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
Footnotes
|
|
I reached out to the jni-mangle author, who used a generic function with The rxdp failure is because (while there are no generics involved in the function signature) the body uses the generic parameter So, let's turn this lint into a hard error. Then we need to write an explainer for T-lang and then we can nominate it. |
|
The Miri subtree was changed cc @rust-lang/miri |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
☔ The latest upstream changes (presumably #156794) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Nominating for @rust-lang/lang: The #[no_mangle]
fn no_mangle_generic<T>() {}A crater run showed only 3 true regressions, 2 of them on crates.io:
So we suggest that we skip the FCW stage and immediately move to a hard error here. |
| assert_contains(&backtrace, "foo", "line-tables-only-helper.rs", 6); | ||
| } | ||
| assert_contains(&backtrace, "bar", "line-tables-only-helper.rs", 10); | ||
| assert_contains(&backtrace, "baz", "line-tables-only-helper.rs", 5); | ||
| assert_contains(&backtrace, "bar", "line-tables-only-helper.rs", 11); | ||
| assert_contains(&backtrace, "baz", "line-tables-only-helper.rs", 6); |
There was a problem hiding this comment.
| assert_contains(&backtrace, "foo", "line-tables-only-helper.rs", 6); | |
| } | |
| assert_contains(&backtrace, "bar", "line-tables-only-helper.rs", 10); | |
| assert_contains(&backtrace, "baz", "line-tables-only-helper.rs", 5); | |
| assert_contains(&backtrace, "bar", "line-tables-only-helper.rs", 11); | |
| assert_contains(&backtrace, "baz", "line-tables-only-helper.rs", 6); | |
| assert_contains(&backtrace, "foo", "line-tables-only-helper.rs", 12); | |
| } | |
| assert_contains(&backtrace, "bar", "line-tables-only-helper.rs", 8); | |
| assert_contains(&backtrace, "baz", "line-tables-only-helper.rs", 4); |
That's based on the CI messages, I'd suggest running the tests locally though.
|
Makes sense to me. Thanks @HerrCai0907, @oli-obk, and @RalfJung. I propose we make this a hard error and accept this (minimal) observed breakage. @rfcbot fcp merge lang |
|
@traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
|
There is a waiting docs PR at rust-lang/reference#1904. Am I correct that the new rule should state the following? r[abi.no_mangle.generic]
It is an error to use `no_mangle` on an item with generic type or constant parameters. |
|
Yes that sounds right. (Though IMO the reference should list where the attribute is allowed, not where it is forbidden.) |
View all comments
In rust-lang/miri#4929 (comment), rustc should reject the no_mangled generic function.
This PR treat is as a hard error