diff options
| author | bors <bors@rust-lang.org> | 2023-03-14 17:40:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-14 17:40:52 +0000 |
| commit | 1716932743a7b3705cbf0c34db0c4e070ed1930d (patch) | |
| tree | 3a1d0b0801e72f0229b3b7f9ba9489252d7c7b90 /compiler/rustc_trait_selection/src | |
| parent | 2e7034ebf7f57066c260b680c5e9dfcf04ca4cd5 (diff) | |
| parent | b17ee106d8d6c3402020c72b703455305432b759 (diff) | |
| download | rust-1716932743a7b3705cbf0c34db0c4e070ed1930d.tar.gz rust-1716932743a7b3705cbf0c34db0c4e070ed1930d.zip | |
Auto merge of #109130 - matthiaskrgr:rollup-dm3jza6, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #108722 (Support for Fuchsia RISC-V target) - #108880 (Remove tests/ui/impl-trait/in-trait/new-lowering-strategy in favor of using revisions on existing tests) - #108909 (Fix object safety checks for new RPITITs) - #108915 (Remove some direct calls to local_def_id_to_hir_id on diagnostics) - #108923 (Make fns from other crates with RPITIT work for -Zlower-impl-trait-in-trait-to-assoc-ty) - #109101 (Fall back to old metadata computation when type references errors) - #109105 (Don't ICE for late-bound consts across `AnonConstBoundary`) - #109110 (Don't codegen impossible to satisfy impls) - #109116 (Emit diagnostic when calling methods on the unit type in method chains) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/object_safety.rs | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs index b3bf9ad599a..277926688e2 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs @@ -144,6 +144,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { trait_ref: ty::PolyTraitRef<'tcx>, obligation: &PredicateObligation<'tcx>, ) -> OnUnimplementedNote { + if self.tcx.opt_rpitit_info(obligation.cause.body_id.to_def_id()).is_some() { + return OnUnimplementedNote::default(); + } + let (def_id, substs) = self .impl_similar_to(trait_ref, obligation) .unwrap_or_else(|| (trait_ref.def_id(), trait_ref.skip_binder().substs)); diff --git a/compiler/rustc_trait_selection/src/traits/object_safety.rs b/compiler/rustc_trait_selection/src/traits/object_safety.rs index 4eacb5211f7..a5def4151bf 100644 --- a/compiler/rustc_trait_selection/src/traits/object_safety.rs +++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs @@ -13,7 +13,6 @@ use super::{elaborate_predicates, elaborate_trait_ref}; use crate::infer::TyCtxtInferExt; use crate::traits::query::evaluate_obligation::InferCtxtExt; use crate::traits::{self, Obligation, ObligationCause}; -use hir::def::DefKind; use rustc_errors::{DelayDm, FatalError, MultiSpan}; use rustc_hir as hir; use rustc_hir::def_id::DefId; @@ -157,6 +156,7 @@ fn object_safety_violations_for_trait( .in_definition_order() .filter(|item| item.kind == ty::AssocKind::Type) .filter(|item| !tcx.generics_of(item.def_id).params.is_empty()) + .filter(|item| tcx.opt_rpitit_info(item.def_id).is_none()) .map(|item| { let ident = item.ident(tcx); ObjectSafetyViolation::GAT(ident.name, ident.span) @@ -854,7 +854,7 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeVisitable<TyCtxt<'tcx>>>( } } ty::Alias(ty::Projection, ref data) - if self.tcx.def_kind(data.def_id) == DefKind::ImplTraitPlaceholder => + if self.tcx.is_impl_trait_in_trait(data.def_id) => { // We'll deny these later in their own pass ControlFlow::Continue(()) @@ -921,7 +921,7 @@ pub fn contains_illegal_impl_trait_in_trait<'tcx>( ty.skip_binder().walk().find_map(|arg| { if let ty::GenericArgKind::Type(ty) = arg.unpack() && let ty::Alias(ty::Projection, proj) = ty.kind() - && tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder + && tcx.is_impl_trait_in_trait(proj.def_id) { Some(MethodViolationCode::ReferencesImplTraitInTrait(tcx.def_span(proj.def_id))) } else { |
