Auto merge of #116405 - estebank:issue-103155, r=davidtwco
Detect object safety errors when assoc type is missing When an associated type with GATs isn't specified in a `dyn Trait`, emit an object safety error instead of only complaining about the missing associated type, as it will lead the user down a path of three different errors before letting them know that what they were trying to do is impossible to begin with. Fix #103155.
This commit is contained in:
commit
a395214a3a
38 changed files with 249 additions and 193 deletions
|
@ -47,7 +47,7 @@ pub use self::engine::{ObligationCtxt, TraitEngineExt};
|
|||
pub use self::fulfill::{FulfillmentContext, PendingPredicateObligation};
|
||||
pub use self::object_safety::astconv_object_safety_violations;
|
||||
pub use self::object_safety::is_vtable_safe_method;
|
||||
pub use self::object_safety::MethodViolationCode;
|
||||
pub use self::object_safety::object_safety_violations_for_assoc_item;
|
||||
pub use self::object_safety::ObjectSafetyViolation;
|
||||
pub use self::project::NormalizeExt;
|
||||
pub use self::project::{normalize_inherent_projection, normalize_projection_type};
|
||||
|
|
|
@ -360,7 +360,7 @@ fn generics_require_sized_self(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
|||
|
||||
/// Returns `Some(_)` if this item makes the containing trait not object safe.
|
||||
#[instrument(level = "debug", skip(tcx), ret)]
|
||||
fn object_safety_violations_for_assoc_item(
|
||||
pub fn object_safety_violations_for_assoc_item(
|
||||
tcx: TyCtxt<'_>,
|
||||
trait_def_id: DefId,
|
||||
item: ty::AssocItem,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue