diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 3bbe6a23b6628..8bcae3d9ab7cc 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -589,17 +589,6 @@ pub fn structurally_relate_consts<'tcx, R: TypeRelation<'tcx>>( debug!("{}.structurally_relate_consts(a = {:?}, b = {:?})", relation.tag(), a, b); let tcx = relation.tcx(); - // HACK(const_generics): We still need to eagerly evaluate consts when - // relating them because during `normalize_param_env_or_error`, - // we may relate an evaluated constant in a obligation against - // an unnormalized (i.e. unevaluated) const in the param-env. - // FIXME(generic_const_exprs): Once we always lazily unify unevaluated constants - // these `eval` calls can be removed. - if !tcx.features().generic_const_exprs { - a = a.eval(tcx, relation.param_env()); - b = b.eval(tcx, relation.param_env()); - } - if tcx.features().generic_const_exprs { a = tcx.expand_abstract_consts(a); b = tcx.expand_abstract_consts(b); diff --git a/tests/ui/consts/unnormalized-param-env.rs b/tests/ui/consts/unnormalized-param-env.rs index a7bbe4db99290..79f6509d1aebb 100644 --- a/tests/ui/consts/unnormalized-param-env.rs +++ b/tests/ui/consts/unnormalized-param-env.rs @@ -1,4 +1,4 @@ -// check-pass +// known-bug: unknown pub trait CSpace { type Traj; diff --git a/tests/ui/consts/unnormalized-param-env.stderr b/tests/ui/consts/unnormalized-param-env.stderr new file mode 100644 index 0000000000000..eee098fb9a167 --- /dev/null +++ b/tests/ui/consts/unnormalized-param-env.stderr @@ -0,0 +1,28 @@ +error[E0277]: the trait bound `CS: CSpace<4>` is not satisfied + --> $DIR/unnormalized-param-env.rs:23:5 + | +LL | / fn trajectory_free(&self, t: &TF) +LL | | where +LL | | CS::Traj: Sized, +LL | | CS: CSpace, + | |______________________^ the trait `CSpace<4>` is not implemented for `CS` + | +help: consider restricting type parameter `CS` + | +LL | impl> Obstacle for ObstacleSpace2df32 { + | +++++++++++ + +error[E0277]: the trait bound `CS: CSpace<4>` is not satisfied + --> $DIR/unnormalized-param-env.rs:23:8 + | +LL | fn trajectory_free(&self, t: &TF) + | ^^^^^^^^^^^^^^^ the trait `CSpace<4>` is not implemented for `CS` + | +help: consider restricting type parameter `CS` + | +LL | impl> Obstacle for ObstacleSpace2df32 { + | +++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`.