Skip to content

unused attribute warning when using multiple crate_type #95902

Closed

Description

Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=cfb35aa70ccef56dfbb931a7c093d42b

The current output is:

warning: unused attribute
 --> ./temp.rs:2:1
  |
2 | #![crate_type = "lib"]
  | ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
  |
  = note: `#[warn(unused_attributes)]` on by default
note: attribute also specified here
 --> ./temp.rs:1:1
  |
1 | #![crate_type = "dylib"]
  | ^^^^^^^^^^^^^^^^^^^^^^^^
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!

Ideally there should be no output. When using command line arguments instead of the crate_type attributes, there is no output.

Note that the compilation process is successful: even with the warning, both an dylib and a rlib is produced.
May be related to #92933.

Tested with rustc 1.60.0 (7737e0b 2022-04-04).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions