@@ -4,9 +4,9 @@ use rustc_ast::{NodeId, PatKind, attr, token};
4
4
use rustc_feature:: { AttributeGate , BUILTIN_ATTRIBUTE_MAP , BuiltinAttribute , Features , GateIssue } ;
5
5
use rustc_session:: Session ;
6
6
use rustc_session:: parse:: { feature_err, feature_err_issue, feature_warn} ;
7
- use rustc_span:: Span ;
8
7
use rustc_span:: source_map:: Spanned ;
9
8
use rustc_span:: symbol:: sym;
9
+ use rustc_span:: { Span , Symbol } ;
10
10
use rustc_target:: spec:: abi;
11
11
use thin_vec:: ThinVec ;
12
12
@@ -483,6 +483,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
483
483
pub fn check_crate ( krate : & ast:: Crate , sess : & Session , features : & Features ) {
484
484
maybe_stage_features ( sess, features, krate) ;
485
485
check_incompatible_features ( sess, features) ;
486
+ check_new_solver_banned_features ( sess, features) ;
487
+
486
488
let mut visitor = PostExpansionVisitor { sess, features } ;
487
489
488
490
let spans = sess. psess . gated_spans . spans . borrow ( ) ;
@@ -662,3 +664,22 @@ fn check_incompatible_features(sess: &Session, features: &Features) {
662
664
}
663
665
}
664
666
}
667
+
668
+ fn check_new_solver_banned_features ( sess : & Session , features : & Features ) {
669
+ if !sess. opts . unstable_opts . next_solver . is_some_and ( |n| n. globally ) {
670
+ return ;
671
+ }
672
+
673
+ // Ban GCE with the new solver, because it does not implement GCE correctly.
674
+ if let Some ( & ( _, gce_span, _) ) = features
675
+ . declared_lang_features
676
+ . iter ( )
677
+ . find ( |& & ( feat, _, _) | feat == sym:: generic_const_exprs)
678
+ {
679
+ sess. dcx ( ) . emit_err ( errors:: IncompatibleFeatures {
680
+ spans : vec ! [ gce_span] ,
681
+ f1 : Symbol :: intern ( "-Znext-solver=globally" ) ,
682
+ f2 : sym:: generic_const_exprs,
683
+ } ) ;
684
+ }
685
+ }
0 commit comments