diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2024-12-10 08:55:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-10 08:55:54 +0100 |
| commit | 94d780d64721470cd8485743ce6702100dcf3e2f (patch) | |
| tree | f096280bebf7c22f744265499467ed4376c01046 /tests/rustdoc-ui/coverage/enum-tuple.rs | |
| parent | ff7906bfe1ed264bf9c4d3abe1940e357b7e61dd (diff) | |
| parent | 7951d1928086c2c64b80f9ea5d512d365bfdf9b6 (diff) | |
| download | rust-94d780d64721470cd8485743ce6702100dcf3e2f.tar.gz rust-94d780d64721470cd8485743ce6702100dcf3e2f.zip | |
Rollup merge of #131558 - sassman:feat/warnin-for-no-mangle-together-with-export-name, r=Urgau
Lint on combining `#[no_mangle]` and `#[export_name]`
This is my very first contribution to the compiler, even though I read the [chapter about lints](https://rustc-dev-guide.rust-lang.org/diagnostics.html) I'm not very certain that this ~~new lint is done right as a builtin lint~~ PR is right. I appreciate any guidance on how to improve the code.
- Add test for issue #47446
- ~~Implement the new lint `mixed_export_name_and_no_mangle` as a builtin lint (not sure if that is the right way to go)~~ Extend `unused_attributes` lint
- Add suggestion how to fix it
<details>
<summary>Old proposed new lint</summary>
> The `mixed_export_name_and_no_mangle` lint detects usage of both `#[export_name]` and `#[no_mangle]` on the same item which results on `#[no_mangle]` being ignored.
>
> *warn-by-default*
>
> ### Example
>
> ```rust
> #[no_mangle] // ignored
> #[export_name = "foo"] // takes precedences
> pub fn bar() {}
> ```
>
> ### Explanation
>
> The compiler will not respect the `#[no_mangle]` attribute when generating the symbol name for the function, as the `#[export_name]` attribute takes precedence. This can lead to confusion and is unnecessary.
</details>
Diffstat (limited to 'tests/rustdoc-ui/coverage/enum-tuple.rs')
0 files changed, 0 insertions, 0 deletions
