Skip to content

Every bad inner attributes should show an error #4219

@lucasly-ba

Description

@lucasly-ba

example code:

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
#![inline]
pub fn check_ge(a: i32, b: i32) -> bool
{
    a >= b
}

Expected:

1 | #![derive(Debug)]
  | ^^^^^^^^^^^^^^^^^
2 |
3 | fn foo() {}
  |    --- the inner attribute doesn't annotate this function
  |
help: perhaps you meant to use an outer attribute
  |
1 - #![derive(Debug)]
1 + #[derive(Debug)]

Got:


Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> {heap 1240k} <visibility> {heap 1240k} <build_ssa_passes> {heap 1240k} <opt_local_passes> {heap 1704k} <remove_symbols> {heap 1704k} <targetclone> {heap 1704k} <free-fnsummary> {heap 1704k}Streaming LTO
 <whole-program> {heap 1704k} <fnsummary> {heap 1704k} <inline> {heap 1704k} <modref> {heap 1704k} <free-fnsummary> {heap 1704k} <single-use> {heap 1704k} <comdats> {heap 1704k}Assembling functions:
 <simdclone> {heap 1704k} a::check_ge
Time variable                                  wall           GGC
 phase opt and generate             :   0.01 ( 80%)    65k ( 28%)
 initialize rtl                     :   0.01 ( 64%)    12k (  5%)
 TOTAL                              :   0.02          235k
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --enable-checking=release to disable checks.

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