提交 ac6f2f0d 编写于 作者: M Michael Goulet

Fix a comment

上级 44be25d8
......@@ -1462,7 +1462,7 @@ pub fn associated_path_to_ty(
let traits: Vec<_> =
self.probe_traits_that_match_assoc_ty(qself_ty, assoc_ident);
// Don't print `TyErr` to the user.
// Don't print `ty::Error` to the user.
self.report_ambiguous_associated_type(
span,
&[qself_ty.to_string()],
......
......@@ -795,7 +795,7 @@ fn deduce_future_output_from_projection(
/// Converts the types that the user supplied, in case that doing
/// so should yield an error, but returns back a signature where
/// all parameters are of type `TyErr`.
/// all parameters are of type `ty::Error`.
fn error_sig_of_closure(
&self,
decl: &hir::FnDecl<'_>,
......
......@@ -562,16 +562,8 @@ pub fn destructor(self, tcx: TyCtxt<'tcx>) -> Option<Destructor> {
tcx.adt_destructor(self.did())
}
/// Returns a list of types such that `Self: Sized` if and only
/// if that type is `Sized`, or `TyErr` if this type is recursive.
///
/// Oddly enough, checking that the sized-constraint is `Sized` is
/// actually more expressive than checking all members:
/// the `Sized` trait is inductive, so an associated type that references
/// `Self` would prevent its containing ADT from being `Sized`.
///
/// Due to normalization being eager, this applies even if
/// the associated type is behind a pointer (e.g., issue #31299).
/// Returns a list of types such that `Self: Sized` if and only if that
/// type is `Sized`, or `ty::Error` if this type has a recursive layout.
pub fn sized_constraint(self, tcx: TyCtxt<'tcx>) -> ty::EarlyBinder<&'tcx ty::List<Ty<'tcx>>> {
tcx.adt_sized_constraint(self.did())
}
......
......@@ -62,7 +62,8 @@ fn sized_constraint_for_ty<'tcx>(
let predicates = tcx.predicates_of(adtdef.did()).predicates;
if predicates.iter().any(|(p, _)| {
p.as_trait_clause().is_some_and(|trait_pred| {
trait_pred.def_id() == sized_trait_def_id && trait_pred.self_ty().skip_binder() == ty
trait_pred.def_id() == sized_trait_def_id
&& trait_pred.self_ty().skip_binder() == ty
})
}) {
vec![]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册