Change:
<!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. If you cannot produce a minimal reproduction case (something that would work in isolation), please provide the steps or even link to a repository that causes the problematic output to occur. --Based on the example in , which after the changes in would output an error. The following code, however, does not output such an error, although I believe it should. Given the following code: <!-- Please provide a link to --The current output is: This only happens if the is included. This also compiles if you don't include the call of in main. <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
dont think this is related to adtconstparams as this has the same error:
the reason this happens is because from we don't infer the value for . The error message should be improved by using in this branch for that the predicates should be searched for a relevant inference variable.
going to mentor this issue in case someone wants to fix this
claim

Discussion:
} } <ins> ty::PredicateKind::ConstEvaluatable(data) => { if predicate.references_error() || self.is_tainted_by_errors() { return; } let subst = data.substs.iter().find(|g| g.has_infer_types_or_consts()); if let Some(subst) = subst { let err = self.emit_inference_failure_err( body_id, span, subst, ErrorCode::E0284, true, ); err } else { // If we can't find a substitution, just print a generic error let mut err = struct_span_err!( self.tcx.sess, span, E0284, "type annotations needed: cannot satisfy `{}`", predicate, ); err.span_label(span, &format!("cannot satisfy `{}`", predicate)); err } } </ins> _ => { if self.tcx.sess.has_errors().is_some() || self.is_tainted_by_errors() { return;

} fn main() { <del> // FIXME(generic_const_exprs): Improve the error message here. </del> use_dyn(&()); //~^ ERROR type annotations needed }

<del> error[E0284]: type annotations needed: cannot satisfy `the constant `use_dyn::<{_: usize}>::{constant#0}` can be evaluated` --> $DIR/object-safety-ok-infer-err.rs:20:5 </del> <ins> error[E0284]: type annotations needed --> $DIR/object-safety-ok-infer-err.rs:19:5 </ins> | LL |     use_dyn(&()); <del> |     ^^^^^^^ cannot satisfy `the constant `use_dyn::<{_: usize}>::{constant#0}` can be evaluated` </del> <ins> |     ^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `use_dyn` </ins> | note: required by a bound in `use_dyn` --> $DIR/object-safety-ok-infer-err.rs:14:55 | LL | fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized { |                                                       ^^^^^ required by this bound in `use_dyn` <ins> help: consider specifying the generic argument | LL |     use_dyn::<N>(&()); |            +++++ </ins> error: aborting due to previous error

fn main() { // check for `impl Trait<{ const }>` which has a parent of a `DefKind::TyParam` generics_of_parent_impl_trait::foo([()]); <del> //~^ error: type annotations needed: </del> <ins> //~^ error: type annotations needed </ins> }

<del> error[E0284]: type annotations needed: cannot satisfy `the constant `foo::{opaque#0}::{constant#0}` can be evaluated` </del> <ins> error[E0284]: type annotations needed </ins> --> $DIR/parent_generics_of_encoding_impl_trait.rs:9:5 | LL |     generics_of_parent_impl_trait::foo([()]); <del> |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `foo::{opaque#0}::{constant#0}` can be evaluated` </del> <ins> |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `foo` </ins> | note: required by a bound in `foo` --> $DIR/auxiliary/generics_of_parent_impl_trait.rs:6:48