Skip to content

Commit c1a7dbc

Browse files
Rebase conflicts
1 parent b2df88b commit c1a7dbc

File tree

1 file changed

+7
-7
lines changed
  • compiler/rustc_trait_selection/src/traits/error_reporting

1 file changed

+7
-7
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
885885
err: &mut Diagnostic,
886886
trait_pred: ty::PolyTraitPredicate<'tcx>,
887887
) -> bool {
888+
// It doesn't make sense to make this suggestion outside of typeck...
889+
// (also autoderef will ICE...)
890+
if self.typeck_results.is_none() {
891+
return false;
892+
}
893+
888894
if let ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) = obligation.predicate.kind().skip_binder()
889895
&& Some(trait_pred.def_id()) == self.tcx.lang_items().sized_trait()
890896
{
@@ -1104,13 +1110,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
11041110
found: Ty<'tcx>,
11051111
) -> Option<(DefIdOrName, Ty<'tcx>, Vec<Ty<'tcx>>)> {
11061112
// Autoderef is useful here because sometimes we box callables, etc.
1107-
let Some((def_id_or_name, output, inputs)) = Autoderef::new(
1108-
self,
1109-
param_env,
1110-
hir_id,
1111-
DUMMY_SP,
1112-
found,
1113-
).silence_errors().find_map(|(found, _)| {
1113+
let Some((def_id_or_name, output, inputs)) = (self.autoderef_steps)(found).into_iter().find_map(|(found, _)| {
11141114
match *found.kind() {
11151115
ty::FnPtr(fn_sig) =>
11161116
Some((DefIdOrName::Name("function pointer"), fn_sig.output(), fn_sig.inputs())),

0 commit comments

Comments
 (0)