diff options
| author | gavincrawford <94875769+gavincrawford@users.noreply.github.com> | 2024-11-02 11:39:29 -0600 |
|---|---|---|
| committer | gavincrawford <94875769+gavincrawford@users.noreply.github.com> | 2024-11-11 13:33:48 -0700 |
| commit | 5f443df4044532d95c23aa8d97f2748ca287378f (patch) | |
| tree | 7f74fb99575f038d5498c34d5cead49b30dbe9f7 | |
| parent | 145f9cf95de1fbde3fa11e98461310e0373253e6 (diff) | |
| download | rust-5f443df4044532d95c23aa8d97f2748ca287378f.tar.gz rust-5f443df4044532d95c23aa8d97f2748ca287378f.zip | |
Add #[rustc_as_ptr] attribute
| -rw-r--r-- | compiler/rustc_feature/src/builtin_attrs.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 0069b07ad62..95cb7f4fff5 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -876,6 +876,11 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ "lang items are subject to change", ), rustc_attr!( + rustc_as_ptr, Normal, template!(Word), ErrorFollowing, + EncodeCrossCrate::Yes, + "#[rustc_as_ptr] is used to mark functions returning pointers to their inner allocations." + ), + rustc_attr!( rustc_pass_by_value, Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::Yes, "#[rustc_pass_by_value] is used to mark types that must be passed by value instead of reference." diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 0a2926c0404..8d70c9db12c 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -162,6 +162,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> { self.check_rustc_std_internal_symbol(attr, span, target) } [sym::naked, ..] => self.check_naked(hir_id, attr, span, target, attrs), + [sym::rustc_as_ptr, ..] => { + self.check_applied_to_fn_or_method(hir_id, attr, span, target) + } [sym::rustc_never_returns_null_ptr, ..] => { self.check_applied_to_fn_or_method(hir_id, attr, span, target) } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 890c4fdafef..dde6b83c151 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1652,6 +1652,7 @@ symbols! { rustc_allow_const_fn_unstable, rustc_allow_incoherent_impl, rustc_allowed_through_unstable_modules, + rustc_as_ptr, rustc_attrs, rustc_autodiff, rustc_box, |
