mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
Make hir::TyKind::TraitObject use tagged ptr
This commit is contained in:
@@ -433,7 +433,7 @@ fn visit_ty(&mut self, ty: &'tcx Ty<'_>) {
|
||||
sub_visitor.visit_fn_decl(decl);
|
||||
self.nested_elision_site_lts.append(&mut sub_visitor.all_lts());
|
||||
},
|
||||
TyKind::TraitObject(bounds, lt, _) => {
|
||||
TyKind::TraitObject(bounds, lt) => {
|
||||
if !lt.is_elided() {
|
||||
self.unelided_trait_object_lifetime = true;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, lt: &Lifetime, m
|
||||
// Originally reported as the issue #3128.
|
||||
let inner_snippet = snippet(cx, inner.span, "..");
|
||||
let suggestion = match &inner.kind {
|
||||
TyKind::TraitObject(bounds, lt_bound, _) if bounds.len() > 1 || !lt_bound.is_elided() => {
|
||||
TyKind::TraitObject(bounds, lt_bound) if bounds.len() > 1 || !lt_bound.is_elided() => {
|
||||
format!("&{ltopt}({inner_snippet})")
|
||||
},
|
||||
TyKind::Path(qpath)
|
||||
|
||||
@@ -52,7 +52,7 @@ fn visit_ty(&mut self, ty: &'tcx hir::Ty<'_>) {
|
||||
// function types bring a lot of overhead
|
||||
TyKind::BareFn(bare) if bare.abi == Abi::Rust => (50 * self.nest, 1),
|
||||
|
||||
TyKind::TraitObject(param_bounds, _, _) => {
|
||||
TyKind::TraitObject(param_bounds, _) => {
|
||||
let has_lifetime_parameters = param_bounds.iter().any(|bound| {
|
||||
bound
|
||||
.bound_generic_params
|
||||
|
||||
@@ -400,7 +400,7 @@ fn ty_search_pat(ty: &Ty<'_>) -> (Pat, Pat) {
|
||||
TyKind::OpaqueDef(..) => (Pat::Str("impl"), Pat::Str("")),
|
||||
TyKind::Path(qpath) => qpath_search_pat(&qpath),
|
||||
TyKind::Infer => (Pat::Str("_"), Pat::Str("_")),
|
||||
TyKind::TraitObject(_, _, TraitObjectSyntax::Dyn) => (Pat::Str("dyn"), Pat::Str("")),
|
||||
TyKind::TraitObject(_, tagged_ptr) if let TraitObjectSyntax::Dyn = tagged_ptr.tag() => (Pat::Str("dyn"), Pat::Str("")),
|
||||
// NOTE: `TraitObject` is incomplete. It will always return true then.
|
||||
_ => (Pat::Str(""), Pat::Str("")),
|
||||
}
|
||||
|
||||
@@ -1281,7 +1281,7 @@ pub fn hash_tykind(&mut self, ty: &TyKind<'_>) {
|
||||
}
|
||||
},
|
||||
TyKind::Path(qpath) => self.hash_qpath(qpath),
|
||||
TyKind::TraitObject(_, lifetime, _) => {
|
||||
TyKind::TraitObject(_, lifetime) => {
|
||||
self.hash_lifetime(lifetime);
|
||||
},
|
||||
TyKind::Typeof(anon_const) => {
|
||||
|
||||
Reference in New Issue
Block a user