diff options
| author | bors <bors@rust-lang.org> | 2023-09-11 16:50:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-09-11 16:50:22 +0000 |
| commit | 0a199e4e93d2c7cfa7e0bee831e5aed03250fab4 (patch) | |
| tree | ca3aa84c2f830f3fca904de76fa2dc436ec15e41 /compiler/rustc_trait_selection/src | |
| parent | 3ebb5629d1a39345d37c4838d31dc7280384ea94 (diff) | |
| parent | 9ed6eea86ba3b6c66e448d8be971b302a5788742 (diff) | |
| download | rust-0a199e4e93d2c7cfa7e0bee831e5aed03250fab4.tar.gz rust-0a199e4e93d2c7cfa7e0bee831e5aed03250fab4.zip | |
Auto merge of #115758 - matthiaskrgr:rollup-khwbjj7, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #115335 (fix overflow in array length computation) - #115440 (bootstrap/format: remove unnecessary paths.push) - #115702 (Update mailmap) - #115727 (Implement fallback for effect param) - #115739 (Call `LateLintPass::check_attribute` from `with_lint_attrs`) - #115743 (Point out if a local trait has no implementations) - #115744 (Improve diagnostic for generic params from outer items (E0401)) - #115752 (rustdoc: Add missing "Aliased type" title in the sidebar) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/canonicalize.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs | 24 |
2 files changed, 22 insertions, 5 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/canonicalize.rs b/compiler/rustc_trait_selection/src/solve/canonicalize.rs index a9d182abfb7..77c0f9f090c 100644 --- a/compiler/rustc_trait_selection/src/solve/canonicalize.rs +++ b/compiler/rustc_trait_selection/src/solve/canonicalize.rs @@ -365,6 +365,9 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> { // FIXME: we should fold this ty eventually CanonicalVarKind::Const(ui, c.ty()) } + ty::ConstKind::Infer(ty::InferConst::EffectVar(_)) => { + bug!("effect var has no universe") + } ty::ConstKind::Infer(ty::InferConst::Fresh(_)) => { bug!("fresh var during canonicalization: {c:?}") } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 746a38f956a..e4f5c4003c9 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -3009,10 +3009,10 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // Try to report a help message if is_fn_trait && let Ok((implemented_kind, params)) = self.type_implements_fn_trait( - obligation.param_env, - trait_ref.self_ty(), - trait_predicate.skip_binder().polarity, - ) + obligation.param_env, + trait_ref.self_ty(), + trait_predicate.skip_binder().polarity, + ) { self.add_help_message_for_fn_trait(trait_ref, err, implemented_kind, params); } else if !trait_ref.has_non_region_infer() @@ -3031,6 +3031,15 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { None, obligation.cause.body_id, ); + } else if trait_ref.def_id().is_local() + && self.tcx.trait_impls_of(trait_ref.def_id()).is_empty() + && !self.tcx.trait_is_auto(trait_ref.def_id()) + && !self.tcx.trait_is_alias(trait_ref.def_id()) + { + err.span_help( + self.tcx.def_span(trait_ref.def_id()), + crate::fluent_generated::trait_selection_trait_has_no_impls, + ); } else if !suggested && !unsatisfied_const { // Can't show anything else useful, try to find similar impls. let impl_candidates = self.find_similar_impl_candidates(*trait_predicate); @@ -3041,7 +3050,12 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { err, true, ) { - self.report_similar_impl_candidates_for_root_obligation(&obligation, *trait_predicate, body_def_id, err); + self.report_similar_impl_candidates_for_root_obligation( + &obligation, + *trait_predicate, + body_def_id, + err, + ); } self.suggest_convert_to_slice( |
