Fallout in other crates.
This commit is contained in:
parent
c737c07021
commit
36f95ab3fa
@ -983,7 +983,7 @@ impl UnreachablePub {
|
||||
cx: &LateContext<'_, '_>,
|
||||
what: &str,
|
||||
id: hir::HirId,
|
||||
vis: &hir::Visibility,
|
||||
vis: &hir::Visibility<'_>,
|
||||
span: Span,
|
||||
exportable: bool,
|
||||
) {
|
||||
@ -1065,7 +1065,7 @@ declare_lint_pass!(
|
||||
);
|
||||
|
||||
impl TypeAliasBounds {
|
||||
fn is_type_variable_assoc(qpath: &hir::QPath) -> bool {
|
||||
fn is_type_variable_assoc(qpath: &hir::QPath<'_>) -> bool {
|
||||
match *qpath {
|
||||
hir::QPath::TypeRelative(ref ty, _) => {
|
||||
// If this is a type variable, we found a `T::Assoc`.
|
||||
@ -1081,7 +1081,7 @@ impl TypeAliasBounds {
|
||||
}
|
||||
}
|
||||
|
||||
fn suggest_changing_assoc_types(ty: &hir::Ty, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn suggest_changing_assoc_types(ty: &hir::Ty<'_>, err: &mut DiagnosticBuilder<'_>) {
|
||||
// Access to associates types should use `<T as Bound>::Assoc`, which does not need a
|
||||
// bound. Let's see if this type does that.
|
||||
|
||||
@ -1095,7 +1095,7 @@ impl TypeAliasBounds {
|
||||
intravisit::NestedVisitorMap::None
|
||||
}
|
||||
|
||||
fn visit_qpath(&mut self, qpath: &'v hir::QPath, id: hir::HirId, span: Span) {
|
||||
fn visit_qpath(&mut self, qpath: &'v hir::QPath<'v>, id: hir::HirId, span: Span) {
|
||||
if TypeAliasBounds::is_type_variable_assoc(qpath) {
|
||||
self.err.span_help(
|
||||
span,
|
||||
@ -1533,7 +1533,7 @@ impl ExplicitOutlivesRequirements {
|
||||
|
||||
fn collect_outlived_lifetimes<'tcx>(
|
||||
&self,
|
||||
param: &'tcx hir::GenericParam,
|
||||
param: &'tcx hir::GenericParam<'tcx>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
inferred_outlives: &'tcx [(ty::Predicate<'tcx>, Span)],
|
||||
ty_generics: &'tcx ty::Generics,
|
||||
@ -1554,7 +1554,7 @@ impl ExplicitOutlivesRequirements {
|
||||
fn collect_outlives_bound_spans<'tcx>(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
bounds: &hir::GenericBounds,
|
||||
bounds: &hir::GenericBounds<'_>,
|
||||
inferred_outlives: &[ty::Region<'tcx>],
|
||||
infer_static: bool,
|
||||
) -> Vec<(usize, Span)> {
|
||||
@ -1585,7 +1585,7 @@ impl ExplicitOutlivesRequirements {
|
||||
fn consolidate_outlives_bound_spans(
|
||||
&self,
|
||||
lo: Span,
|
||||
bounds: &hir::GenericBounds,
|
||||
bounds: &hir::GenericBounds<'_>,
|
||||
bound_spans: Vec<(usize, Span)>,
|
||||
) -> Vec<Span> {
|
||||
if bounds.is_empty() {
|
||||
|
@ -293,7 +293,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_generic_param(&mut self, cx: &LateContext<'_, '_>, param: &hir::GenericParam) {
|
||||
fn check_generic_param(&mut self, cx: &LateContext<'_, '_>, param: &hir::GenericParam<'_>) {
|
||||
if let GenericParamKind::Lifetime { .. } = param.kind {
|
||||
self.check_snake_case(cx, "lifetime", ¶m.name.ident());
|
||||
}
|
||||
@ -303,7 +303,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
|
||||
&mut self,
|
||||
cx: &LateContext<'_, '_>,
|
||||
fk: FnKind<'_>,
|
||||
_: &hir::FnDecl,
|
||||
_: &hir::FnDecl<'_>,
|
||||
_: &hir::Body<'_>,
|
||||
_: Span,
|
||||
id: hir::HirId,
|
||||
@ -425,7 +425,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_generic_param(&mut self, cx: &LateContext<'_, '_>, param: &hir::GenericParam) {
|
||||
fn check_generic_param(&mut self, cx: &LateContext<'_, '_>, param: &hir::GenericParam<'_>) {
|
||||
if let GenericParamKind::Const { .. } = param.kind {
|
||||
NonUpperCaseGlobals::check_upper_case(cx, "const parameter", ¶m.name.ident());
|
||||
}
|
||||
|
@ -963,12 +963,12 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_foreign_fn(&mut self, id: hir::HirId, decl: &hir::FnDecl) {
|
||||
fn check_foreign_fn(&mut self, id: hir::HirId, decl: &hir::FnDecl<'_>) {
|
||||
let def_id = self.cx.tcx.hir().local_def_id(id);
|
||||
let sig = self.cx.tcx.fn_sig(def_id);
|
||||
let sig = self.cx.tcx.erase_late_bound_regions(&sig);
|
||||
|
||||
for (input_ty, input_hir) in sig.inputs().iter().zip(&decl.inputs) {
|
||||
for (input_ty, input_hir) in sig.inputs().iter().zip(decl.inputs) {
|
||||
self.check_type_for_ffi_and_report_errors(input_hir.span, input_ty, false);
|
||||
}
|
||||
|
||||
|
@ -664,7 +664,7 @@ impl EncodeContext<'tcx> {
|
||||
id: hir::HirId,
|
||||
md: &hir::Mod<'_>,
|
||||
attrs: &[ast::Attribute],
|
||||
vis: &hir::Visibility,
|
||||
vis: &hir::Visibility<'_>,
|
||||
) {
|
||||
let tcx = self.tcx;
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
@ -1547,7 +1547,7 @@ impl Visitor<'tcx> for EncodeContext<'tcx> {
|
||||
let def_id = self.tcx.hir().local_def_id(ni.hir_id);
|
||||
self.encode_info_for_foreign_item(def_id, ni);
|
||||
}
|
||||
fn visit_generics(&mut self, generics: &'tcx hir::Generics) {
|
||||
fn visit_generics(&mut self, generics: &'tcx hir::Generics<'tcx>) {
|
||||
intravisit::walk_generics(self, generics);
|
||||
self.encode_info_for_generics(generics);
|
||||
}
|
||||
@ -1568,7 +1568,7 @@ impl EncodeContext<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_info_for_generics(&mut self, generics: &hir::Generics) {
|
||||
fn encode_info_for_generics(&mut self, generics: &hir::Generics<'tcx>) {
|
||||
for param in &generics.params {
|
||||
let def_id = self.tcx.hir().local_def_id(param.hir_id);
|
||||
match param.kind {
|
||||
|
@ -410,7 +410,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
) -> Option<RegionName> {
|
||||
let mir_hir_id = infcx.tcx.hir().as_local_hir_id(mir_def_id)?;
|
||||
let fn_decl = infcx.tcx.hir().fn_decl_by_hir_id(mir_hir_id)?;
|
||||
let argument_hir_ty: &hir::Ty = fn_decl.inputs.get(argument_index)?;
|
||||
let argument_hir_ty: &hir::Ty<'_> = fn_decl.inputs.get(argument_index)?;
|
||||
match argument_hir_ty.kind {
|
||||
// This indicates a variable with no type annotation, like
|
||||
// `|x|`... in that case, we can't highlight the type but
|
||||
@ -504,10 +504,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
needle_fr: RegionVid,
|
||||
argument_ty: Ty<'tcx>,
|
||||
argument_hir_ty: &hir::Ty,
|
||||
argument_hir_ty: &hir::Ty<'_>,
|
||||
renctx: &mut RegionErrorNamingCtx,
|
||||
) -> Option<RegionName> {
|
||||
let search_stack: &mut Vec<(Ty<'tcx>, &hir::Ty)> =
|
||||
let search_stack: &mut Vec<(Ty<'tcx>, &hir::Ty<'_>)> =
|
||||
&mut vec![(argument_ty, argument_hir_ty)];
|
||||
|
||||
while let Some((ty, hir_ty)) = search_stack.pop() {
|
||||
@ -570,7 +570,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
// just worry about trying to match up the rustc type
|
||||
// with the HIR types:
|
||||
(ty::Tuple(elem_tys), hir::TyKind::Tup(elem_hir_tys)) => {
|
||||
search_stack.extend(elem_tys.iter().map(|k| k.expect_ty()).zip(elem_hir_tys));
|
||||
search_stack.extend(elem_tys.iter().map(|k| k.expect_ty()).zip(*elem_hir_tys));
|
||||
}
|
||||
|
||||
(ty::Slice(elem_ty), hir::TyKind::Slice(elem_hir_ty))
|
||||
@ -600,9 +600,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
&self,
|
||||
substs: SubstsRef<'tcx>,
|
||||
needle_fr: RegionVid,
|
||||
last_segment: &'hir hir::PathSegment,
|
||||
last_segment: &'hir hir::PathSegment<'hir>,
|
||||
renctx: &mut RegionErrorNamingCtx,
|
||||
search_stack: &mut Vec<(Ty<'tcx>, &'hir hir::Ty)>,
|
||||
search_stack: &mut Vec<(Ty<'tcx>, &'hir hir::Ty<'hir>)>,
|
||||
) -> Option<RegionName> {
|
||||
// Did the user give explicit arguments? (e.g., `Foo<..>`)
|
||||
let args = last_segment.args.as_ref()?;
|
||||
@ -647,8 +647,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
&self,
|
||||
substs: SubstsRef<'tcx>,
|
||||
needle_fr: RegionVid,
|
||||
args: &'hir hir::GenericArgs,
|
||||
search_stack: &mut Vec<(Ty<'tcx>, &'hir hir::Ty)>,
|
||||
args: &'hir hir::GenericArgs<'hir>,
|
||||
search_stack: &mut Vec<(Ty<'tcx>, &'hir hir::Ty<'hir>)>,
|
||||
) -> Option<&'hir hir::Lifetime> {
|
||||
for (kind, hir_arg) in substs.iter().zip(&args.args) {
|
||||
match (kind.unpack(), hir_arg) {
|
||||
|
@ -255,7 +255,7 @@ fn const_not_var(
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
tcx: TyCtxt<'_>,
|
||||
pat: &Pat<'_>,
|
||||
path: &hir::Path,
|
||||
path: &hir::Path<'_>,
|
||||
) {
|
||||
let descr = path.res.descr();
|
||||
err.span_label(
|
||||
|
@ -732,7 +732,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||
/// Takes a HIR Path. If the path is a constant, evaluates it and feeds
|
||||
/// it to `const_to_pat`. Any other path (like enum variants without fields)
|
||||
/// is converted to the corresponding pattern via `lower_variant_or_leaf`.
|
||||
fn lower_path(&mut self, qpath: &hir::QPath, id: hir::HirId, span: Span) -> Pat<'tcx> {
|
||||
fn lower_path(&mut self, qpath: &hir::QPath<'_>, id: hir::HirId, span: Span) -> Pat<'tcx> {
|
||||
let ty = self.tables.node_type(id);
|
||||
let res = self.tables.qpath_res(qpath, id);
|
||||
let is_associated_const = match res {
|
||||
|
@ -77,7 +77,7 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> &DefIdSet {
|
||||
&mut self,
|
||||
v: &'tcx hir::VariantData<'tcx>,
|
||||
_: ast::Name,
|
||||
_: &'tcx hir::Generics,
|
||||
_: &'tcx hir::Generics<'tcx>,
|
||||
_: hir::HirId,
|
||||
_: Span,
|
||||
) {
|
||||
|
@ -229,7 +229,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
||||
&mut self,
|
||||
def: &'tcx hir::VariantData<'tcx>,
|
||||
_: ast::Name,
|
||||
_: &hir::Generics,
|
||||
_: &hir::Generics<'_>,
|
||||
_: hir::HirId,
|
||||
_: syntax_pos::Span,
|
||||
) {
|
||||
@ -295,12 +295,12 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
||||
self.in_pat = false;
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'tcx hir::Path, _: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, _: hir::HirId) {
|
||||
self.handle_res(path.res);
|
||||
intravisit::walk_path(self, path);
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
|
||||
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx>) {
|
||||
match ty.kind {
|
||||
TyKind::Def(item_id, _) => {
|
||||
let item = self.tcx.hir().expect_item(item_id.id);
|
||||
@ -619,7 +619,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
variant: &'tcx hir::Variant<'tcx>,
|
||||
g: &'tcx hir::Generics,
|
||||
g: &'tcx hir::Generics<'tcx>,
|
||||
id: hir::HirId,
|
||||
) {
|
||||
if self.should_warn_about_variant(&variant) {
|
||||
|
@ -160,7 +160,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||
hir_visit::walk_expr(self, ex)
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, t: &'v hir::Ty) {
|
||||
fn visit_ty(&mut self, t: &'v hir::Ty<'v>) {
|
||||
self.record("Ty", Id::Node(t.hir_id), t);
|
||||
hir_visit::walk_ty(self, t)
|
||||
}
|
||||
@ -168,7 +168,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||
fn visit_fn(
|
||||
&mut self,
|
||||
fk: hir_visit::FnKind<'v>,
|
||||
fd: &'v hir::FnDecl,
|
||||
fd: &'v hir::FnDecl<'v>,
|
||||
b: hir::BodyId,
|
||||
s: Span,
|
||||
id: hir::HirId,
|
||||
@ -177,7 +177,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||
hir_visit::walk_fn(self, fk, fd, b, s, id)
|
||||
}
|
||||
|
||||
fn visit_where_predicate(&mut self, predicate: &'v hir::WherePredicate) {
|
||||
fn visit_where_predicate(&mut self, predicate: &'v hir::WherePredicate<'v>) {
|
||||
self.record("WherePredicate", Id::None, predicate);
|
||||
hir_visit::walk_where_predicate(self, predicate)
|
||||
}
|
||||
@ -192,7 +192,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||
hir_visit::walk_impl_item(self, ii)
|
||||
}
|
||||
|
||||
fn visit_param_bound(&mut self, bounds: &'v hir::GenericBound) {
|
||||
fn visit_param_bound(&mut self, bounds: &'v hir::GenericBound<'v>) {
|
||||
self.record("GenericBound", Id::None, bounds);
|
||||
hir_visit::walk_param_bound(self, bounds)
|
||||
}
|
||||
@ -205,7 +205,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
v: &'v hir::Variant<'v>,
|
||||
g: &'v hir::Generics,
|
||||
g: &'v hir::Generics<'v>,
|
||||
item_id: hir::HirId,
|
||||
) {
|
||||
self.record("Variant", Id::None, v);
|
||||
@ -217,22 +217,22 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||
hir_visit::walk_lifetime(self, lifetime)
|
||||
}
|
||||
|
||||
fn visit_qpath(&mut self, qpath: &'v hir::QPath, id: hir::HirId, span: Span) {
|
||||
fn visit_qpath(&mut self, qpath: &'v hir::QPath<'v>, id: hir::HirId, span: Span) {
|
||||
self.record("QPath", Id::None, qpath);
|
||||
hir_visit::walk_qpath(self, qpath, id, span)
|
||||
}
|
||||
|
||||
fn visit_path(&mut self, path: &'v hir::Path, _id: hir::HirId) {
|
||||
fn visit_path(&mut self, path: &'v hir::Path<'v>, _id: hir::HirId) {
|
||||
self.record("Path", Id::None, path);
|
||||
hir_visit::walk_path(self, path)
|
||||
}
|
||||
|
||||
fn visit_path_segment(&mut self, path_span: Span, path_segment: &'v hir::PathSegment) {
|
||||
fn visit_path_segment(&mut self, path_span: Span, path_segment: &'v hir::PathSegment<'v>) {
|
||||
self.record("PathSegment", Id::None, path_segment);
|
||||
hir_visit::walk_path_segment(self, path_span, path_segment)
|
||||
}
|
||||
|
||||
fn visit_assoc_type_binding(&mut self, type_binding: &'v hir::TypeBinding) {
|
||||
fn visit_assoc_type_binding(&mut self, type_binding: &'v hir::TypeBinding<'v>) {
|
||||
self.record("TypeBinding", Id::Node(type_binding.hir_id), type_binding);
|
||||
hir_visit::walk_assoc_type_binding(self, type_binding)
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
||||
fn visit_fn(
|
||||
&mut self,
|
||||
fk: FnKind<'tcx>,
|
||||
fd: &'tcx hir::FnDecl,
|
||||
fd: &'tcx hir::FnDecl<'tcx>,
|
||||
b: hir::BodyId,
|
||||
s: Span,
|
||||
id: HirId,
|
||||
@ -351,7 +351,7 @@ impl IrMaps<'tcx> {
|
||||
fn visit_fn<'tcx>(
|
||||
ir: &mut IrMaps<'tcx>,
|
||||
fk: FnKind<'tcx>,
|
||||
decl: &'tcx hir::FnDecl,
|
||||
decl: &'tcx hir::FnDecl<'tcx>,
|
||||
body_id: hir::BodyId,
|
||||
sp: Span,
|
||||
id: hir::HirId,
|
||||
@ -1285,7 +1285,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
fn access_path(
|
||||
&mut self,
|
||||
hir_id: HirId,
|
||||
path: &hir::Path,
|
||||
path: &hir::Path<'_>,
|
||||
succ: LiveNode,
|
||||
acc: u32,
|
||||
) -> LiveNode {
|
||||
|
@ -378,7 +378,7 @@ impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> {
|
||||
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
||||
NestedVisitorMap::All(&self.tcx.hir())
|
||||
}
|
||||
fn visit_vis(&mut self, vis: &'tcx hir::Visibility) {
|
||||
fn visit_vis(&mut self, vis: &'tcx hir::Visibility<'tcx>) {
|
||||
self.has_pub_restricted = self.has_pub_restricted || vis.node.is_pub_restricted();
|
||||
}
|
||||
}
|
||||
@ -644,7 +644,10 @@ impl EmbargoVisitor<'tcx> {
|
||||
///
|
||||
/// FIXME: This solution won't work with glob imports and doesn't respect
|
||||
/// namespaces. See <https://github.com/rust-lang/rust/pull/57922#discussion_r251234202>.
|
||||
fn update_visibility_of_intermediate_use_statements(&mut self, segments: &[hir::PathSegment]) {
|
||||
fn update_visibility_of_intermediate_use_statements(
|
||||
&mut self,
|
||||
segments: &[hir::PathSegment<'_>],
|
||||
) {
|
||||
if let Some([module, segment]) = segments.rchunks_exact(2).next() {
|
||||
if let Some(item) = module
|
||||
.res
|
||||
@ -1199,7 +1202,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
|
||||
self.in_body = orig_in_body;
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, hir_ty: &'tcx hir::Ty) {
|
||||
fn visit_ty(&mut self, hir_ty: &'tcx hir::Ty<'tcx>) {
|
||||
self.span = hir_ty.span;
|
||||
if self.in_body {
|
||||
// Types in bodies.
|
||||
@ -1218,7 +1221,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
|
||||
intravisit::walk_ty(self, hir_ty);
|
||||
}
|
||||
|
||||
fn visit_trait_ref(&mut self, trait_ref: &'tcx hir::TraitRef) {
|
||||
fn visit_trait_ref(&mut self, trait_ref: &'tcx hir::TraitRef<'tcx>) {
|
||||
self.span = trait_ref.path.span;
|
||||
if !self.in_body {
|
||||
// Avoid calling `hir_trait_to_predicates` in bodies, it will ICE.
|
||||
@ -1282,7 +1285,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
|
||||
// we prohibit access to private statics from other crates, this allows to give
|
||||
// more code internal visibility at link time. (Access to private functions
|
||||
// is already prohibited by type privacy for function types.)
|
||||
fn visit_qpath(&mut self, qpath: &'tcx hir::QPath, id: hir::HirId, span: Span) {
|
||||
fn visit_qpath(&mut self, qpath: &'tcx hir::QPath<'tcx>, id: hir::HirId, span: Span) {
|
||||
let def = match self.tables.qpath_res(qpath, id) {
|
||||
Res::Def(kind, def_id) => Some((kind, def_id)),
|
||||
_ => None,
|
||||
@ -1397,7 +1400,7 @@ struct ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
fn path_is_private_type(&self, path: &hir::Path) -> bool {
|
||||
fn path_is_private_type(&self, path: &hir::Path<'_>) -> bool {
|
||||
let did = match path.res {
|
||||
Res::PrimTy(..) | Res::SelfTy(..) | Res::Err => return false,
|
||||
res => res.def_id(),
|
||||
@ -1423,7 +1426,7 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
self.access_levels.is_public(trait_id)
|
||||
}
|
||||
|
||||
fn check_generic_bound(&mut self, bound: &hir::GenericBound) {
|
||||
fn check_generic_bound(&mut self, bound: &hir::GenericBound<'_>) {
|
||||
if let hir::GenericBound::Trait(ref trait_ref, _) = *bound {
|
||||
if self.path_is_private_type(&trait_ref.trait_ref.path) {
|
||||
self.old_error_set.insert(trait_ref.trait_ref.hir_ref_id);
|
||||
@ -1431,7 +1434,7 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn item_is_public(&self, id: &hir::HirId, vis: &hir::Visibility) -> bool {
|
||||
fn item_is_public(&self, id: &hir::HirId, vis: &hir::Visibility<'_>) -> bool {
|
||||
self.access_levels.is_reachable(*id) || vis.node.is_pub()
|
||||
}
|
||||
}
|
||||
@ -1441,7 +1444,7 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, ty: &hir::Ty) {
|
||||
fn visit_ty(&mut self, ty: &hir::Ty<'_>) {
|
||||
if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = ty.kind {
|
||||
if self.inner.path_is_private_type(path) {
|
||||
self.contains_private = true;
|
||||
@ -1649,13 +1652,13 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
intravisit::walk_item(self, item);
|
||||
}
|
||||
|
||||
fn visit_generics(&mut self, generics: &'tcx hir::Generics) {
|
||||
fn visit_generics(&mut self, generics: &'tcx hir::Generics<'tcx>) {
|
||||
for param in &generics.params {
|
||||
for bound in ¶m.bounds {
|
||||
for bound in param.bounds {
|
||||
self.check_generic_bound(bound);
|
||||
}
|
||||
}
|
||||
for predicate in &generics.where_clause.predicates {
|
||||
for predicate in generics.where_clause.predicates {
|
||||
match predicate {
|
||||
hir::WherePredicate::BoundPredicate(bound_pred) => {
|
||||
for bound in bound_pred.bounds.iter() {
|
||||
@ -1676,7 +1679,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, t: &'tcx hir::Ty) {
|
||||
fn visit_ty(&mut self, t: &'tcx hir::Ty<'tcx>) {
|
||||
if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = t.kind {
|
||||
if self.path_is_private_type(path) {
|
||||
self.old_error_set.insert(t.hir_id);
|
||||
@ -1688,7 +1691,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
v: &'tcx hir::Variant<'tcx>,
|
||||
g: &'tcx hir::Generics,
|
||||
g: &'tcx hir::Generics<'tcx>,
|
||||
item_id: hir::HirId,
|
||||
) {
|
||||
if self.access_levels.is_reachable(v.id) {
|
||||
|
@ -85,7 +85,7 @@ pub trait AstConv<'tcx> {
|
||||
&self,
|
||||
span: Span,
|
||||
item_def_id: DefId,
|
||||
item_segment: &hir::PathSegment,
|
||||
item_segment: &hir::PathSegment<'_>,
|
||||
poly_trait_ref: ty::PolyTraitRef<'tcx>,
|
||||
) -> Ty<'tcx>;
|
||||
|
||||
@ -114,7 +114,7 @@ struct ConvertedBinding<'a, 'tcx> {
|
||||
|
||||
enum ConvertedBindingKind<'a, 'tcx> {
|
||||
Equality(Ty<'tcx>),
|
||||
Constraint(&'a [hir::GenericBound]),
|
||||
Constraint(&'a [hir::GenericBound<'a>]),
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
@ -186,7 +186,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
&self,
|
||||
span: Span,
|
||||
def_id: DefId,
|
||||
item_segment: &hir::PathSegment,
|
||||
item_segment: &hir::PathSegment<'_>,
|
||||
) -> SubstsRef<'tcx> {
|
||||
let (substs, assoc_bindings, _) = self.create_substs_for_ast_path(
|
||||
span,
|
||||
@ -203,7 +203,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
}
|
||||
|
||||
/// Report error if there is an explicit type parameter when using `impl Trait`.
|
||||
fn check_impl_trait(tcx: TyCtxt<'_>, seg: &hir::PathSegment, generics: &ty::Generics) -> bool {
|
||||
fn check_impl_trait(
|
||||
tcx: TyCtxt<'_>,
|
||||
seg: &hir::PathSegment<'_>,
|
||||
generics: &ty::Generics,
|
||||
) -> bool {
|
||||
let explicit = !seg.infer_args;
|
||||
let impl_trait = generics.params.iter().any(|param| match param.kind {
|
||||
ty::GenericParamDefKind::Type {
|
||||
@ -248,14 +252,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
tcx: TyCtxt<'_>,
|
||||
span: Span,
|
||||
def: &ty::Generics,
|
||||
seg: &hir::PathSegment,
|
||||
seg: &hir::PathSegment<'_>,
|
||||
is_method_call: bool,
|
||||
) -> bool {
|
||||
let empty_args = P(hir::GenericArgs {
|
||||
args: HirVec::new(),
|
||||
bindings: HirVec::new(),
|
||||
parenthesized: false,
|
||||
});
|
||||
let empty_args =
|
||||
P(hir::GenericArgs { args: HirVec::new(), bindings: &[], parenthesized: false });
|
||||
let suppress_mismatch = Self::check_impl_trait(tcx, seg, &def);
|
||||
Self::check_generic_arg_count(
|
||||
tcx,
|
||||
@ -275,7 +276,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
tcx: TyCtxt<'_>,
|
||||
span: Span,
|
||||
def: &ty::Generics,
|
||||
args: &hir::GenericArgs,
|
||||
args: &hir::GenericArgs<'_>,
|
||||
position: GenericArgPosition,
|
||||
has_self: bool,
|
||||
infer_args: bool,
|
||||
@ -471,8 +472,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
parent_substs: &[subst::GenericArg<'tcx>],
|
||||
has_self: bool,
|
||||
self_ty: Option<Ty<'tcx>>,
|
||||
args_for_def_id: impl Fn(DefId) -> (Option<&'b GenericArgs>, bool),
|
||||
provided_kind: impl Fn(&GenericParamDef, &GenericArg) -> subst::GenericArg<'tcx>,
|
||||
args_for_def_id: impl Fn(DefId) -> (Option<&'b GenericArgs<'b>>, bool),
|
||||
provided_kind: impl Fn(&GenericParamDef, &GenericArg<'_>) -> subst::GenericArg<'tcx>,
|
||||
mut inferred_kind: impl FnMut(
|
||||
Option<&[subst::GenericArg<'tcx>]>,
|
||||
&GenericParamDef,
|
||||
@ -619,7 +620,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
span: Span,
|
||||
def_id: DefId,
|
||||
parent_substs: &[subst::GenericArg<'tcx>],
|
||||
generic_args: &'a hir::GenericArgs,
|
||||
generic_args: &'a hir::GenericArgs<'_>,
|
||||
infer_args: bool,
|
||||
self_ty: Option<Ty<'tcx>>,
|
||||
) -> (SubstsRef<'tcx>, Vec<ConvertedBinding<'a, 'tcx>>, Option<Vec<Span>>) {
|
||||
@ -794,7 +795,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
span: Span,
|
||||
item_def_id: DefId,
|
||||
item_segment: &hir::PathSegment,
|
||||
item_segment: &hir::PathSegment<'_>,
|
||||
parent_substs: SubstsRef<'tcx>,
|
||||
) -> SubstsRef<'tcx> {
|
||||
if tcx.generics_of(item_def_id).params.is_empty() {
|
||||
@ -895,7 +896,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
/// are disallowed. Otherwise, they are pushed onto the vector given.
|
||||
pub fn instantiate_mono_trait_ref(
|
||||
&self,
|
||||
trait_ref: &hir::TraitRef,
|
||||
trait_ref: &hir::TraitRef<'_>,
|
||||
self_ty: Ty<'tcx>,
|
||||
) -> ty::TraitRef<'tcx> {
|
||||
self.prohibit_generics(trait_ref.path.segments.split_last().unwrap().1);
|
||||
@ -911,7 +912,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
/// The given trait-ref must actually be a trait.
|
||||
pub(super) fn instantiate_poly_trait_ref_inner(
|
||||
&self,
|
||||
trait_ref: &hir::TraitRef,
|
||||
trait_ref: &hir::TraitRef<'_>,
|
||||
span: Span,
|
||||
self_ty: Ty<'tcx>,
|
||||
bounds: &mut Bounds<'tcx>,
|
||||
@ -986,7 +987,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
/// however.
|
||||
pub fn instantiate_poly_trait_ref(
|
||||
&self,
|
||||
poly_trait_ref: &hir::PolyTraitRef,
|
||||
poly_trait_ref: &hir::PolyTraitRef<'_>,
|
||||
self_ty: Ty<'tcx>,
|
||||
bounds: &mut Bounds<'tcx>,
|
||||
) -> Option<Vec<Span>> {
|
||||
@ -1004,7 +1005,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
span: Span,
|
||||
trait_def_id: DefId,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_segment: &hir::PathSegment,
|
||||
trait_segment: &hir::PathSegment<'_>,
|
||||
) -> ty::TraitRef<'tcx> {
|
||||
let (substs, assoc_bindings, _) =
|
||||
self.create_substs_for_ast_trait_ref(span, trait_def_id, self_ty, trait_segment);
|
||||
@ -1018,7 +1019,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
&self,
|
||||
span: Span,
|
||||
trait_def_id: DefId,
|
||||
trait_segment: &'a hir::PathSegment,
|
||||
trait_segment: &'a hir::PathSegment<'a>,
|
||||
) {
|
||||
let trait_def = self.tcx().trait_def(trait_def_id);
|
||||
|
||||
@ -1076,7 +1077,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
span: Span,
|
||||
trait_def_id: DefId,
|
||||
self_ty: Ty<'tcx>,
|
||||
trait_segment: &'a hir::PathSegment,
|
||||
trait_segment: &'a hir::PathSegment<'a>,
|
||||
) -> (SubstsRef<'tcx>, Vec<ConvertedBinding<'a, 'tcx>>, Option<Vec<Span>>) {
|
||||
debug!("create_substs_for_ast_trait_ref(trait_segment={:?})", trait_segment);
|
||||
|
||||
@ -1104,7 +1105,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
}
|
||||
|
||||
// Returns `true` if a bounds list includes `?Sized`.
|
||||
pub fn is_unsized(&self, ast_bounds: &[hir::GenericBound], span: Span) -> bool {
|
||||
pub fn is_unsized(&self, ast_bounds: &[hir::GenericBound<'_>], span: Span) -> bool {
|
||||
let tcx = self.tcx();
|
||||
|
||||
// Try to find an unbound in bounds.
|
||||
@ -1168,7 +1169,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
fn add_bounds(
|
||||
&self,
|
||||
param_ty: Ty<'tcx>,
|
||||
ast_bounds: &[hir::GenericBound],
|
||||
ast_bounds: &[hir::GenericBound<'_>],
|
||||
bounds: &mut Bounds<'tcx>,
|
||||
) {
|
||||
let mut trait_bounds = Vec::new();
|
||||
@ -1212,7 +1213,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
pub fn compute_bounds(
|
||||
&self,
|
||||
param_ty: Ty<'tcx>,
|
||||
ast_bounds: &[hir::GenericBound],
|
||||
ast_bounds: &[hir::GenericBound<'_>],
|
||||
sized_by_default: SizedByDefault,
|
||||
span: Span,
|
||||
) -> Bounds<'tcx> {
|
||||
@ -1388,7 +1389,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn ast_path_to_ty(&self, span: Span, did: DefId, item_segment: &hir::PathSegment) -> Ty<'tcx> {
|
||||
fn ast_path_to_ty(
|
||||
&self,
|
||||
span: Span,
|
||||
did: DefId,
|
||||
item_segment: &hir::PathSegment<'_>,
|
||||
) -> Ty<'tcx> {
|
||||
let substs = self.ast_path_substs_for_ty(span, did, item_segment);
|
||||
self.normalize_ty(span, self.tcx().at(span).type_of(did).subst(self.tcx(), substs))
|
||||
}
|
||||
@ -1396,7 +1402,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
fn conv_object_ty_poly_trait_ref(
|
||||
&self,
|
||||
span: Span,
|
||||
trait_bounds: &[hir::PolyTraitRef],
|
||||
trait_bounds: &[hir::PolyTraitRef<'_>],
|
||||
lifetime: &hir::Lifetime,
|
||||
) -> Ty<'tcx> {
|
||||
let tcx = self.tcx();
|
||||
@ -1617,7 +1623,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
&self,
|
||||
associated_types: FxHashMap<Span, BTreeSet<DefId>>,
|
||||
potential_assoc_types: Vec<Span>,
|
||||
trait_bounds: &[hir::PolyTraitRef],
|
||||
trait_bounds: &[hir::PolyTraitRef<'_>],
|
||||
) {
|
||||
if !associated_types.values().any(|v| v.len() > 0) {
|
||||
return;
|
||||
@ -2046,7 +2052,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
span: Span,
|
||||
qself_ty: Ty<'tcx>,
|
||||
qself_res: Res,
|
||||
assoc_segment: &hir::PathSegment,
|
||||
assoc_segment: &hir::PathSegment<'_>,
|
||||
permit_variants: bool,
|
||||
) -> Result<(Ty<'tcx>, DefKind, DefId), ErrorReported> {
|
||||
let tcx = self.tcx();
|
||||
@ -2204,8 +2210,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
span: Span,
|
||||
opt_self_ty: Option<Ty<'tcx>>,
|
||||
item_def_id: DefId,
|
||||
trait_segment: &hir::PathSegment,
|
||||
item_segment: &hir::PathSegment,
|
||||
trait_segment: &hir::PathSegment<'_>,
|
||||
item_segment: &hir::PathSegment<'_>,
|
||||
) -> Ty<'tcx> {
|
||||
let tcx = self.tcx();
|
||||
|
||||
@ -2265,7 +2271,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
self.normalize_ty(span, tcx.mk_projection(item_def_id, item_substs))
|
||||
}
|
||||
|
||||
pub fn prohibit_generics<'a, T: IntoIterator<Item = &'a hir::PathSegment>>(
|
||||
pub fn prohibit_generics<'a, T: IntoIterator<Item = &'a hir::PathSegment<'a>>>(
|
||||
&self,
|
||||
segments: T,
|
||||
) -> bool {
|
||||
@ -2311,7 +2317,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for binding in &segment.generic_args().bindings {
|
||||
for binding in segment.generic_args().bindings {
|
||||
has_err = true;
|
||||
Self::prohibit_assoc_ty_binding(self.tcx(), binding.span);
|
||||
break;
|
||||
@ -2333,7 +2339,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
// FIXME(eddyb, varkor) handle type paths here too, not just value ones.
|
||||
pub fn def_ids_for_value_path_segments(
|
||||
&self,
|
||||
segments: &[hir::PathSegment],
|
||||
segments: &[hir::PathSegment<'_>],
|
||||
self_ty: Option<Ty<'tcx>>,
|
||||
kind: DefKind,
|
||||
def_id: DefId,
|
||||
@ -2461,7 +2467,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
pub fn res_to_ty(
|
||||
&self,
|
||||
opt_self_ty: Option<Ty<'tcx>>,
|
||||
path: &hir::Path,
|
||||
path: &hir::Path<'_>,
|
||||
permit_variants: bool,
|
||||
) -> Ty<'tcx> {
|
||||
let tcx = self.tcx();
|
||||
@ -2510,7 +2516,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
}
|
||||
Res::Def(DefKind::TyParam, def_id) => {
|
||||
assert_eq!(opt_self_ty, None);
|
||||
self.prohibit_generics(&path.segments);
|
||||
self.prohibit_generics(path.segments);
|
||||
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let item_id = tcx.hir().get_parent_node(hir_id);
|
||||
@ -2522,13 +2528,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
Res::SelfTy(Some(_), None) => {
|
||||
// `Self` in trait or type alias.
|
||||
assert_eq!(opt_self_ty, None);
|
||||
self.prohibit_generics(&path.segments);
|
||||
self.prohibit_generics(path.segments);
|
||||
tcx.types.self_param
|
||||
}
|
||||
Res::SelfTy(_, Some(def_id)) => {
|
||||
// `Self` in impl (we know the concrete type).
|
||||
assert_eq!(opt_self_ty, None);
|
||||
self.prohibit_generics(&path.segments);
|
||||
self.prohibit_generics(path.segments);
|
||||
// Try to evaluate any array length constants.
|
||||
self.normalize_ty(span, tcx.at(span).type_of(def_id))
|
||||
}
|
||||
@ -2545,7 +2551,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
}
|
||||
Res::PrimTy(prim_ty) => {
|
||||
assert_eq!(opt_self_ty, None);
|
||||
self.prohibit_generics(&path.segments);
|
||||
self.prohibit_generics(path.segments);
|
||||
match prim_ty {
|
||||
hir::Bool => tcx.types.bool,
|
||||
hir::Char => tcx.types.char,
|
||||
@ -2565,7 +2571,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
|
||||
/// Parses the programmer's textual representation of a type into our
|
||||
/// internal notion of a type.
|
||||
pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
|
||||
pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty<'_>) -> Ty<'tcx> {
|
||||
debug!("ast_ty_to_ty(id={:?}, ast_ty={:?} ty_ty={:?})", ast_ty.hir_id, ast_ty, ast_ty.kind);
|
||||
|
||||
let tcx = self.tcx();
|
||||
@ -2698,7 +2704,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
tcx.mk_const(const_)
|
||||
}
|
||||
|
||||
pub fn impl_trait_ty_to_ty(&self, def_id: DefId, lifetimes: &[hir::GenericArg]) -> Ty<'tcx> {
|
||||
pub fn impl_trait_ty_to_ty(
|
||||
&self,
|
||||
def_id: DefId,
|
||||
lifetimes: &[hir::GenericArg<'_>],
|
||||
) -> Ty<'tcx> {
|
||||
debug!("impl_trait_ty_to_ty(def_id={:?}, lifetimes={:?})", def_id, lifetimes);
|
||||
let tcx = self.tcx();
|
||||
|
||||
@ -2733,7 +2743,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
ty
|
||||
}
|
||||
|
||||
pub fn ty_of_arg(&self, ty: &hir::Ty, expected_ty: Option<Ty<'tcx>>) -> Ty<'tcx> {
|
||||
pub fn ty_of_arg(&self, ty: &hir::Ty<'_>, expected_ty: Option<Ty<'tcx>>) -> Ty<'tcx> {
|
||||
match ty.kind {
|
||||
hir::TyKind::Infer if expected_ty.is_some() => {
|
||||
self.record_ty(ty.hir_id, expected_ty.unwrap(), ty.span);
|
||||
@ -2747,7 +2757,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
&self,
|
||||
unsafety: hir::Unsafety,
|
||||
abi: abi::Abi,
|
||||
decl: &hir::FnDecl,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
) -> ty::PolyFnSig<'tcx> {
|
||||
debug!("ty_of_fn");
|
||||
|
||||
|
@ -37,7 +37,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
&self,
|
||||
expr: &hir::Expr<'_>,
|
||||
_capture: hir::CaptureBy,
|
||||
decl: &'tcx hir::FnDecl,
|
||||
decl: &'tcx hir::FnDecl<'tcx>,
|
||||
body_id: hir::BodyId,
|
||||
gen: Option<hir::Movability>,
|
||||
expected: Expectation<'tcx>,
|
||||
@ -59,7 +59,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
&self,
|
||||
expr: &hir::Expr<'_>,
|
||||
opt_kind: Option<ty::ClosureKind>,
|
||||
decl: &'tcx hir::FnDecl,
|
||||
decl: &'tcx hir::FnDecl<'tcx>,
|
||||
body: &'tcx hir::Body<'tcx>,
|
||||
gen: Option<hir::Movability>,
|
||||
expected_sig: Option<ExpectedSig<'tcx>>,
|
||||
@ -282,7 +282,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn sig_of_closure(
|
||||
&self,
|
||||
expr_def_id: DefId,
|
||||
decl: &hir::FnDecl,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
body: &hir::Body<'_>,
|
||||
expected_sig: Option<ExpectedSig<'tcx>>,
|
||||
) -> ClosureSignatures<'tcx> {
|
||||
@ -298,7 +298,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn sig_of_closure_no_expectation(
|
||||
&self,
|
||||
expr_def_id: DefId,
|
||||
decl: &hir::FnDecl,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
body: &hir::Body<'_>,
|
||||
) -> ClosureSignatures<'tcx> {
|
||||
debug!("sig_of_closure_no_expectation()");
|
||||
@ -358,7 +358,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn sig_of_closure_with_expectation(
|
||||
&self,
|
||||
expr_def_id: DefId,
|
||||
decl: &hir::FnDecl,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
body: &hir::Body<'_>,
|
||||
expected_sig: ExpectedSig<'tcx>,
|
||||
) -> ClosureSignatures<'tcx> {
|
||||
@ -413,7 +413,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn sig_of_closure_with_mismatched_number_of_arguments(
|
||||
&self,
|
||||
expr_def_id: DefId,
|
||||
decl: &hir::FnDecl,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
body: &hir::Body<'_>,
|
||||
expected_sig: ExpectedSig<'tcx>,
|
||||
) -> ClosureSignatures<'tcx> {
|
||||
@ -446,7 +446,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn check_supplied_sig_against_expectation(
|
||||
&self,
|
||||
expr_def_id: DefId,
|
||||
decl: &hir::FnDecl,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
body: &hir::Body<'_>,
|
||||
expected_sigs: &ClosureSignatures<'tcx>,
|
||||
) -> InferResult<'tcx, ()> {
|
||||
@ -535,7 +535,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn supplied_sig_of_closure(
|
||||
&self,
|
||||
expr_def_id: DefId,
|
||||
decl: &hir::FnDecl,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
body: &hir::Body<'_>,
|
||||
) -> ty::PolyFnSig<'tcx> {
|
||||
let astconv: &dyn AstConv<'_> = self;
|
||||
@ -687,7 +687,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
/// 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`.
|
||||
fn error_sig_of_closure(&self, decl: &hir::FnDecl) -> ty::PolyFnSig<'tcx> {
|
||||
fn error_sig_of_closure(&self, decl: &hir::FnDecl<'_>) -> ty::PolyFnSig<'tcx> {
|
||||
let astconv: &dyn AstConv<'_> = self;
|
||||
|
||||
let supplied_arguments = decl.inputs.iter().map(|a| {
|
||||
|
@ -873,12 +873,12 @@ fn compare_synthetic_generics<'tcx>(
|
||||
let impl_m = tcx.hir().as_local_hir_id(impl_m.def_id)?;
|
||||
let impl_m = tcx.hir().impl_item(hir::ImplItemId { hir_id: impl_m });
|
||||
let input_tys = match impl_m.kind {
|
||||
hir::ImplItemKind::Method(ref sig, _) => &sig.decl.inputs,
|
||||
hir::ImplItemKind::Method(ref sig, _) => sig.decl.inputs,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
struct Visitor(Option<Span>, hir::def_id::DefId);
|
||||
impl<'v> hir::intravisit::Visitor<'v> for Visitor {
|
||||
fn visit_ty(&mut self, ty: &'v hir::Ty) {
|
||||
fn visit_ty(&mut self, ty: &'v hir::Ty<'v>) {
|
||||
hir::intravisit::walk_ty(self, ty);
|
||||
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) =
|
||||
ty.kind
|
||||
|
@ -469,7 +469,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_expr_path(&self, qpath: &hir::QPath, expr: &'tcx hir::Expr<'tcx>) -> Ty<'tcx> {
|
||||
fn check_expr_path(&self, qpath: &hir::QPath<'_>, expr: &'tcx hir::Expr<'tcx>) -> Ty<'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let (res, opt_ty, segs) = self.resolve_ty_and_res_ufcs(qpath, expr.hir_id, expr.span);
|
||||
let ty = match res {
|
||||
@ -853,7 +853,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn check_method_call(
|
||||
&self,
|
||||
expr: &'tcx hir::Expr<'tcx>,
|
||||
segment: &hir::PathSegment,
|
||||
segment: &hir::PathSegment<'_>,
|
||||
span: Span,
|
||||
args: &'tcx [hir::Expr<'tcx>],
|
||||
expected: Expectation<'tcx>,
|
||||
@ -893,7 +893,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
fn report_extended_method_error(
|
||||
&self,
|
||||
segment: &hir::PathSegment,
|
||||
segment: &hir::PathSegment<'_>,
|
||||
span: Span,
|
||||
args: &'tcx [hir::Expr<'tcx>],
|
||||
rcvr_t: Ty<'tcx>,
|
||||
@ -941,7 +941,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn check_expr_cast(
|
||||
&self,
|
||||
e: &'tcx hir::Expr<'tcx>,
|
||||
t: &'tcx hir::Ty,
|
||||
t: &'tcx hir::Ty<'tcx>,
|
||||
expr: &'tcx hir::Expr<'tcx>,
|
||||
) -> Ty<'tcx> {
|
||||
// Find the type of `e`. Supply hints based on the type we are casting to,
|
||||
@ -1087,7 +1087,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
&self,
|
||||
expr: &hir::Expr<'_>,
|
||||
expected: Expectation<'tcx>,
|
||||
qpath: &QPath,
|
||||
qpath: &QPath<'_>,
|
||||
fields: &'tcx [hir::Field<'tcx>],
|
||||
base_expr: &'tcx Option<&'tcx hir::Expr<'tcx>>,
|
||||
) -> Ty<'tcx> {
|
||||
|
@ -43,7 +43,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
call_expr: &'tcx hir::Expr<'tcx>,
|
||||
unadjusted_self_ty: Ty<'tcx>,
|
||||
pick: probe::Pick<'tcx>,
|
||||
segment: &hir::PathSegment,
|
||||
segment: &hir::PathSegment<'_>,
|
||||
) -> ConfirmResult<'tcx> {
|
||||
debug!(
|
||||
"confirm(unadjusted_self_ty={:?}, pick={:?}, generic_args={:?})",
|
||||
@ -69,7 +69,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
||||
&mut self,
|
||||
unadjusted_self_ty: Ty<'tcx>,
|
||||
pick: probe::Pick<'tcx>,
|
||||
segment: &hir::PathSegment,
|
||||
segment: &hir::PathSegment<'_>,
|
||||
) -> ConfirmResult<'tcx> {
|
||||
// Adjust the self expression the user provided and obtain the adjusted type.
|
||||
let self_ty = self.adjust_self_ty(unadjusted_self_ty, &pick);
|
||||
@ -292,7 +292,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
||||
fn instantiate_method_substs(
|
||||
&mut self,
|
||||
pick: &probe::Pick<'tcx>,
|
||||
seg: &hir::PathSegment,
|
||||
seg: &hir::PathSegment<'_>,
|
||||
parent_substs: SubstsRef<'tcx>,
|
||||
) -> SubstsRef<'tcx> {
|
||||
// Determine the values for the generic parameters of the method.
|
||||
|
@ -178,7 +178,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
pub fn lookup_method(
|
||||
&self,
|
||||
self_ty: Ty<'tcx>,
|
||||
segment: &hir::PathSegment,
|
||||
segment: &hir::PathSegment<'_>,
|
||||
span: Span,
|
||||
call_expr: &'tcx hir::Expr<'tcx>,
|
||||
self_expr: &'tcx hir::Expr<'tcx>,
|
||||
|
@ -953,7 +953,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum SelfSource<'a> {
|
||||
QPath(&'a hir::Ty),
|
||||
QPath(&'a hir::Ty<'a>),
|
||||
MethodCall(&'a hir::Expr<'a> /* rcvr */),
|
||||
}
|
||||
|
||||
|
@ -784,7 +784,7 @@ fn adt_destructor(tcx: TyCtxt<'_>, def_id: DefId) -> Option<ty::Destructor> {
|
||||
fn primary_body_of(
|
||||
tcx: TyCtxt<'_>,
|
||||
id: hir::HirId,
|
||||
) -> Option<(hir::BodyId, Option<&hir::Ty>, Option<&hir::FnHeader>, Option<&hir::FnDecl>)> {
|
||||
) -> Option<(hir::BodyId, Option<&hir::Ty<'_>>, Option<&hir::FnHeader>, Option<&hir::FnDecl<'_>>)> {
|
||||
match tcx.hir().get(id) {
|
||||
Node::Item(item) => match item.kind {
|
||||
hir::ItemKind::Const(ref ty, body) | hir::ItemKind::Static(ref ty, _, body) => {
|
||||
@ -1196,7 +1196,7 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
|
||||
fn visit_fn(
|
||||
&mut self,
|
||||
_: intravisit::FnKind<'tcx>,
|
||||
_: &'tcx hir::FnDecl,
|
||||
_: &'tcx hir::FnDecl<'tcx>,
|
||||
_: hir::BodyId,
|
||||
_: Span,
|
||||
_: hir::HirId,
|
||||
@ -1228,7 +1228,7 @@ fn check_fn<'a, 'tcx>(
|
||||
inherited: &'a Inherited<'a, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
fn_sig: ty::FnSig<'tcx>,
|
||||
decl: &'tcx hir::FnDecl,
|
||||
decl: &'tcx hir::FnDecl<'tcx>,
|
||||
fn_id: hir::HirId,
|
||||
body: &'tcx hir::Body<'tcx>,
|
||||
can_be_generator: Option<hir::Movability>,
|
||||
@ -1902,7 +1902,7 @@ fn check_impl_items_against_trait<'tcx>(
|
||||
full_impl_span: Span,
|
||||
impl_id: DefId,
|
||||
impl_trait_ref: ty::TraitRef<'tcx>,
|
||||
impl_item_refs: &[hir::ImplItemRef],
|
||||
impl_item_refs: &[hir::ImplItemRef<'_>],
|
||||
) {
|
||||
let impl_span = tcx.sess.source_map().def_span(full_impl_span);
|
||||
|
||||
@ -2511,7 +2511,7 @@ pub fn check_enum<'tcx>(
|
||||
check_transparent(tcx, sp, def_id);
|
||||
}
|
||||
|
||||
fn report_unexpected_variant_res(tcx: TyCtxt<'_>, res: Res, span: Span, qpath: &QPath) {
|
||||
fn report_unexpected_variant_res(tcx: TyCtxt<'_>, res: Res, span: Span, qpath: &QPath<'_>) {
|
||||
span_err!(
|
||||
tcx.sess,
|
||||
span,
|
||||
@ -2600,7 +2600,7 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
|
||||
&self,
|
||||
span: Span,
|
||||
item_def_id: DefId,
|
||||
item_segment: &hir::PathSegment,
|
||||
item_segment: &hir::PathSegment<'_>,
|
||||
poly_trait_ref: ty::PolyTraitRef<'tcx>,
|
||||
) -> Ty<'tcx> {
|
||||
let (trait_ref, _) = self.replace_bound_vars_with_fresh_vars(
|
||||
@ -3105,13 +3105,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_ty(&self, ast_t: &hir::Ty) -> Ty<'tcx> {
|
||||
pub fn to_ty(&self, ast_t: &hir::Ty<'_>) -> Ty<'tcx> {
|
||||
let t = AstConv::ast_ty_to_ty(self, ast_t);
|
||||
self.register_wf_obligation(t, ast_t.span, traits::MiscObligation);
|
||||
t
|
||||
}
|
||||
|
||||
pub fn to_ty_saving_user_provided_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> {
|
||||
pub fn to_ty_saving_user_provided_ty(&self, ast_ty: &hir::Ty<'_>) -> Ty<'tcx> {
|
||||
let ty = self.to_ty(ast_ty);
|
||||
debug!("to_ty_saving_user_provided_ty: ty={:?}", ty);
|
||||
|
||||
@ -4100,7 +4100,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
pub fn check_struct_path(
|
||||
&self,
|
||||
qpath: &QPath,
|
||||
qpath: &QPath<'_>,
|
||||
hir_id: hir::HirId,
|
||||
) -> Option<(&'tcx ty::VariantDef, Ty<'tcx>)> {
|
||||
let path_span = match *qpath {
|
||||
@ -4159,7 +4159,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// The newly resolved definition is written into `type_dependent_defs`.
|
||||
fn finish_resolving_struct_path(
|
||||
&self,
|
||||
qpath: &QPath,
|
||||
qpath: &QPath<'_>,
|
||||
path_span: Span,
|
||||
hir_id: hir::HirId,
|
||||
) -> (Res, Ty<'tcx>) {
|
||||
@ -4194,10 +4194,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
/// resolution. The newly resolved definition is written into `type_dependent_defs`.
|
||||
pub fn resolve_ty_and_res_ufcs<'b>(
|
||||
&self,
|
||||
qpath: &'b QPath,
|
||||
qpath: &'b QPath<'b>,
|
||||
hir_id: hir::HirId,
|
||||
span: Span,
|
||||
) -> (Res, Option<Ty<'tcx>>, &'b [hir::PathSegment]) {
|
||||
) -> (Res, Option<Ty<'tcx>>, &'b [hir::PathSegment<'b>]) {
|
||||
debug!("resolve_ty_and_res_ufcs: qpath={:?} hir_id={:?} span={:?}", qpath, hir_id, span);
|
||||
let (ty, qself, item_segment) = match *qpath {
|
||||
QPath::Resolved(ref opt_qself, ref path) => {
|
||||
@ -4545,13 +4545,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
/// Given a function block's `HirId`, returns its `FnDecl` if it exists, or `None` otherwise.
|
||||
fn get_parent_fn_decl(&self, blk_id: hir::HirId) -> Option<(&'tcx hir::FnDecl, ast::Ident)> {
|
||||
fn get_parent_fn_decl(
|
||||
&self,
|
||||
blk_id: hir::HirId,
|
||||
) -> Option<(&'tcx hir::FnDecl<'tcx>, ast::Ident)> {
|
||||
let parent = self.tcx.hir().get(self.tcx.hir().get_parent_item(blk_id));
|
||||
self.get_node_fn_decl(parent).map(|(fn_decl, ident, _)| (fn_decl, ident))
|
||||
}
|
||||
|
||||
/// Given a function `Node`, return its `FnDecl` if it exists, or `None` otherwise.
|
||||
fn get_node_fn_decl(&self, node: Node<'tcx>) -> Option<(&'tcx hir::FnDecl, ast::Ident, bool)> {
|
||||
fn get_node_fn_decl(
|
||||
&self,
|
||||
node: Node<'tcx>,
|
||||
) -> Option<(&'tcx hir::FnDecl<'tcx>, ast::Ident, bool)> {
|
||||
match node {
|
||||
Node::Item(&hir::Item { ident, kind: hir::ItemKind::Fn(ref sig, ..), .. }) => {
|
||||
// This is less than ideal, it will not suggest a return type span on any
|
||||
@ -4575,7 +4581,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
/// Given a `HirId`, return the `FnDecl` of the method it is enclosed by and whether a
|
||||
/// suggestion can be made, `None` otherwise.
|
||||
pub fn get_fn_decl(&self, blk_id: hir::HirId) -> Option<(&'tcx hir::FnDecl, bool)> {
|
||||
pub fn get_fn_decl(&self, blk_id: hir::HirId) -> Option<(&'tcx hir::FnDecl<'tcx>, bool)> {
|
||||
// Get enclosing Fn, if it is a function or a trait method, unless there's a `loop` or
|
||||
// `while` before reaching it, as block tail returns are not available in them.
|
||||
self.tcx.hir().get_return_block(blk_id).and_then(|blk_id| {
|
||||
@ -4908,7 +4914,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn suggest_missing_return_type(
|
||||
&self,
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
fn_decl: &hir::FnDecl,
|
||||
fn_decl: &hir::FnDecl<'_>,
|
||||
expected: Ty<'tcx>,
|
||||
found: Ty<'tcx>,
|
||||
can_suggest: bool,
|
||||
@ -5075,7 +5081,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// number of type parameters and type.
|
||||
pub fn instantiate_value_path(
|
||||
&self,
|
||||
segments: &[hir::PathSegment],
|
||||
segments: &[hir::PathSegment<'_>],
|
||||
self_ty: Option<Ty<'tcx>>,
|
||||
res: Res,
|
||||
span: Span,
|
||||
|
@ -554,7 +554,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn check_pat_struct(
|
||||
&self,
|
||||
pat: &'tcx Pat<'tcx>,
|
||||
qpath: &hir::QPath,
|
||||
qpath: &hir::QPath<'_>,
|
||||
fields: &'tcx [hir::FieldPat<'tcx>],
|
||||
etc: bool,
|
||||
expected: Ty<'tcx>,
|
||||
@ -587,8 +587,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn check_pat_path(
|
||||
&self,
|
||||
pat: &Pat<'_>,
|
||||
path_resolution: (Res, Option<Ty<'tcx>>, &'b [hir::PathSegment]),
|
||||
qpath: &hir::QPath,
|
||||
path_resolution: (Res, Option<Ty<'tcx>>, &'b [hir::PathSegment<'b>]),
|
||||
qpath: &hir::QPath<'_>,
|
||||
expected: Ty<'tcx>,
|
||||
) -> Ty<'tcx> {
|
||||
let tcx = self.tcx;
|
||||
@ -622,7 +622,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
fn check_pat_tuple_struct(
|
||||
&self,
|
||||
pat: &Pat<'_>,
|
||||
qpath: &hir::QPath,
|
||||
qpath: &hir::QPath<'_>,
|
||||
subpats: &'tcx [&'tcx Pat<'tcx>],
|
||||
ddpos: Option<usize>,
|
||||
expected: Ty<'tcx>,
|
||||
@ -724,7 +724,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
&self,
|
||||
pat_span: Span,
|
||||
res: Res,
|
||||
qpath: &hir::QPath,
|
||||
qpath: &hir::QPath<'_>,
|
||||
subpats: &'tcx [&'tcx Pat<'tcx>],
|
||||
fields: &'tcx [ty::FieldDef],
|
||||
expected: Ty<'tcx>,
|
||||
|
@ -421,7 +421,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionCtxt<'a, 'tcx> {
|
||||
fn visit_fn(
|
||||
&mut self,
|
||||
fk: intravisit::FnKind<'tcx>,
|
||||
_: &'tcx hir::FnDecl,
|
||||
_: &'tcx hir::FnDecl<'tcx>,
|
||||
body_id: hir::BodyId,
|
||||
span: Span,
|
||||
hir_id: hir::HirId,
|
||||
|
@ -391,8 +391,8 @@ fn check_item_type(tcx: TyCtxt<'_>, item_id: hir::HirId, ty_span: Span, allow_fo
|
||||
fn check_impl<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
item: &'tcx hir::Item<'tcx>,
|
||||
ast_self_ty: &hir::Ty,
|
||||
ast_trait_ref: &Option<hir::TraitRef>,
|
||||
ast_self_ty: &hir::Ty<'_>,
|
||||
ast_trait_ref: &Option<hir::TraitRef<'_>>,
|
||||
) {
|
||||
debug!("check_impl: {:?}", item);
|
||||
|
||||
@ -961,7 +961,7 @@ fn receiver_is_implemented(
|
||||
fn check_variances_for_type_defn<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
item: &hir::Item<'tcx>,
|
||||
hir_generics: &hir::Generics,
|
||||
hir_generics: &hir::Generics<'_>,
|
||||
) {
|
||||
let item_def_id = tcx.hir().local_def_id(item.hir_id);
|
||||
let ty = tcx.type_of(item_def_id);
|
||||
|
@ -310,7 +310,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
|
||||
self.write_ty_to_tables(l.hir_id, var_ty);
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, hir_ty: &'tcx hir::Ty) {
|
||||
fn visit_ty(&mut self, hir_ty: &'tcx hir::Ty<'tcx>) {
|
||||
intravisit::walk_ty(self, hir_ty);
|
||||
let ty = self.fcx.node_ty(hir_ty.hir_id);
|
||||
let ty = self.resolve(&ty, &hir_ty.span);
|
||||
|
@ -20,7 +20,7 @@ impl UnsafetyChecker<'tcx> {
|
||||
fn check_unsafety_coherence(
|
||||
&mut self,
|
||||
item: &'v hir::Item<'v>,
|
||||
impl_generics: Option<&hir::Generics>,
|
||||
impl_generics: Option<&hir::Generics<'_>>,
|
||||
unsafety: hir::Unsafety,
|
||||
polarity: hir::ImplPolarity,
|
||||
) {
|
||||
|
@ -116,7 +116,7 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
|
||||
intravisit::walk_item(self, item);
|
||||
}
|
||||
|
||||
fn visit_generics(&mut self, generics: &'tcx hir::Generics) {
|
||||
fn visit_generics(&mut self, generics: &'tcx hir::Generics<'tcx>) {
|
||||
for param in &generics.params {
|
||||
match param.kind {
|
||||
hir::GenericParamKind::Lifetime { .. } => {}
|
||||
@ -173,7 +173,7 @@ impl ItemCtxt<'tcx> {
|
||||
ItemCtxt { tcx, item_def_id }
|
||||
}
|
||||
|
||||
pub fn to_ty(&self, ast_ty: &'tcx hir::Ty) -> Ty<'tcx> {
|
||||
pub fn to_ty(&self, ast_ty: &'tcx hir::Ty<'tcx>) -> Ty<'tcx> {
|
||||
AstConv::ast_ty_to_ty(self, ast_ty)
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> {
|
||||
&self,
|
||||
span: Span,
|
||||
item_def_id: DefId,
|
||||
item_segment: &hir::PathSegment,
|
||||
item_segment: &hir::PathSegment<'_>,
|
||||
poly_trait_ref: ty::PolyTraitRef<'tcx>,
|
||||
) -> Ty<'tcx> {
|
||||
if let Some(trait_ref) = poly_trait_ref.no_bound_vars() {
|
||||
@ -343,7 +343,7 @@ impl ItemCtxt<'tcx> {
|
||||
/// bounds for a type parameter `X` if `X::Foo` is used.
|
||||
fn type_parameter_bounds_in_generics(
|
||||
&self,
|
||||
ast_generics: &'tcx hir::Generics,
|
||||
ast_generics: &'tcx hir::Generics<'tcx>,
|
||||
param_id: hir::HirId,
|
||||
ty: Ty<'tcx>,
|
||||
only_self_bounds: OnlySelfBounds,
|
||||
@ -386,7 +386,7 @@ impl ItemCtxt<'tcx> {
|
||||
/// parameter with ID `param_id`. We use this so as to avoid running
|
||||
/// `ast_ty_to_ty`, because we want to avoid triggering an all-out
|
||||
/// conversion of the type to avoid inducing unnecessary cycles.
|
||||
fn is_param(tcx: TyCtxt<'_>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool {
|
||||
fn is_param(tcx: TyCtxt<'_>, ast_ty: &hir::Ty<'_>, param_id: hir::HirId) -> bool {
|
||||
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.kind {
|
||||
match path.res {
|
||||
Res::SelfTy(Some(def_id), None) | Res::Def(DefKind::TyParam, def_id) => {
|
||||
@ -803,7 +803,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
||||
NestedVisitorMap::None
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
|
||||
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx>) {
|
||||
if self.has_late_bound_regions.is_some() {
|
||||
return;
|
||||
}
|
||||
@ -819,7 +819,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
||||
|
||||
fn visit_poly_trait_ref(
|
||||
&mut self,
|
||||
tr: &'tcx hir::PolyTraitRef,
|
||||
tr: &'tcx hir::PolyTraitRef<'tcx>,
|
||||
m: hir::TraitBoundModifier,
|
||||
) {
|
||||
if self.has_late_bound_regions.is_some() {
|
||||
@ -852,8 +852,8 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
||||
|
||||
fn has_late_bound_regions<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
generics: &'tcx hir::Generics,
|
||||
decl: &'tcx hir::FnDecl,
|
||||
generics: &'tcx hir::Generics<'tcx>,
|
||||
decl: &'tcx hir::FnDecl<'tcx>,
|
||||
) -> Option<Span> {
|
||||
let mut visitor = LateBoundRegionsDetector {
|
||||
tcx,
|
||||
@ -1699,7 +1699,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_infer_ret_ty(output: &'_ hir::FunctionRetTy) -> Option<&hir::Ty> {
|
||||
pub fn get_infer_ret_ty(output: &'hir hir::FunctionRetTy<'hir>) -> Option<&'hir hir::Ty<'hir>> {
|
||||
if let hir::FunctionRetTy::Return(ref ty) = output {
|
||||
if let hir::TyKind::Infer = ty.kind {
|
||||
return Some(&**ty);
|
||||
@ -1841,8 +1841,8 @@ fn impl_polarity(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ImplPolarity {
|
||||
/// `resolve_lifetime::early_bound_lifetimes`.
|
||||
fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
generics: &'a hir::Generics,
|
||||
) -> impl Iterator<Item = &'a hir::GenericParam> + Captures<'tcx> {
|
||||
generics: &'a hir::Generics<'a>,
|
||||
) -> impl Iterator<Item = &'a hir::GenericParam<'a>> + Captures<'tcx> {
|
||||
generics.params.iter().filter(move |param| match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => !tcx.is_late_bound(param.hir_id),
|
||||
_ => false,
|
||||
@ -1947,7 +1947,7 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
|
||||
|
||||
let icx = ItemCtxt::new(tcx, def_id);
|
||||
|
||||
const NO_GENERICS: &hir::Generics = &hir::Generics::empty();
|
||||
const NO_GENERICS: &hir::Generics<'_> = &hir::Generics::empty();
|
||||
|
||||
let mut predicates = UniquePredicates::new();
|
||||
|
||||
@ -2116,7 +2116,7 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
|
||||
|
||||
// Add in the bounds that appear in the where-clause.
|
||||
let where_clause = &ast_generics.where_clause;
|
||||
for predicate in &where_clause.predicates {
|
||||
for predicate in where_clause.predicates {
|
||||
match predicate {
|
||||
&hir::WherePredicate::BoundPredicate(ref bound_pred) => {
|
||||
let ty = icx.to_ty(&bound_pred.bounded_ty);
|
||||
@ -2323,7 +2323,7 @@ fn associated_item_predicates(
|
||||
fn predicates_from_bound<'tcx>(
|
||||
astconv: &dyn AstConv<'tcx>,
|
||||
param_ty: Ty<'tcx>,
|
||||
bound: &'tcx hir::GenericBound,
|
||||
bound: &'tcx hir::GenericBound<'tcx>,
|
||||
) -> Vec<(ty::Predicate<'tcx>, Span)> {
|
||||
match *bound {
|
||||
hir::GenericBound::Trait(ref tr, hir::TraitBoundModifier::None) => {
|
||||
@ -2343,7 +2343,7 @@ fn predicates_from_bound<'tcx>(
|
||||
fn compute_sig_of_foreign_fn_decl<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: DefId,
|
||||
decl: &'tcx hir::FnDecl,
|
||||
decl: &'tcx hir::FnDecl<'tcx>,
|
||||
abi: abi::Abi,
|
||||
) -> ty::PolyFnSig<'tcx> {
|
||||
let unsafety = if abi == abi::Abi::RustIntrinsic {
|
||||
@ -2359,7 +2359,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
|
||||
&& abi != abi::Abi::PlatformIntrinsic
|
||||
&& !tcx.features().simd_ffi
|
||||
{
|
||||
let check = |ast_ty: &hir::Ty, ty: Ty<'_>| {
|
||||
let check = |ast_ty: &hir::Ty<'_>, ty: Ty<'_>| {
|
||||
if ty.is_simd() {
|
||||
tcx.sess
|
||||
.struct_span_err(
|
||||
|
@ -89,7 +89,7 @@ impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> {
|
||||
fn enforce_impl_params_are_constrained(
|
||||
tcx: TyCtxt<'_>,
|
||||
impl_def_id: DefId,
|
||||
impl_item_refs: &[hir::ImplItemRef],
|
||||
impl_item_refs: &[hir::ImplItemRef<'_>],
|
||||
) {
|
||||
// Every lifetime used in an associated type must be constrained.
|
||||
let impl_self_ty = tcx.type_of(impl_def_id);
|
||||
@ -201,7 +201,7 @@ fn report_unused_parameter(tcx: TyCtxt<'_>, span: Span, kind: &str, name: &str)
|
||||
}
|
||||
|
||||
/// Enforce that we do not have two items in an impl with the same name.
|
||||
fn enforce_impl_items_are_distinct(tcx: TyCtxt<'_>, impl_item_refs: &[hir::ImplItemRef]) {
|
||||
fn enforce_impl_items_are_distinct(tcx: TyCtxt<'_>, impl_item_refs: &[hir::ImplItemRef<'_>]) {
|
||||
let mut seen_type_items = FxHashMap::default();
|
||||
let mut seen_value_items = FxHashMap::default();
|
||||
for impl_item_ref in impl_item_refs {
|
||||
|
@ -119,7 +119,7 @@ pub struct TypeAndSubsts<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl, abi: Abi, span: Span) {
|
||||
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
|
||||
if decl.c_variadic && !(abi == Abi::C || abi == Abi::Cdecl) {
|
||||
let mut err = struct_span_err!(
|
||||
tcx.sess,
|
||||
@ -356,7 +356,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorReported> {
|
||||
|
||||
/// A quasi-deprecated helper used in rustdoc and clippy to get
|
||||
/// the type from a HIR node.
|
||||
pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> {
|
||||
pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'_>) -> Ty<'tcx> {
|
||||
// In case there are any projections, etc., find the "environment"
|
||||
// def-ID that will be used to determine the traits/predicates in
|
||||
// scope. This is derived from the enclosing item-like thing.
|
||||
@ -367,7 +367,10 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> {
|
||||
astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty)
|
||||
}
|
||||
|
||||
pub fn hir_trait_to_predicates<'tcx>(tcx: TyCtxt<'tcx>, hir_trait: &hir::TraitRef) -> Bounds<'tcx> {
|
||||
pub fn hir_trait_to_predicates<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
hir_trait: &hir::TraitRef<'_>,
|
||||
) -> Bounds<'tcx> {
|
||||
// In case there are any projections, etc., find the "environment"
|
||||
// def-ID that will be used to determine the traits/predicates in
|
||||
// scope. This is derived from the enclosing item-like thing.
|
||||
|
@ -306,7 +306,7 @@ impl Clean<Attributes> for [ast::Attribute] {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<GenericBound> for hir::GenericBound {
|
||||
impl Clean<GenericBound> for hir::GenericBound<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> GenericBound {
|
||||
match *self {
|
||||
hir::GenericBound::Outlives(lt) => GenericBound::Outlives(lt.clean(cx)),
|
||||
@ -406,7 +406,7 @@ impl Clean<Lifetime> for hir::Lifetime {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<Lifetime> for hir::GenericParam {
|
||||
impl Clean<Lifetime> for hir::GenericParam<'_> {
|
||||
fn clean(&self, _: &DocContext<'_>) -> Lifetime {
|
||||
match self.kind {
|
||||
hir::GenericParamKind::Lifetime { .. } => {
|
||||
@ -469,7 +469,7 @@ impl Clean<Option<Lifetime>> for ty::RegionKind {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<WherePredicate> for hir::WherePredicate {
|
||||
impl Clean<WherePredicate> for hir::WherePredicate<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> WherePredicate {
|
||||
match *self {
|
||||
hir::WherePredicate::BoundPredicate(ref wbp) => WherePredicate::BoundPredicate {
|
||||
@ -615,7 +615,7 @@ impl Clean<GenericParamDef> for ty::GenericParamDef {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<GenericParamDef> for hir::GenericParam {
|
||||
impl Clean<GenericParamDef> for hir::GenericParam<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> GenericParamDef {
|
||||
let (name, kind) = match self.kind {
|
||||
hir::GenericParamKind::Lifetime { .. } => {
|
||||
@ -657,12 +657,12 @@ impl Clean<GenericParamDef> for hir::GenericParam {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<Generics> for hir::Generics {
|
||||
impl Clean<Generics> for hir::Generics<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Generics {
|
||||
// Synthetic type-parameters are inserted after normal ones.
|
||||
// In order for normal parameters to be able to refer to synthetic ones,
|
||||
// scans them first.
|
||||
fn is_impl_trait(param: &hir::GenericParam) -> bool {
|
||||
fn is_impl_trait(param: &hir::GenericParam<'_>) -> bool {
|
||||
match param.kind {
|
||||
hir::GenericParamKind::Type { synthetic, .. } => {
|
||||
synthetic == Some(hir::SyntheticTyParamKind::ImplTrait)
|
||||
@ -892,7 +892,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
|
||||
}
|
||||
|
||||
impl<'a> Clean<Method>
|
||||
for (&'a hir::FnSig<'a>, &'a hir::Generics, hir::BodyId, Option<hir::Defaultness>)
|
||||
for (&'a hir::FnSig<'a>, &'a hir::Generics<'a>, hir::BodyId, Option<hir::Defaultness>)
|
||||
{
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Method {
|
||||
let (generics, decl) =
|
||||
@ -933,7 +933,7 @@ impl Clean<Item> for doctree::Function<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Clean<Arguments> for (&'a [hir::Ty], &'a [ast::Ident]) {
|
||||
impl<'a> Clean<Arguments> for (&'a [hir::Ty<'a>], &'a [ast::Ident]) {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Arguments {
|
||||
Arguments {
|
||||
values: self
|
||||
@ -953,7 +953,7 @@ impl<'a> Clean<Arguments> for (&'a [hir::Ty], &'a [ast::Ident]) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Clean<Arguments> for (&'a [hir::Ty], hir::BodyId) {
|
||||
impl<'a> Clean<Arguments> for (&'a [hir::Ty<'a>], hir::BodyId) {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Arguments {
|
||||
let body = cx.tcx.hir().body(self.1);
|
||||
|
||||
@ -971,9 +971,9 @@ impl<'a> Clean<Arguments> for (&'a [hir::Ty], hir::BodyId) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, A: Copy> Clean<FnDecl> for (&'a hir::FnDecl, A)
|
||||
impl<'a, A: Copy> Clean<FnDecl> for (&'a hir::FnDecl<'a>, A)
|
||||
where
|
||||
(&'a [hir::Ty], A): Clean<Arguments>,
|
||||
(&'a [hir::Ty<'a>], A): Clean<Arguments>,
|
||||
{
|
||||
fn clean(&self, cx: &DocContext<'_>) -> FnDecl {
|
||||
FnDecl {
|
||||
@ -1013,7 +1013,7 @@ impl<'tcx> Clean<FnDecl> for (DefId, ty::PolyFnSig<'tcx>) {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<FunctionRetTy> for hir::FunctionRetTy {
|
||||
impl Clean<FunctionRetTy> for hir::FunctionRetTy<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> FunctionRetTy {
|
||||
match *self {
|
||||
hir::Return(ref typ) => Return(typ.clean(cx)),
|
||||
@ -1075,13 +1075,13 @@ impl Clean<bool> for hir::IsAuto {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<Type> for hir::TraitRef {
|
||||
impl Clean<Type> for hir::TraitRef<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Type {
|
||||
resolve_type(cx, self.path.clean(cx), self.hir_ref_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<PolyTrait> for hir::PolyTraitRef {
|
||||
impl Clean<PolyTrait> for hir::PolyTraitRef<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> PolyTrait {
|
||||
PolyTrait {
|
||||
trait_: self.trait_ref.clean(cx),
|
||||
@ -1324,7 +1324,7 @@ impl Clean<Item> for ty::AssocItem {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<Type> for hir::Ty {
|
||||
impl Clean<Type> for hir::Ty<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Type {
|
||||
use rustc::hir::*;
|
||||
|
||||
@ -1480,7 +1480,7 @@ impl Clean<Type> for hir::Ty {
|
||||
if let ty::Projection(proj) = ty.kind {
|
||||
res = Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id);
|
||||
}
|
||||
let trait_path = hir::Path { span: self.span, res, segments: vec![].into() };
|
||||
let trait_path = hir::Path { span: self.span, res, segments: &[] };
|
||||
Type::QPath {
|
||||
name: segment.ident.name.clean(cx),
|
||||
self_type: box qself.clean(cx),
|
||||
@ -1760,7 +1760,7 @@ impl Clean<Item> for ty::FieldDef {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<Visibility> for hir::Visibility {
|
||||
impl Clean<Visibility> for hir::Visibility<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Visibility {
|
||||
match self.node {
|
||||
hir::VisibilityKind::Public => Visibility::Public,
|
||||
@ -1937,7 +1937,7 @@ impl Clean<Span> for syntax_pos::Span {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<Path> for hir::Path {
|
||||
impl Clean<Path> for hir::Path<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> Path {
|
||||
Path {
|
||||
global: self.is_global(),
|
||||
@ -1947,7 +1947,7 @@ impl Clean<Path> for hir::Path {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<GenericArgs> for hir::GenericArgs {
|
||||
impl Clean<GenericArgs> for hir::GenericArgs<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> GenericArgs {
|
||||
if self.parenthesized {
|
||||
let output = self.bindings[0].ty().clean(cx);
|
||||
@ -1979,7 +1979,7 @@ impl Clean<GenericArgs> for hir::GenericArgs {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<PathSegment> for hir::PathSegment {
|
||||
impl Clean<PathSegment> for hir::PathSegment<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> PathSegment {
|
||||
PathSegment { name: self.ident.name.clean(cx), args: self.generic_args().clean(cx) }
|
||||
}
|
||||
@ -2038,7 +2038,7 @@ impl Clean<Item> for doctree::OpaqueTy<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<BareFunctionDecl> for hir::BareFnTy {
|
||||
impl Clean<BareFunctionDecl> for hir::BareFnTy<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> BareFunctionDecl {
|
||||
let (generic_params, decl) = enter_impl_trait(cx, || {
|
||||
(self.generic_params.clean(cx), (&*self.decl, &self.param_names[..]).clean(cx))
|
||||
@ -2377,13 +2377,13 @@ impl Clean<Deprecation> for attr::Deprecation {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<TypeBinding> for hir::TypeBinding {
|
||||
impl Clean<TypeBinding> for hir::TypeBinding<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> TypeBinding {
|
||||
TypeBinding { name: self.ident.name.clean(cx), kind: self.kind.clean(cx) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<TypeBindingKind> for hir::TypeBindingKind {
|
||||
impl Clean<TypeBindingKind> for hir::TypeBindingKind<'_> {
|
||||
fn clean(&self, cx: &DocContext<'_>) -> TypeBindingKind {
|
||||
match *self {
|
||||
hir::TypeBindingKind::Equality { ref ty } => {
|
||||
|
@ -28,7 +28,7 @@ pub struct Module<'hir> {
|
||||
pub statics: Vec<Static<'hir>>,
|
||||
pub constants: Vec<Constant<'hir>>,
|
||||
pub traits: Vec<Trait<'hir>>,
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub impls: Vec<Impl<'hir>>,
|
||||
pub foreigns: Vec<ForeignItem<'hir>>,
|
||||
pub macros: Vec<Macro<'hir>>,
|
||||
@ -41,7 +41,7 @@ impl Module<'hir> {
|
||||
pub fn new(
|
||||
name: Option<Name>,
|
||||
attrs: &'hir [ast::Attribute],
|
||||
vis: &'hir hir::Visibility,
|
||||
vis: &'hir hir::Visibility<'hir>,
|
||||
) -> Module<'hir> {
|
||||
Module {
|
||||
name: name,
|
||||
@ -83,31 +83,31 @@ pub enum StructType {
|
||||
}
|
||||
|
||||
pub struct Struct<'hir> {
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub id: hir::HirId,
|
||||
pub struct_type: StructType,
|
||||
pub name: Name,
|
||||
pub generics: &'hir hir::Generics,
|
||||
pub generics: &'hir hir::Generics<'hir>,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub fields: &'hir [hir::StructField<'hir>],
|
||||
pub whence: Span,
|
||||
}
|
||||
|
||||
pub struct Union<'hir> {
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub id: hir::HirId,
|
||||
pub struct_type: StructType,
|
||||
pub name: Name,
|
||||
pub generics: &'hir hir::Generics,
|
||||
pub generics: &'hir hir::Generics<'hir>,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub fields: &'hir [hir::StructField<'hir>],
|
||||
pub whence: Span,
|
||||
}
|
||||
|
||||
pub struct Enum<'hir> {
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub variants: Vec<Variant<'hir>>,
|
||||
pub generics: &'hir hir::Generics,
|
||||
pub generics: &'hir hir::Generics<'hir>,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub id: hir::HirId,
|
||||
pub whence: Span,
|
||||
@ -123,54 +123,54 @@ pub struct Variant<'hir> {
|
||||
}
|
||||
|
||||
pub struct Function<'hir> {
|
||||
pub decl: &'hir hir::FnDecl,
|
||||
pub decl: &'hir hir::FnDecl<'hir>,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub id: hir::HirId,
|
||||
pub name: Name,
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub header: hir::FnHeader,
|
||||
pub whence: Span,
|
||||
pub generics: &'hir hir::Generics,
|
||||
pub generics: &'hir hir::Generics<'hir>,
|
||||
pub body: hir::BodyId,
|
||||
}
|
||||
|
||||
pub struct Typedef<'hir> {
|
||||
pub ty: &'hir hir::Ty,
|
||||
pub gen: &'hir hir::Generics,
|
||||
pub ty: &'hir hir::Ty<'hir>,
|
||||
pub gen: &'hir hir::Generics<'hir>,
|
||||
pub name: Name,
|
||||
pub id: hir::HirId,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub whence: Span,
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
}
|
||||
|
||||
pub struct OpaqueTy<'hir> {
|
||||
pub opaque_ty: &'hir hir::OpaqueTy,
|
||||
pub opaque_ty: &'hir hir::OpaqueTy<'hir>,
|
||||
pub name: Name,
|
||||
pub id: hir::HirId,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub whence: Span,
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Static<'hir> {
|
||||
pub type_: &'hir hir::Ty,
|
||||
pub type_: &'hir hir::Ty<'hir>,
|
||||
pub mutability: hir::Mutability,
|
||||
pub expr: hir::BodyId,
|
||||
pub name: Name,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub id: hir::HirId,
|
||||
pub whence: Span,
|
||||
}
|
||||
|
||||
pub struct Constant<'hir> {
|
||||
pub type_: &'hir hir::Ty,
|
||||
pub type_: &'hir hir::Ty<'hir>,
|
||||
pub expr: hir::BodyId,
|
||||
pub name: Name,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub id: hir::HirId,
|
||||
pub whence: Span,
|
||||
}
|
||||
@ -180,22 +180,22 @@ pub struct Trait<'hir> {
|
||||
pub unsafety: hir::Unsafety,
|
||||
pub name: Name,
|
||||
pub items: Vec<&'hir hir::TraitItem<'hir>>,
|
||||
pub generics: &'hir hir::Generics,
|
||||
pub bounds: &'hir [hir::GenericBound],
|
||||
pub generics: &'hir hir::Generics<'hir>,
|
||||
pub bounds: &'hir [hir::GenericBound<'hir>],
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub id: hir::HirId,
|
||||
pub whence: Span,
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
}
|
||||
|
||||
pub struct TraitAlias<'hir> {
|
||||
pub name: Name,
|
||||
pub generics: &'hir hir::Generics,
|
||||
pub bounds: &'hir [hir::GenericBound],
|
||||
pub generics: &'hir hir::Generics<'hir>,
|
||||
pub bounds: &'hir [hir::GenericBound<'hir>],
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub id: hir::HirId,
|
||||
pub whence: Span,
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -203,18 +203,18 @@ pub struct Impl<'hir> {
|
||||
pub unsafety: hir::Unsafety,
|
||||
pub polarity: hir::ImplPolarity,
|
||||
pub defaultness: hir::Defaultness,
|
||||
pub generics: &'hir hir::Generics,
|
||||
pub trait_: &'hir Option<hir::TraitRef>,
|
||||
pub for_: &'hir hir::Ty,
|
||||
pub generics: &'hir hir::Generics<'hir>,
|
||||
pub trait_: &'hir Option<hir::TraitRef<'hir>>,
|
||||
pub for_: &'hir hir::Ty<'hir>,
|
||||
pub items: Vec<&'hir hir::ImplItem<'hir>>,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub whence: Span,
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub id: hir::HirId,
|
||||
}
|
||||
|
||||
pub struct ForeignItem<'hir> {
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub id: hir::HirId,
|
||||
pub name: Name,
|
||||
pub kind: &'hir hir::ForeignItemKind<'hir>,
|
||||
@ -238,7 +238,7 @@ pub struct ExternCrate<'hir> {
|
||||
pub name: Name,
|
||||
pub cnum: CrateNum,
|
||||
pub path: Option<String>,
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub whence: Span,
|
||||
}
|
||||
@ -246,9 +246,9 @@ pub struct ExternCrate<'hir> {
|
||||
pub struct Import<'hir> {
|
||||
pub name: Name,
|
||||
pub id: hir::HirId,
|
||||
pub vis: &'hir hir::Visibility,
|
||||
pub vis: &'hir hir::Visibility<'hir>,
|
||||
pub attrs: &'hir [ast::Attribute],
|
||||
pub path: &'hir hir::Path,
|
||||
pub path: &'hir hir::Path<'hir>,
|
||||
pub glob: bool,
|
||||
pub whence: Span,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user