about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/query.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-11-29 12:34:50 +0100
committerGitHub <noreply@github.com>2023-11-29 12:34:50 +0100
commit911a5ee7ff04bcb6d65c95f14670c81cfbcbdfac (patch)
tree60452c9513614cbf85c954ded9b6cdae5f8e0fc4 /compiler/rustc_middle/src/mir/query.rs
parentafe2d7392f7d013e19e540afd203af23c60e6919 (diff)
parent6b066a9305f03425c6627c16419d0d7197a4c526 (diff)
downloadrust-911a5ee7ff04bcb6d65c95f14670c81cfbcbdfac.tar.gz
rust-911a5ee7ff04bcb6d65c95f14670c81cfbcbdfac.zip
Rollup merge of #118333 - eduardosm:print-missing-target-features, r=est31
Print list of missing target features when calling a function with target features outside an unsafe block

Fixes https://github.com/rust-lang/rust/issues/108680

Supersedes https://github.com/rust-lang/rust/pull/109710. I used the same wording for the messages, but the implementation is different.

r? `@est31`
Diffstat (limited to 'compiler/rustc_middle/src/mir/query.rs')
-rw-r--r--compiler/rustc_middle/src/mir/query.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs
index ab8fef5129b..98642adc190 100644
--- a/compiler/rustc_middle/src/mir/query.rs
+++ b/compiler/rustc_middle/src/mir/query.rs
@@ -27,7 +27,7 @@ pub enum UnsafetyViolationKind {
     UnsafeFn,
 }
 
-#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
+#[derive(Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
 pub enum UnsafetyViolationDetails {
     CallToUnsafeFunction,
     UseOfInlineAssembly,
@@ -39,10 +39,17 @@ pub enum UnsafetyViolationDetails {
     AccessToUnionField,
     MutationOfLayoutConstrainedField,
     BorrowOfLayoutConstrainedField,
-    CallToFunctionWith,
+    CallToFunctionWith {
+        /// Target features enabled in callee's `#[target_feature]` but missing in
+        /// caller's `#[target_feature]`.
+        missing: Vec<Symbol>,
+        /// Target features in `missing` that are enabled at compile time
+        /// (e.g., with `-C target-feature`).
+        build_enabled: Vec<Symbol>,
+    },
 }
 
-#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
+#[derive(Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
 pub struct UnsafetyViolation {
     pub source_info: SourceInfo,
     pub lint_root: hir::HirId,