Disallow enabling features without their implied features
This commit is contained in:
parent
0b98a0c727
commit
8818c95528
5 changed files with 11 additions and 23 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue