diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2024-08-06 00:35:32 -0400 |
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2024-08-07 00:45:00 -0400 |
| commit | 8818c9552821721e4be5c19832b4e3ac64090feb (patch) | |
| tree | 709edffd8770e88eb3762431b1c53649fc0e691d /compiler/rustc_const_eval/src/interpret | |
| parent | 0b98a0c72769c2549827ec2320beb5478ca3c335 (diff) | |
Disallow enabling features without their implied features
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/call.rs | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs index e5c195f08d7..b5f3d07d90b 100644 --- a/compiler/rustc_const_eval/src/interpret/call.rs +++ b/compiler/rustc_const_eval/src/interpret/call.rs @@ -319,18 +319,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { .iter() .any(|feature| !self.tcx.sess.target_features.contains(&feature.name)) { - // Don't include implicit features in the error, unless only implicit features are - // missing. This should be rare, because it can only happen when an implicit feature - // is disabled, e.g. `+avx2,-avx` - let missing_explicit_features = attrs.target_features.iter().any(|feature| { - !feature.implied && !self.tcx.sess.target_features.contains(&feature.name) - }); throw_ub_custom!( fluent::const_eval_unavailable_target_features_for_fn, unavailable_feats = attrs .target_features .iter() - .filter(|&feature| !(missing_explicit_features && feature.implied) + .filter(|&feature| !feature.implied && !self.tcx.sess.target_features.contains(&feature.name)) .fold(String::new(), |mut s, feature| { if !s.is_empty() { |
