about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2022-04-04 17:28:42 +0200
committerlcnr <rust@lcnr.de>2022-05-10 08:09:37 +0200
commitfc128b67647533258e0bc52cc935438e6480732d (patch)
treef6e553ae963520d65042c4a24d8a0c11d47e2bb3 /compiler/rustc_middle/src
parentb618cdb224963cea9ddddda8ea8a7f11f1b2d9a6 (diff)
downloadrust-fc128b67647533258e0bc52cc935438e6480732d.tar.gz
rust-fc128b67647533258e0bc52cc935438e6480732d.zip
add check and don't encode `#[inline]`
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index 4bd4f6428c6..94d2a313c7c 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -2201,6 +2201,9 @@ impl<'tcx> TyCtxt<'tcx> {
 
     /// Determines whether an item is annotated with an attribute.
     pub fn has_attr(self, did: DefId, attr: Symbol) -> bool {
+        if cfg!(debug_assertions) && !did.is_local() && rustc_feature::is_builtin_only_local(attr) {
+            bug!("tried to access the `only_local` attribute `{}` from an extern crate", attr);
+        }
         self.sess.contains_name(&self.get_attrs(did), attr)
     }