gccrs: Add #[track_caller]
as known attribute
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::builtin_transcribers): Add entry for track_caller. * util/rust-attribute-values.h: add `TRACK_CALLER` attribute. * util/rust-attributes.cc: add `track_caller` attribute definition. gcc/testsuite/ChangeLog: * rust/compile/track_caller.rs: New test. Signed-off-by: Bhavesh Mandalapu <mandalapubhavesh@gmail.com>
This commit is contained in:
parent
497ed6099b
commit
e84f76dc58
4 changed files with 10 additions and 1 deletions
|
@ -137,6 +137,7 @@ std::unordered_map<std::string, AST::MacroTranscriberFunc>
|
|||
{"cfg_accessible", MacroBuiltin::sorry},
|
||||
{"rustc_const_stable", MacroBuiltin::sorry},
|
||||
{"rustc_const_unstable", MacroBuiltin::sorry},
|
||||
{"track_caller", MacroBuiltin::sorry},
|
||||
/* Derive builtins do not need a real transcriber, but still need one. It
|
||||
should however never be called since builtin derive macros get expanded
|
||||
differently, and benefit from knowing on what kind of items they are
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
static constexpr auto &RUSTC_CONST_UNSTABLE = "rustc_const_unstable";
|
||||
static constexpr auto &MAY_DANGLE = "may_dangle";
|
||||
static constexpr auto &PRELUDE_IMPORT = "prelude_import";
|
||||
static constexpr auto &TRACK_CALLER = "track_caller";
|
||||
};
|
||||
} // namespace Values
|
||||
} // namespace Rust
|
||||
|
|
|
@ -75,7 +75,8 @@ static const BuiltinAttrDefinition __definitions[]
|
|||
// assuming we keep these for static analysis
|
||||
{Attrs::RUSTC_CONST_STABLE, STATIC_ANALYSIS},
|
||||
{Attrs::RUSTC_CONST_UNSTABLE, STATIC_ANALYSIS},
|
||||
{Attrs::PRELUDE_IMPORT, NAME_RESOLUTION}};
|
||||
{Attrs::PRELUDE_IMPORT, NAME_RESOLUTION},
|
||||
{Attrs::TRACK_CALLER, CODE_GENERATION}};
|
||||
|
||||
BuiltinAttributeMappings *
|
||||
BuiltinAttributeMappings::get ()
|
||||
|
|
6
gcc/testsuite/rust/compile/track_caller.rs
Normal file
6
gcc/testsuite/rust/compile/track_caller.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
#[track_caller]
|
||||
fn foo() {}
|
||||
|
||||
fn main() {
|
||||
foo();
|
||||
}
|
Loading…
Add table
Reference in a new issue