Change:
I expect the code below code to compile, but it fails. should allow more than just the types whitelisted in , but it seems rustc only looks at the flag in this case. The error message is:
You are right But why would you want to use the two of them?
I imagine this to happen whenever at first you only decide to use , but then later also switch to . You might just follow rustc, which tells you to add to your project, so you do, but then you get the behaviour as described in this issue. This could also perhaps get triggered in a more subtle way where you write a library that uses to enable or disable features.
what do you think ?
It probably makes sense to instead check if we are not using here, but there are a quite a few places were we check for , we maybe want to instead emit an error/warning when using both and in the same crate.
Created a way to produce an error in case of incompatible features, like this one
I have one question, how does using 'incompatible feature' cause maybe undefined behavior? Are there other incompatible features? In this case, wouldn't it be better to produce an error message like "feature(constgenerics) is a superset of feature(minconst_generics)"?
Note that: results in a : So currently is not a superset of .
You are missing a in your feature. I still think constgenerics are a superset of minconstgenerics, but rustc just suggest using the smaller one in this case becouse that's the subset aiming to be stabilized for now
Ah of course, my bad I was confused looking at some ui tests for const generics, and missed that those now have support differentiating between expected behavior under and , and thought a particular error was always being thrown, instead of only under .

Discussion:
pub fn check_crate(krate: &ast::Crate, sess: &Session) { maybe_stage_features(sess, krate); <ins> check_incompatible_features(sess); </ins> let mut visitor = PostExpansionVisitor { sess, features: &sess.features_untracked() }; let spans = sess.parse_sess.gated_spans.spans.borrow();

} } } <ins> fn check_incompatible_features(sess: &Session) { let features = sess.features_untracked(); let declared_features = features .declared_lang_features .iter() .copied() .map(|(name, span, _)| (name, span)) .chain(features.declared_lib_features.iter().copied()); for (f1, f2) in rustc_feature::INCOMPATIBLE_FEATURES .iter() .filter(|&&(f1, f2)| features.enabled(f1) && features.enabled(f2)) { if let Some((f1_name, f1_span)) = declared_features.clone().find(|(name, _)| name == f1) { if let Some((f2_name, f2_span)) = declared_features.clone().find(|(name, _)| name == f2) { let spans = vec![f1_span, f2_span]; sess.struct_span_err( spans.clone(), &format!( "features `{}` and `{}` are incompatible, using them at the same time  is not allowed", f1_name, f2_name ), ) .help("remove one of these features") .emit(); } } } } </ins>

sym::lazy_normalization_consts, sym::specialization, ]; <ins> /// Some features are not allowed to be used together at the same time, if /// the two are present, produce an error pub const INCOMPATIBLE_FEATURES: &[(Symbol, Symbol)] = &[(sym::const_generics, sym::min_const_generics)]; </ins>

} pub use accepted::ACCEPTED_FEATURES; <del> pub use active::{Features, ACTIVE_FEATURES, INCOMPLETE_FEATURES}; </del> <ins> pub use active::{Features, ACTIVE_FEATURES, INCOMPATIBLE_FEATURES, INCOMPLETE_FEATURES}; </ins> pub use builtin_attrs::{ deprecated_attributes, find_gated_cfg, is_builtin_attr_name, AttributeGate, AttributeTemplate, AttributeType, BuiltinAttribute, GatedCfg, BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP,

<ins> #![feature(const_generics)] //~^ ERROR features `const_generics` and `min_const_generics` are incompatible #![allow(incomplete_features)] #![feature(min_const_generics)] fn main() {} </ins>

<ins> error: features `const_generics` and `min_const_generics` are incompatible, using them at the same time is not allowed --> $DIR/min-and-full-same-time.rs:1:12 | LL | #![feature(const_generics)] |            ^^^^^^^^^^^^^^ ... LL | #![feature(min_const_generics)] |            ^^^^^^^^^^^^^^^^^^ | = help: remove one of these features error: aborting due to previous error </ins>