Skip to content

deprecated attribute should give error with bad arguments #4236

@lucasly-ba

Description

@lucasly-ba

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions