gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

`deprecated` attribute should give error with bad arguments

Open lucasly-ba opened this issue 2 months ago • 4 comments

code:

#[deprecated(a,a)]
pub fn a(){}

expected:

error[E0541]: unknown meta item 'a'
 --> a.rs:5:14
  |
5 | #[deprecated(a,a)]
  |              ^ expected one of `since`, `note`

error: aborting due to previous error

code:

#[deprecated("a")]
pub fn a(){}

expected:

error[E0565]: item in `deprecated` must be a key/value pair
 --> a.rs:5:14
  |
5 | #[deprecated("a")]
  |              ^^^

error: aborting due to previous error

code:

#[deprecated(since=a, note=a)]
pub fn A(){}

Expected:

error: expected unsuffixed literal or identifier, found `a`
 --> a.rs:5:20
  |
5 | #[deprecated(since=a, note=a)]
  |                    ^

error: aborting due to previous error

lucasly-ba avatar Oct 17 '25 13:10 lucasly-ba

Hi can I take this up?

sneaky-potato avatar Oct 18 '25 09:10 sneaky-potato

Hi can I take this up?

Did you take it ?

lucasly-ba avatar Nov 07 '25 16:11 lucasly-ba

Hi @P-E-P @lucasly-ba Really sorry, I was away from work, could you guide me and give me some general pointers to get started with this issue? I could find the gcc/rust/parse/rust-parse-impl.h. Could you help me, and tell me if I am looking in the right direction?

sneaky-potato avatar Dec 08 '25 12:12 sneaky-potato

@sneaky-potato This should probably be fixed within the attribute checker (rust/util/rust-attributes.cc). You'll need to look for the deprecated attributes and when found check that their values are correct. If not, emit a message.

P-E-P avatar Dec 08 '25 13:12 P-E-P