/// refers to something from the previous compilation session that
/// has been removed.
#[inline]
- pub fn extract_def_id(&self, tcx: TyCtxt) -> Option<DefId> {
+ pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_, '_>) -> Option<DefId> {
if self.kind.can_reconstruct_query_key() {
let def_path_hash = DefPathHash(self.hash);
tcx.def_path_hash_to_def_id.as_ref()?
}
impl fmt::Debug for DepNode {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.kind)?;
if !self.kind.has_params() && !self.kind.is_anon() {
impl DefId {
#[inline]
- pub fn to_dep_node(self, tcx: TyCtxt, kind: DepKind) -> DepNode {
+ pub fn to_dep_node(self, tcx: TyCtxt<'_, '_, '_>, kind: DepKind) -> DepNode {
DepNode::from_def_path_hash(kind, tcx.def_path_hash(self))
}
}
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefId {
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
tcx.def_path_hash(*self).0
}
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefIndex {
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
tcx.hir.definitions().def_path_hash(*self).0
}
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for CrateNum {
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
let def_id = DefId {
krate: *self,
index: CRATE_DEF_INDEX,
// We actually would not need to specialize the implementation of this
// method but it's faster to combine the hashes than to instantiate a full
// hashing context and stable-hashing state.
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
let (def_id_0, def_id_1) = *self;
let def_path_hash_0 = tcx.def_path_hash(def_id_0);
// We actually would not need to specialize the implementation of this
// method but it's faster to combine the hashes than to instantiate a full
// hashing context and stable-hashing state.
- fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
+ fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
let HirId {
owner,
local_id: ItemLocalId(local_id),
}
impl ::std::fmt::Debug for CrateNum {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
CrateNum::Index(id) => write!(fmt, "crate{}", id.private),
CrateNum::Invalid => write!(fmt, "invalid crate"),
}
impl fmt::Display for CrateNum {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CrateNum::Index(id) => fmt::Display::fmt(&id.private, f),
CrateNum::Invalid => write!(f, "invalid crate"),
pub const CRATE_DEF_INDEX: DefIndex = DefIndex(0);
impl fmt::Debug for DefIndex {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f,
"DefIndex({}:{})",
self.address_space().index(),
}
impl fmt::Debug for DefId {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "DefId({:?}/{}:{}",
self.krate.index(),
self.index.address_space().index(),
}
impl fmt::Debug for LocalDefId {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.to_def_id().fmt(f)
}
}
f: F,
) -> (Vec<hir::GenericParam>, T)
where
- F: FnOnce(&mut LoweringContext) -> (Vec<hir::GenericParam>, T),
+ F: FnOnce(&mut LoweringContext<'_>) -> (Vec<hir::GenericParam>, T),
{
assert!(!self.is_collecting_in_band_lifetimes);
assert!(self.lifetimes_to_define.is_empty());
// for them.
fn with_in_scope_lifetime_defs<T, F>(&mut self, params: &[GenericParam], f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let old_len = self.in_scope_lifetimes.len();
let lt_def_names = params.iter().filter_map(|param| match param.kind {
params: &HirVec<hir::GenericParam>,
f: F
) -> T where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let old_len = self.in_scope_lifetimes.len();
let lt_def_names = params.iter().filter_map(|param| match param.kind {
f: F,
) -> (hir::Generics, T)
where
- F: FnOnce(&mut LoweringContext, &mut Vec<hir::GenericParam>) -> T,
+ F: FnOnce(&mut LoweringContext<'_>, &mut Vec<hir::GenericParam>) -> T,
{
let (in_band_defs, (mut lowered_generics, res)) = self.with_in_scope_lifetime_defs(
&generics.params,
fn with_catch_scope<T, F>(&mut self, catch_id: NodeId, f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let len = self.catch_scopes.len();
self.catch_scopes.push(catch_id);
capture_clause: CaptureBy,
closure_node_id: NodeId,
ret_ty: Option<&Ty>,
- body: impl FnOnce(&mut LoweringContext) -> hir::Expr,
+ body: impl FnOnce(&mut LoweringContext<'_>) -> hir::Expr,
) -> hir::ExprKind {
let prev_is_generator = mem::replace(&mut self.is_generator, true);
let body_expr = body(self);
fn lower_body<F>(&mut self, decl: Option<&FnDecl>, f: F) -> hir::BodyId
where
- F: FnOnce(&mut LoweringContext) -> hir::Expr,
+ F: FnOnce(&mut LoweringContext<'_>) -> hir::Expr,
{
let prev = mem::replace(&mut self.is_generator, false);
let result = f(self);
fn with_loop_scope<T, F>(&mut self, loop_id: NodeId, f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
// We're no longer in the base loop's condition; we're in another loop.
let was_in_loop_condition = self.is_in_loop_condition;
fn with_loop_condition_scope<T, F>(&mut self, f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let was_in_loop_condition = self.is_in_loop_condition;
self.is_in_loop_condition = true;
fn with_new_scopes<T, F>(&mut self, f: F) -> T
where
- F: FnOnce(&mut LoweringContext) -> T,
+ F: FnOnce(&mut LoweringContext<'_>) -> T,
{
let was_in_loop_condition = self.is_in_loop_condition;
self.is_in_loop_condition = false;
}
}
- fn lower_ty_binding(&mut self, b: &TypeBinding, itctx: ImplTraitContext) -> hir::TypeBinding {
+ fn lower_ty_binding(&mut self, b: &TypeBinding,
+ itctx: ImplTraitContext<'_>) -> hir::TypeBinding {
hir::TypeBinding {
id: self.lower_node_id(b.id).node_id,
ident: b.ident,
fn lower_generic_arg(&mut self,
arg: &ast::GenericArg,
- itctx: ImplTraitContext)
+ itctx: ImplTraitContext<'_>)
-> hir::GenericArg {
match arg {
ast::GenericArg::Lifetime(lt) => GenericArg::Lifetime(self.lower_lifetime(<)),
}
}
- fn lower_ty(&mut self, t: &Ty, itctx: ImplTraitContext) -> P<hir::Ty> {
+ fn lower_ty(&mut self, t: &Ty, itctx: ImplTraitContext<'_>) -> P<hir::Ty> {
P(self.lower_ty_direct(t, itctx))
}
- fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext) -> hir::Ty {
+ fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::Ty {
let kind = match t.node {
TyKind::Infer => hir::TyKind::Infer,
TyKind::Err => hir::TyKind::Err,
span: Span,
fn_def_id: Option<DefId>,
exist_ty_node_id: NodeId,
- lower_bounds: impl FnOnce(&mut LoweringContext) -> hir::GenericBounds,
+ lower_bounds: impl FnOnce(&mut LoweringContext<'_>) -> hir::GenericBounds,
) -> hir::TyKind {
// Make sure we know that some funky desugaring has been going on here.
// This is a first: there is code in other places like for loop
qself: &Option<QSelf>,
p: &Path,
param_mode: ParamMode,
- mut itctx: ImplTraitContext,
+ mut itctx: ImplTraitContext<'_>,
) -> hir::QPath {
let qself_position = qself.as_ref().map(|q| q.position);
let qself = qself.as_ref().map(|q| self.lower_ty(&q.ty, itctx.reborrow()));
param_mode: ParamMode,
expected_lifetimes: usize,
parenthesized_generic_args: ParenthesizedGenericArgs,
- itctx: ImplTraitContext,
+ itctx: ImplTraitContext<'_>,
) -> hir::PathSegment {
let (mut generic_args, infer_types) = if let Some(ref generic_args) = segment.args {
let msg = "parenthesized parameters may only be used with a trait";
&mut self,
data: &AngleBracketedArgs,
param_mode: ParamMode,
- mut itctx: ImplTraitContext,
+ mut itctx: ImplTraitContext<'_>,
) -> (hir::GenericArgs, bool) {
let &AngleBracketedArgs { ref args, ref bindings, .. } = data;
let has_types = args.iter().any(|arg| match arg {
self.with_anonymous_lifetime_mode(
AnonymousLifetimeMode::PassThrough,
|this| {
- const DISALLOWED: ImplTraitContext = ImplTraitContext::Disallowed;
+ const DISALLOWED: ImplTraitContext<'_> = ImplTraitContext::Disallowed;
let &ParenthesisedArgs { ref inputs, ref output, span } = data;
let inputs = inputs.iter().map(|ty| this.lower_ty_direct(ty, DISALLOWED)).collect();
let mk_tup = |this: &mut Self, tys, span| {
fn lower_param_bound(
&mut self,
tpb: &GenericBound,
- itctx: ImplTraitContext,
+ itctx: ImplTraitContext<'_>,
) -> hir::GenericBound {
match *tpb {
GenericBound::Trait(ref ty, modifier) => hir::GenericBound::Trait(
&mut self,
params: &[GenericParam],
add_bounds: &NodeMap<Vec<GenericBound>>,
- mut itctx: ImplTraitContext,
+ mut itctx: ImplTraitContext<'_>,
) -> hir::HirVec<hir::GenericParam> {
params.iter().map(|param| {
self.lower_generic_param(param, add_bounds, itctx.reborrow())
fn lower_generic_param(&mut self,
param: &GenericParam,
add_bounds: &NodeMap<Vec<GenericBound>>,
- mut itctx: ImplTraitContext)
+ mut itctx: ImplTraitContext<'_>)
-> hir::GenericParam {
let mut bounds = self.lower_param_bounds(¶m.bounds, itctx.reborrow());
match param.kind {
fn lower_generics(
&mut self,
generics: &Generics,
- itctx: ImplTraitContext)
+ itctx: ImplTraitContext<'_>)
-> hir::Generics
{
// Collect `?Trait` bounds in where clause and move them to parameter definitions.
}
}
- fn lower_trait_ref(&mut self, p: &TraitRef, itctx: ImplTraitContext) -> hir::TraitRef {
+ fn lower_trait_ref(&mut self, p: &TraitRef, itctx: ImplTraitContext<'_>) -> hir::TraitRef {
let path = match self.lower_qpath(p.ref_id, &None, &p.path, ParamMode::Explicit, itctx) {
hir::QPath::Resolved(None, path) => path.and_then(|path| path),
qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath),
fn lower_poly_trait_ref(
&mut self,
p: &PolyTraitRef,
- mut itctx: ImplTraitContext,
+ mut itctx: ImplTraitContext<'_>,
) -> hir::PolyTraitRef {
let bound_generic_params =
self.lower_generic_params(&p.bound_generic_params, &NodeMap(), itctx.reborrow());
}
}
- fn lower_mt(&mut self, mt: &MutTy, itctx: ImplTraitContext) -> hir::MutTy {
+ fn lower_mt(&mut self, mt: &MutTy, itctx: ImplTraitContext<'_>) -> hir::MutTy {
hir::MutTy {
ty: self.lower_ty(&mt.ty, itctx),
mutbl: self.lower_mutability(mt.mutbl),
}
}
- fn lower_param_bounds(&mut self, bounds: &[GenericBound], mut itctx: ImplTraitContext)
+ fn lower_param_bounds(&mut self, bounds: &[GenericBound], mut itctx: ImplTraitContext<'_>)
-> hir::GenericBounds {
bounds.iter().map(|bound| self.lower_param_bound(bound, itctx.reborrow())).collect()
}
impl<'a> FnLikeNode<'a> {
/// Attempts to construct a FnLikeNode from presumed FnLike node input.
- pub fn from_node(node: Node) -> Option<FnLikeNode> {
+ pub fn from_node(node: Node<'_>) -> Option<FnLikeNode<'_>> {
let fn_like = match node {
map::Node::Item(item) => item.is_fn_like(),
map::Node::TraitItem(tm) => tm.is_fn_like(),
}
pub fn span(self) -> Span {
- self.handle(|i: ItemFnParts| i.span,
+ self.handle(|i: ItemFnParts<'_>| i.span,
|_, _, _: &'a ast::MethodSig, _, _, span, _| span,
- |c: ClosureParts| c.span)
+ |c: ClosureParts<'_>| c.span)
}
pub fn id(self) -> NodeId {
- self.handle(|i: ItemFnParts| i.id,
+ self.handle(|i: ItemFnParts<'_>| i.id,
|id, _, _: &'a ast::MethodSig, _, _, _, _| id,
- |c: ClosureParts| c.id)
+ |c: ClosureParts<'_>| c.id)
}
pub fn constness(self) -> ast::Constness {
/// }
/// ```
pub fn get_return_block(&self, id: NodeId) -> Option<NodeId> {
- let match_fn = |node: &Node| {
+ let match_fn = |node: &Node<'_>| {
match *node {
Node::Item(_) |
Node::ForeignItem(_) |
_ => false,
}
};
- let match_non_returning_block = |node: &Node| {
+ let match_non_returning_block = |node: &Node<'_>| {
match *node {
Node::Expr(ref expr) => {
match expr.node {
// If `id` itself is a mod named `m` with parent `p`, then
// returns `Some(id, m, p)`. If `id` has no mod in its parent
// chain, then returns `None`.
- fn find_first_mod_parent<'a>(map: &'a Map, mut id: NodeId) -> Option<(NodeId, Name)> {
+ fn find_first_mod_parent<'a>(map: &'a Map<'_>, mut id: NodeId) -> Option<(NodeId, Name)> {
loop {
if let Node::Item(item) = map.find(id)? {
if item_is_mod(&item) {
/// Identical to the `PpAnn` implementation for `hir::Crate`,
/// except it avoids creating a dependency on the whole crate.
impl<'hir> print::PpAnn for Map<'hir> {
- fn nested(&self, state: &mut print::State, nested: print::Nested) -> io::Result<()> {
+ fn nested(&self, state: &mut print::State<'_>, nested: print::Nested) -> io::Result<()> {
match nested {
Nested::Item(id) => state.print_item(self.expect_item(id.id)),
Nested::TraitItem(id) => state.print_trait_item(self.trait_item(id)),
}
impl<'a> print::State<'a> {
- pub fn print_node(&mut self, node: Node) -> io::Result<()> {
+ pub fn print_node(&mut self, node: Node<'_>) -> io::Result<()> {
match node {
Node::Item(a) => self.print_item(&a),
Node::ForeignItem(a) => self.print_foreign_item(&a),
}
}
-fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
+fn node_id_to_string(map: &Map<'_>, id: NodeId, include_id: bool) -> String {
let id_str = format!(" (id={})", id);
let id_str = if include_id { &id_str[..] } else { "" };
}
}
-pub fn describe_def(tcx: TyCtxt, def_id: DefId) -> Option<Def> {
+pub fn describe_def(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option<Def> {
if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
tcx.hir.describe_def(node_id)
} else {
}
impl fmt::Debug for Label {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "label({:?})", self.ident)
}
}
}
impl fmt::Display for Lifetime {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.name.ident().fmt(f)
}
}
impl fmt::Debug for Lifetime {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f,
"lifetime({}: {})",
self.id,
}
impl fmt::Debug for Path {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "path({})", print::to_string(print::NO_ANN, |s| s.print_path(self, false)))
}
}
impl fmt::Display for Path {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", print::to_string(print::NO_ANN, |s| s.print_path(self, false)))
}
}
}
impl fmt::Debug for Pat {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "pat({}: {})", self.id,
print::to_string(print::NO_ANN, |s| s.print_pat(self)))
}
pub type Stmt = Spanned<StmtKind>;
impl fmt::Debug for StmtKind {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Sadness.
let spanned = source_map::dummy_spanned(self.clone());
write!(f,
}
impl fmt::Debug for Expr {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "expr({}: {})", self.id,
print::to_string(print::NO_ANN, |s| s.print_expr(self)))
}
}
impl fmt::Display for LoopIdError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(match *self {
LoopIdError::OutsideLoopScope => "not inside loop scope",
LoopIdError::UnlabeledCfInWhileCondition =>
}
impl fmt::Debug for Ty {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "type({})",
print::to_string(print::NO_ANN, |s| s.print_type(self)))
}
}
impl fmt::Display for Unsafety {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(match *self {
Unsafety::Normal => "normal",
Unsafety::Unsafe => "unsafe",
}
impl fmt::Debug for ImplPolarity {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
ImplPolarity::Positive => "positive".fmt(f),
ImplPolarity::Negative => "negative".fmt(f),
// imported.
pub type GlobMap = NodeMap<FxHashSet<Name>>;
-pub fn provide(providers: &mut Providers) {
+
+pub fn provide(providers: &mut Providers<'_>) {
providers.describe_def = map::describe_def;
}
}
pub trait PpAnn {
- fn nested(&self, _state: &mut State, _nested: Nested) -> io::Result<()> {
+ fn nested(&self, _state: &mut State<'_>, _nested: Nested) -> io::Result<()> {
Ok(())
}
- fn pre(&self, _state: &mut State, _node: AnnNode) -> io::Result<()> {
+ fn pre(&self, _state: &mut State<'_>, _node: AnnNode<'_>) -> io::Result<()> {
Ok(())
}
- fn post(&self, _state: &mut State, _node: AnnNode) -> io::Result<()> {
+ fn post(&self, _state: &mut State<'_>, _node: AnnNode<'_>) -> io::Result<()> {
Ok(())
}
fn try_fetch_item(&self, _: ast::NodeId) -> Option<&hir::Item> {
fn try_fetch_item(&self, item: ast::NodeId) -> Option<&hir::Item> {
Some(self.item(item))
}
- fn nested(&self, state: &mut State, nested: Nested) -> io::Result<()> {
+ fn nested(&self, state: &mut State<'_>, nested: Nested) -> io::Result<()> {
match nested {
Nested::Item(id) => state.print_item(self.item(id.id)),
Nested::TraitItem(id) => state.print_trait_item(self.trait_item(id)),
}
pub fn to_string<F>(ann: &dyn PpAnn, f: F) -> String
- where F: FnOnce(&mut State) -> io::Result<()>
+ where F: FnOnce(&mut State<'_>) -> io::Result<()>
{
let mut wr = Vec::new();
{
mut op: F,
mut get_span: G)
-> io::Result<()>
- where F: FnMut(&mut State, &T) -> io::Result<()>,
+ where F: FnMut(&mut State<'_>, &T) -> io::Result<()>,
G: FnMut(&T) -> syntax_pos::Span
{
self.rbox(0, b)?;
pub fn note_and_explain_region(
self,
region_scope_tree: ®ion::ScopeTree,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
prefix: &str,
region: ty::Region<'tcx>,
suffix: &str,
pub fn note_and_explain_free_region(
self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
prefix: &str,
region: ty::Region<'tcx>,
suffix: &str,
}
fn emit_msg_span(
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
prefix: &str,
description: String,
span: Option<Span>,
/// Adds a note if the types come from similarly named crates
fn check_and_note_conflicting_crates(
&self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
terr: &TypeError<'tcx>,
sp: Span,
) {
- let report_path_match = |err: &mut DiagnosticBuilder, did1: DefId, did2: DefId| {
+ let report_path_match = |err: &mut DiagnosticBuilder<'_>, did1: DefId, did2: DefId| {
// Only external crates, if either is from a local
// module we could have false positives
if !(did1.is_local() || did2.is_local()) && did1.krate != did2.krate {
values.1.push_normal("<");
}
- fn lifetime_display(lifetime: Region) -> String {
+ fn lifetime_display(lifetime: Region<'_>) -> String {
let s = lifetime.to_string();
if s.is_empty() {
"'_".to_string()
&self,
anon_region: Region<'tcx>,
replace_region: Region<'tcx>,
- ) -> Option<AnonymousArgInfo> {
+ ) -> Option<AnonymousArgInfo<'_>> {
let (id, bound_region) = match *anon_region {
ty::ReFree(ref free_region) => (free_region.scope, free_region.bound_region),
ty::ReEarlyBound(ref ebr) => (
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
pub(super) fn note_region_origin(&self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
origin: &SubregionOrigin<'tcx>) {
match *origin {
infer::Subtype(ref trace) => {
.collect()
}
-fn is_var_in_set(new_vars: &[ty::RegionVid], r: ty::Region) -> bool {
+fn is_var_in_set(new_vars: &[ty::RegionVid], r: ty::Region<'_>) -> bool {
match *r {
ty::ReVar(ref v) => new_vars.iter().any(|x| x == v),
_ => false
impl<'a, 'gcx, 'tcx> dot::Labeller<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
type Node = Node;
type Edge = Edge<'tcx>;
- fn graph_id(&self) -> dot::Id {
+ fn graph_id(&self) -> dot::Id<'_> {
dot::Id::new(&*self.graph_name).unwrap()
}
- fn node_id(&self, n: &Node) -> dot::Id {
+ fn node_id(&self, n: &Node) -> dot::Id<'_> {
let node_id = match self.node_ids.get(n) {
Some(node_id) => node_id,
None => bug!("no node_id found for node: {:?}", n),
}
}
}
- fn node_label(&self, n: &Node) -> dot::LabelText {
+ fn node_label(&self, n: &Node) -> dot::LabelText<'_> {
match *n {
Node::RegionVid(n_vid) => dot::LabelText::label(format!("{:?}", n_vid)),
Node::Region(n_rgn) => dot::LabelText::label(format!("{:?}", n_rgn)),
}
}
- fn edge_label(&self, e: &Edge) -> dot::LabelText {
+ fn edge_label(&self, e: &Edge<'_>) -> dot::LabelText<'_> {
match *e {
Edge::Constraint(ref c) =>
dot::LabelText::label(format!("{:?}", self.map.get(c).unwrap())),
}
}
-fn constraint_to_nodes(c: &Constraint) -> (Node, Node) {
+fn constraint_to_nodes(c: &Constraint<'_>) -> (Node, Node) {
match *c {
Constraint::VarSubVar(rv_1, rv_2) =>
(Node::RegionVid(rv_1), Node::RegionVid(rv_2)),
}
}
-fn edge_to_nodes(e: &Edge) -> (Node, Node) {
+fn edge_to_nodes(e: &Edge<'_>) -> (Node, Node) {
match *e {
Edge::Constraint(ref c) => constraint_to_nodes(c),
Edge::EnclScope(sub, sup) => {
impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
type Node = Node;
type Edge = Edge<'tcx>;
- fn nodes(&self) -> dot::Nodes<Node> {
+ fn nodes(&self) -> dot::Nodes<'_, Node> {
let mut set = FxHashSet();
for node in self.node_ids.keys() {
set.insert(*node);
debug!("constraint graph has {} nodes", set.len());
set.into_iter().collect()
}
- fn edges(&self) -> dot::Edges<Edge<'tcx>> {
+ fn edges(&self) -> dot::Edges<'_, Edge<'tcx>> {
debug!("constraint graph has {} edges", self.map.len());
let mut v: Vec<_> = self.map.keys().map(|e| Edge::Constraint(*e)).collect();
self.region_rels.region_scope_tree.each_encl_scope(|sub, sup| {
}
}
- fn expand_givens(&mut self, graph: &RegionGraph) {
+ fn expand_givens(&mut self, graph: &RegionGraph<'_>) {
// Givens are a kind of horrible hack to account for
// constraints like 'c <= '0 that are known to hold due to
// closure signatures (see the comment above on the `givens`
// We place free regions first because we are special casing
// SubSupConflict(ReFree, ReFree) when reporting error, and so
// the user will more likely get a specific suggestion.
- fn region_order_key(x: &RegionAndOrigin) -> u8 {
+ fn region_order_key(x: &RegionAndOrigin<'_>) -> u8 {
match *x.region {
ReEarlyBound(_) => 0,
ReFree(_) => 1,
}
impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "RegionAndOrigin({:?},{:?})", self.region, self.origin)
}
}
}
impl fmt::Display for FixupError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use self::FixupError::*;
match *self {
t.fold_with(&mut self.freshener())
}
- pub fn type_var_diverges(&'a self, ty: Ty) -> bool {
+ pub fn type_var_diverges(&'a self, ty: Ty<'_>) -> bool {
match ty.sty {
ty::Infer(ty::TyVar(vid)) => self.type_variables.borrow().var_diverges(vid),
_ => false,
freshen::TypeFreshener::new(self)
}
- pub fn type_is_unconstrained_numeric(&'a self, ty: Ty) -> UnconstrainedNumeric {
+ pub fn type_is_unconstrained_numeric(&'a self, ty: Ty<'_>) -> UnconstrainedNumeric {
use ty::error::UnconstrainedNumeric::Neither;
use ty::error::UnconstrainedNumeric::{UnconstrainedFloat, UnconstrainedInt};
match ty.sty {
}
impl<'tcx> fmt::Debug for TypeTrace<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "TypeTrace({:?})", self.cause)
}
}
}
impl<'tcx> fmt::Debug for RegionObligation<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"RegionObligation(sub_region={:?}, sup_type={:?})",
/// We will return true if the reference is within the same module as the existential type
/// So true for f1, false for f2.
pub fn may_define_existential_type(
- tcx: TyCtxt,
+ tcx: TyCtxt<'_, '_, '_>,
def_id: DefId,
opaque_node_id: ast::NodeId,
) -> bool {
}
}
-fn is_free(r: Region) -> bool {
+fn is_free(r: Region<'_>) -> bool {
match *r {
ty::ReEarlyBound(_) | ty::ReFree(_) => true,
_ => false
}
}
-fn is_free_or_static(r: Region) -> bool {
+fn is_free_or_static(r: Region<'_>) -> bool {
match *r {
ty::ReStatic => true,
_ => is_free(r),
}
impl fmt::Debug for RegionSnapshot {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "RegionSnapshot(length={})", self.length)
}
}
impl<'tcx> fmt::Debug for GenericKind<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
GenericKind::Param(ref p) => write!(f, "{:?}", p),
GenericKind::Projection(ref p) => write!(f, "{:?}", p),
}
impl<'tcx> fmt::Display for GenericKind<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
GenericKind::Param(ref p) => write!(f, "{}", p),
GenericKind::Projection(ref p) => write!(f, "{}", p),
#![recursion_limit="512"]
+#![warn(elided_lifetimes_in_paths)]
+
extern crate arena;
#[macro_use] extern crate bitflags;
extern crate core;
}
impl BuiltinLintDiagnostics {
- pub fn run(self, sess: &Session, db: &mut DiagnosticBuilder) {
+ pub fn run(self, sess: &Session, db: &mut DiagnosticBuilder<'_>) {
match self {
BuiltinLintDiagnostics::Normal => (),
BuiltinLintDiagnostics::BareTraitObject(span, is_global) => {
&self,
lint_name: &str,
tool_name: Option<LocalInternedString>,
- ) -> CheckLintNameResult {
+ ) -> CheckLintNameResult<'_> {
let complete_name = if let Some(tool_name) = tool_name {
format!("{}::{}", tool_name, lint_name)
} else {
&self,
lint_name: &str,
tool_name: &str,
- ) -> CheckLintNameResult {
+ ) -> CheckLintNameResult<'_> {
let complete_name = format!("{}::{}", tool_name, lint_name);
match self.by_name.get(&complete_name) {
None => match self.lint_groups.get(&*complete_name) {
lint: &'static Lint,
span: Option<S>,
msg: &str)
- -> DiagnosticBuilder;
+ -> DiagnosticBuilder<'_>;
/// Emit a lint at the appropriate level, for a particular span.
fn span_lint<S: Into<MultiSpan>>(&self, lint: &'static Lint, span: S, msg: &str) {
lint: &'static Lint,
span: S,
msg: &str)
- -> DiagnosticBuilder {
+ -> DiagnosticBuilder<'_> {
self.lookup(lint, Some(span), msg)
}
lint: &'static Lint,
span: Option<S>,
msg: &str)
- -> DiagnosticBuilder {
+ -> DiagnosticBuilder<'_> {
let id = self.last_ast_node_with_lint_attrs;
match span {
Some(s) => self.tcx.struct_span_lint_node(lint, id, s, msg),
lint: &'static Lint,
span: Option<S>,
msg: &str)
- -> DiagnosticBuilder {
+ -> DiagnosticBuilder<'_> {
self.builder.struct_lint(lint, span.map(|s| s.into()), msg)
}
return me
}
- pub fn builder(sess: &Session) -> LintLevelsBuilder {
+ pub fn builder(sess: &Session) -> LintLevelsBuilder<'_> {
LintLevelsBuilder::new(sess, LintLevelSets::new(sess))
}
}
pub trait EarlyLintPass: LintPass {
- fn check_ident(&mut self, _: &EarlyContext, _: ast::Ident) { }
- fn check_crate(&mut self, _: &EarlyContext, _: &ast::Crate) { }
- fn check_crate_post(&mut self, _: &EarlyContext, _: &ast::Crate) { }
- fn check_mod(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
- fn check_mod_post(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
- fn check_foreign_item(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
- fn check_foreign_item_post(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
- fn check_item(&mut self, _: &EarlyContext, _: &ast::Item) { }
- fn check_item_post(&mut self, _: &EarlyContext, _: &ast::Item) { }
- fn check_local(&mut self, _: &EarlyContext, _: &ast::Local) { }
- fn check_block(&mut self, _: &EarlyContext, _: &ast::Block) { }
- fn check_block_post(&mut self, _: &EarlyContext, _: &ast::Block) { }
- fn check_stmt(&mut self, _: &EarlyContext, _: &ast::Stmt) { }
- fn check_arm(&mut self, _: &EarlyContext, _: &ast::Arm) { }
- fn check_pat(&mut self, _: &EarlyContext, _: &ast::Pat) { }
- fn check_expr(&mut self, _: &EarlyContext, _: &ast::Expr) { }
- fn check_expr_post(&mut self, _: &EarlyContext, _: &ast::Expr) { }
- fn check_ty(&mut self, _: &EarlyContext, _: &ast::Ty) { }
- fn check_generic_param(&mut self, _: &EarlyContext, _: &ast::GenericParam) { }
- fn check_generics(&mut self, _: &EarlyContext, _: &ast::Generics) { }
- fn check_where_predicate(&mut self, _: &EarlyContext, _: &ast::WherePredicate) { }
- fn check_poly_trait_ref(&mut self, _: &EarlyContext, _: &ast::PolyTraitRef,
+ fn check_ident(&mut self, _: &EarlyContext<'_>, _: ast::Ident) { }
+ fn check_crate(&mut self, _: &EarlyContext<'_>, _: &ast::Crate) { }
+ fn check_crate_post(&mut self, _: &EarlyContext<'_>, _: &ast::Crate) { }
+ fn check_mod(&mut self, _: &EarlyContext<'_>, _: &ast::Mod, _: Span, _: ast::NodeId) { }
+ fn check_mod_post(&mut self, _: &EarlyContext<'_>, _: &ast::Mod, _: Span, _: ast::NodeId) { }
+ fn check_foreign_item(&mut self, _: &EarlyContext<'_>, _: &ast::ForeignItem) { }
+ fn check_foreign_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::ForeignItem) { }
+ fn check_item(&mut self, _: &EarlyContext<'_>, _: &ast::Item) { }
+ fn check_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::Item) { }
+ fn check_local(&mut self, _: &EarlyContext<'_>, _: &ast::Local) { }
+ fn check_block(&mut self, _: &EarlyContext<'_>, _: &ast::Block) { }
+ fn check_block_post(&mut self, _: &EarlyContext<'_>, _: &ast::Block) { }
+ fn check_stmt(&mut self, _: &EarlyContext<'_>, _: &ast::Stmt) { }
+ fn check_arm(&mut self, _: &EarlyContext<'_>, _: &ast::Arm) { }
+ fn check_pat(&mut self, _: &EarlyContext<'_>, _: &ast::Pat) { }
+ fn check_expr(&mut self, _: &EarlyContext<'_>, _: &ast::Expr) { }
+ fn check_expr_post(&mut self, _: &EarlyContext<'_>, _: &ast::Expr) { }
+ fn check_ty(&mut self, _: &EarlyContext<'_>, _: &ast::Ty) { }
+ fn check_generic_param(&mut self, _: &EarlyContext<'_>, _: &ast::GenericParam) { }
+ fn check_generics(&mut self, _: &EarlyContext<'_>, _: &ast::Generics) { }
+ fn check_where_predicate(&mut self, _: &EarlyContext<'_>, _: &ast::WherePredicate) { }
+ fn check_poly_trait_ref(&mut self, _: &EarlyContext<'_>, _: &ast::PolyTraitRef,
_: &ast::TraitBoundModifier) { }
- fn check_fn(&mut self, _: &EarlyContext,
- _: ast_visit::FnKind, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
- fn check_fn_post(&mut self, _: &EarlyContext,
- _: ast_visit::FnKind, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
- fn check_trait_item(&mut self, _: &EarlyContext, _: &ast::TraitItem) { }
- fn check_trait_item_post(&mut self, _: &EarlyContext, _: &ast::TraitItem) { }
- fn check_impl_item(&mut self, _: &EarlyContext, _: &ast::ImplItem) { }
- fn check_impl_item_post(&mut self, _: &EarlyContext, _: &ast::ImplItem) { }
- fn check_struct_def(&mut self, _: &EarlyContext,
+ fn check_fn(&mut self, _: &EarlyContext<'_>,
+ _: ast_visit::FnKind<'_>, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
+ fn check_fn_post(&mut self, _: &EarlyContext<'_>,
+ _: ast_visit::FnKind<'_>, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
+ fn check_trait_item(&mut self, _: &EarlyContext<'_>, _: &ast::TraitItem) { }
+ fn check_trait_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::TraitItem) { }
+ fn check_impl_item(&mut self, _: &EarlyContext<'_>, _: &ast::ImplItem) { }
+ fn check_impl_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::ImplItem) { }
+ fn check_struct_def(&mut self, _: &EarlyContext<'_>,
_: &ast::VariantData, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { }
- fn check_struct_def_post(&mut self, _: &EarlyContext,
+ fn check_struct_def_post(&mut self, _: &EarlyContext<'_>,
_: &ast::VariantData, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { }
- fn check_struct_field(&mut self, _: &EarlyContext, _: &ast::StructField) { }
- fn check_variant(&mut self, _: &EarlyContext, _: &ast::Variant, _: &ast::Generics) { }
- fn check_variant_post(&mut self, _: &EarlyContext, _: &ast::Variant, _: &ast::Generics) { }
- fn check_lifetime(&mut self, _: &EarlyContext, _: &ast::Lifetime) { }
- fn check_path(&mut self, _: &EarlyContext, _: &ast::Path, _: ast::NodeId) { }
- fn check_attribute(&mut self, _: &EarlyContext, _: &ast::Attribute) { }
- fn check_mac_def(&mut self, _: &EarlyContext, _: &ast::MacroDef, _id: ast::NodeId) { }
- fn check_mac(&mut self, _: &EarlyContext, _: &ast::Mac) { }
+ fn check_struct_field(&mut self, _: &EarlyContext<'_>, _: &ast::StructField) { }
+ fn check_variant(&mut self, _: &EarlyContext<'_>, _: &ast::Variant, _: &ast::Generics) { }
+ fn check_variant_post(&mut self, _: &EarlyContext<'_>, _: &ast::Variant, _: &ast::Generics) { }
+ fn check_lifetime(&mut self, _: &EarlyContext<'_>, _: &ast::Lifetime) { }
+ fn check_path(&mut self, _: &EarlyContext<'_>, _: &ast::Path, _: ast::NodeId) { }
+ fn check_attribute(&mut self, _: &EarlyContext<'_>, _: &ast::Attribute) { }
+ fn check_mac_def(&mut self, _: &EarlyContext<'_>, _: &ast::MacroDef, _id: ast::NodeId) { }
+ fn check_mac(&mut self, _: &EarlyContext<'_>, _: &ast::Mac) { }
/// Called when entering a syntax node that can have lint attributes such
/// as `#[allow(...)]`. Called with *all* the attributes of that node.
- fn enter_lint_attrs(&mut self, _: &EarlyContext, _: &[ast::Attribute]) { }
+ fn enter_lint_attrs(&mut self, _: &EarlyContext<'_>, _: &[ast::Attribute]) { }
/// Counterpart to `enter_lint_attrs`.
- fn exit_lint_attrs(&mut self, _: &EarlyContext, _: &[ast::Attribute]) { }
+ fn exit_lint_attrs(&mut self, _: &EarlyContext<'_>, _: &[ast::Attribute]) { }
}
/// A lint pass boxed up as a trait object.
}
}
-pub fn provide(providers: &mut Providers) {
+pub fn provide(providers: &mut Providers<'_>) {
providers.lint_levels = lint_levels;
}
// In order to get this left-to-right dependency ordering, we perform a
// topological sort of all crates putting the leaves at the right-most
// positions.
-pub fn used_crates(tcx: TyCtxt, prefer: LinkagePreference)
+pub fn used_crates(tcx: TyCtxt<'_, '_, '_>, prefer: LinkagePreference)
-> Vec<(CrateNum, LibSource)>
{
let mut libs = tcx.crates()
}
}
-fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt,
+fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
id: ast::NodeId,
attrs: &[ast::Attribute]) -> bool {
if attr::contains_name(attrs, "lang") {
return ret;
}
-fn add_library(tcx: TyCtxt,
+fn add_library(tcx: TyCtxt<'_, '_, '_>,
cnum: CrateNum,
link: LinkagePreference,
m: &mut FxHashMap<CrateNum, LinkagePreference>) {
}
pub fn find_entry_point(session: &Session,
- hir_map: &hir_map::Map,
+ hir_map: &hir_map::Map<'_>,
crate_name: &str) {
let any_exe = session.crate_types.borrow().iter().any(|ty| {
*ty == config::CrateType::Executable
}
-fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
+fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
match entry_point_type(item, at_root) {
EntryPointType::MainNamed => {
if ctxt.main_fn.is_none() {
}
}
-fn configure_main(this: &mut EntryContext, crate_name: &str) {
+fn configure_main(this: &mut EntryContext<'_, '_>, crate_name: &str) {
if let Some((node_id, span)) = this.start_fn {
this.session.entry_fn.set(Some((node_id, span, EntryFnType::Start)));
} else if let Some((node_id, span)) = this.attr_main_fn {
}
}
-pub fn metadata_symbol_name(tcx: ty::TyCtxt) -> String {
+pub fn metadata_symbol_name(tcx: ty::TyCtxt<'_, '_, '_>) -> String {
format!("rust_metadata_{}_{}",
tcx.original_crate_name(LOCAL_CRATE),
tcx.crate_disambiguator(LOCAL_CRATE).to_fingerprint().to_hex())
}
impl OverloadedCallType {
- fn from_trait_id(tcx: TyCtxt, trait_id: DefId) -> OverloadedCallType {
+ fn from_trait_id(tcx: TyCtxt<'_, '_, '_>, trait_id: DefId) -> OverloadedCallType {
for &(maybe_function_trait, overloaded_call_type) in &[
(tcx.lang_items().fn_once_trait(), FnOnceOverloadedCall),
(tcx.lang_items().fn_mut_trait(), FnMutOverloadedCall),
bug!("overloaded call didn't map to known function trait")
}
- fn from_method_id(tcx: TyCtxt, method_id: DefId) -> OverloadedCallType {
+ fn from_method_id(tcx: TyCtxt<'_, '_, '_>, method_id: DefId) -> OverloadedCallType {
let method = tcx.associated_item(method_id);
OverloadedCallType::from_trait_id(tcx, method.container.id())
}
ExitNode
}
-fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt) -> String {
+fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_, '_>) -> String {
let cm = tcx.sess.source_map();
match lnk {
FreeVarNode(s) => {
}
impl fmt::Debug for LiveNode {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ln({})", self.get())
}
}
impl fmt::Debug for Variable {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "v({})", self.get())
}
}
}
}
- debug!("creating fn_maps: {:?}", &fn_maps as *const IrMaps);
+ debug!("creating fn_maps: {:?}", &fn_maps as *const IrMaps<'_, '_>);
let body = ir.tcx.hir.body(body_id);
fn propagate_through_loop(&mut self,
expr: &Expr,
- kind: LoopKind,
+ kind: LoopKind<'_>,
body: &hir::Block,
succ: LiveNode)
-> LiveNode {
}
fn from_pointer_kind(base_mutbl: MutabilityCategory,
- ptr: PointerKind) -> MutabilityCategory {
+ ptr: PointerKind<'_>) -> MutabilityCategory {
let ret = match ptr {
Unique => {
base_mutbl.inherit()
ret
}
- fn from_local(tcx: TyCtxt, tables: &ty::TypeckTables, id: ast::NodeId) -> MutabilityCategory {
+ fn from_local(tcx: TyCtxt<'_, '_, '_>, tables: &ty::TypeckTables<'_>,
+ id: ast::NodeId) -> MutabilityCategory {
let ret = match tcx.hir.get(id) {
Node::Binding(p) => match p.node {
PatKind::Binding(..) => {
}
}
- pub fn descriptive_string(&self, tcx: TyCtxt) -> String {
+ pub fn descriptive_string(&self, tcx: TyCtxt<'_, '_, '_>) -> String {
match self.cat {
Categorization::StaticItem => {
"static item".to_string()
}
}
-pub fn ptr_sigil(ptr: PointerKind) -> &'static str {
+pub fn ptr_sigil(ptr: PointerKind<'_>) -> &'static str {
match ptr {
Unique => "Box",
BorrowedPtr(ty::ImmBorrow, _) => "&",
}
impl fmt::Debug for InteriorKind {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
InteriorField(FieldIndex(_, info)) => write!(f, "{}", info),
InteriorElement(..) => write!(f, "[]"),
}
impl fmt::Debug for Upvar {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}/{:?}", self.id, self.kind)
}
}
impl fmt::Display for Upvar {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let kind = match self.kind {
ty::ClosureKind::Fn => "Fn",
ty::ClosureKind::FnMut => "FnMut",
}
impl<Id: Hash + Eq + fmt::Debug> fmt::Debug for AccessLevels<Id> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.map, f)
}
}
ReachableSet(Lrc::new(reachable_context.reachable_symbols))
}
-pub fn provide(providers: &mut Providers) {
+pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
reachable_set,
..*providers
}
impl fmt::Debug for Scope {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.data {
ScopeData::Node => write!(fmt, "Node({:?})", self.id),
ScopeData::CallSite => write!(fmt, "CallSite({:?})", self.id),
self.id
}
- pub fn node_id(&self, tcx: TyCtxt, scope_tree: &ScopeTree) -> ast::NodeId {
+ pub fn node_id(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> ast::NodeId {
match scope_tree.root_body {
Some(hir_id) => {
tcx.hir.hir_to_node_id(hir::HirId {
/// Returns the span of this Scope. Note that in general the
/// returned span may not correspond to the span of any node id in
/// the AST.
- pub fn span(&self, tcx: TyCtxt, scope_tree: &ScopeTree) -> Span {
+ pub fn span(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> Span {
let node_id = self.node_id(tcx, scope_tree);
if node_id == ast::DUMMY_NODE_ID {
return DUMMY_SP;
}
/// Records the lifetime of a local variable as `cx.var_parent`
-fn record_var_lifetime(visitor: &mut RegionResolutionVisitor,
+fn record_var_lifetime(visitor: &mut RegionResolutionVisitor<'_, '_>,
var_id: hir::ItemLocalId,
_sp: Span) {
match visitor.cx.var_parent {
Lrc::new(scope_tree)
}
-pub fn provide(providers: &mut Providers) {
+pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
region_scope_tree,
..*providers
}
impl Region {
- fn early(hir_map: &Map, index: &mut u32, param: &GenericParam) -> (ParamName, Region) {
+ fn early(hir_map: &Map<'_>, index: &mut u32, param: &GenericParam) -> (ParamName, Region) {
let i = *index;
*index += 1;
let def_id = hir_map.local_def_id(param.id);
(param.name.modern(), Region::EarlyBound(i, def_id, origin))
}
- fn late(hir_map: &Map, param: &GenericParam) -> (ParamName, Region) {
+ fn late(hir_map: &Map<'_>, param: &GenericParam) -> (ParamName, Region) {
let depth = ty::INNERMOST;
let def_id = hir_map.local_def_id(param.id);
let origin = LifetimeDefOrigin::from_param(param);
const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root;
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
resolve_lifetimes,
f(self)
}
- fn with<F>(&mut self, wrap_scope: Scope, f: F)
+ fn with<F>(&mut self, wrap_scope: Scope<'_>, f: F)
where
- F: for<'b> FnOnce(ScopeRef, &mut LifetimeContext<'b, 'tcx>),
+ F: for<'b> FnOnce(ScopeRef<'_>, &mut LifetimeContext<'b, 'tcx>),
{
let LifetimeContext {
tcx,
fn report_elision_failure(
&mut self,
- db: &mut DiagnosticBuilder,
+ db: &mut DiagnosticBuilder<'_>,
params: &[ElisionFailureInfo],
) {
let mut m = String::new();
self.insert_lifetime(lifetime_ref, lifetime.shifted(late_depth));
}
- fn check_lifetime_params(&mut self, old_scope: ScopeRef, params: &'tcx [hir::GenericParam]) {
+ fn check_lifetime_params(&mut self, old_scope: ScopeRef<'_>,
+ params: &'tcx [hir::GenericParam]) {
let lifetimes: Vec<_> = params.iter().filter_map(|param| match param.kind {
GenericParamKind::Lifetime { .. } => Some((param, param.name)),
_ => None,
fn check_lifetime_param_for_shadowing(
&self,
- mut old_scope: ScopeRef,
+ mut old_scope: ScopeRef<'_>,
param: &'tcx hir::GenericParam,
) {
for label in &self.labels_in_fn {
/// Not all lang items are always required for each compilation, particularly in
/// the case of panic=abort. In these situations some lang items are injected by
/// crates and don't actually need to be defined in libstd.
-pub fn whitelisted(tcx: TyCtxt, lang_item: lang_items::LangItem) -> bool {
+pub fn whitelisted(tcx: TyCtxt<'_, '_, '_>, lang_item: lang_items::LangItem) -> bool {
// If we're not compiling with unwinding, we won't actually need these
// symbols. Other panic runtimes ensure that the relevant symbols are
// available to link things together, but they're never exercised.
pub fn predecessors(
&self,
- mir: &Mir
- ) -> MappedReadGuard<IndexVec<BasicBlock, Vec<BasicBlock>>> {
+ mir: &Mir<'_>
+ ) -> MappedReadGuard<'_, IndexVec<BasicBlock, Vec<BasicBlock>>> {
if self.predecessors.borrow().is_none() {
*self.predecessors.borrow_mut() = Some(calculate_predecessors(mir));
}
}
}
-fn calculate_predecessors(mir: &Mir) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
+fn calculate_predecessors(mir: &Mir<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
let mut result = IndexVec::from_elem(vec![], mir.basic_blocks());
for (bb, data) in mir.basic_blocks().iter_enumerated() {
if let Some(ref term) = data.terminator {
}
impl<'tcx> fmt::Display for EvalError<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.kind)
}
}
impl<'tcx, O: fmt::Debug> fmt::Debug for EvalErrorKind<'tcx, O> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use self::EvalErrorKind::*;
match *self {
PointerOutOfBounds { ptr, access, allocation_size } => {
impl AllocDecodingState {
- pub fn new_decoding_session(&self) -> AllocDecodingSession {
+ pub fn new_decoding_session(&self) -> AllocDecodingSession<'_> {
static DECODER_SESSION_ID: AtomicU32 = AtomicU32::new(0);
let counter = DECODER_SESSION_ID.fetch_add(1, Ordering::SeqCst);
}
impl fmt::Display for AllocId {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
///
/// This must be inserted into the `local_decls` list as the first local.
#[inline]
- pub fn new_return_place(return_ty: Ty, span: Span) -> LocalDecl {
+ pub fn new_return_place(return_ty: Ty<'_>, span: Span) -> LocalDecl<'_> {
LocalDecl {
mutability: Mutability::Mut,
ty: return_ty,
iter::Chain<option::IntoIter<&'a mut BasicBlock>, slice::IterMut<'a, BasicBlock>>;
impl<'tcx> Terminator<'tcx> {
- pub fn successors(&self) -> Successors {
+ pub fn successors(&self) -> Successors<'_> {
self.kind.successors()
}
- pub fn successors_mut(&mut self) -> SuccessorsMut {
+ pub fn successors_mut(&mut self) -> SuccessorsMut<'_> {
self.kind.successors_mut()
}
}
}
- pub fn successors(&self) -> Successors {
+ pub fn successors(&self) -> Successors<'_> {
use self::TerminatorKind::*;
match *self {
Resume
}
}
- pub fn successors_mut(&mut self) -> SuccessorsMut {
+ pub fn successors_mut(&mut self) -> SuccessorsMut<'_> {
use self::TerminatorKind::*;
match *self {
Resume
pub fn retain_statements<F>(&mut self, mut f: F)
where
- F: FnMut(&mut Statement) -> bool,
+ F: FnMut(&mut Statement<'_>) -> bool,
{
for s in &mut self.statements {
if !f(s) {
}
impl<'tcx> Debug for TerminatorKind<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
self.fmt_head(fmt)?;
let successor_count = self.successors().count();
let labels = self.fmt_successor_labels();
}
impl Debug for ValidationOp {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::ValidationOp::*;
match *self {
Acquire => write!(fmt, "Acquire"),
}
impl<'tcx, T: Debug> Debug for ValidationOperand<'tcx, T> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
write!(fmt, "{:?}: {:?}", self.place, self.ty)?;
if let Some(ce) = self.re {
// (reuse lifetime rendering policy from ppaux.)
}
impl<'tcx> Debug for Statement<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::StatementKind::*;
match self.kind {
Assign(ref place, ref rv) => write!(fmt, "{:?} = {:?}", place, rv),
}
impl<'tcx> Debug for Place<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::Place::*;
match *self {
}
impl<'tcx> Debug for Operand<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::Operand::*;
match *self {
Constant(ref a) => write!(fmt, "{:?}", a),
}
impl<'tcx> Debug for Rvalue<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::Rvalue::*;
match *self {
}
Aggregate(ref kind, ref places) => {
- fn fmt_tuple(fmt: &mut Formatter, places: &[Operand]) -> fmt::Result {
+ fn fmt_tuple(fmt: &mut Formatter<'_>, places: &[Operand<'_>]) -> fmt::Result {
let mut tuple_fmt = fmt.debug_tuple("");
for place in places {
tuple_fmt.field(place);
}
impl<'tcx> Debug for Constant<'tcx> {
- fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
write!(fmt, "const ")?;
fmt_const_val(fmt, self.literal)
}
}
/// Write a `ConstValue` in a way closer to the original source code than the `Debug` output.
-pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result {
+pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const<'_>) -> fmt::Result {
use ty::TyKind::*;
let value = const_val.val;
let ty = const_val.ty;
}
impl fmt::Debug for Location {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "{:?}[{}]", self.block, self.statement_index)
}
}
}
impl fmt::Display for CrateType {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
CrateType::Executable => "bin".fmt(f),
CrateType::Dylib => "dylib".fmt(f),
.expect("missing sysroot and default_sysroot in Session"),
}
}
- pub fn target_filesearch(&self, kind: PathKind) -> filesearch::FileSearch {
+ pub fn target_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> {
filesearch::FileSearch::new(
self.sysroot(),
self.opts.target_triple.triple(),
kind,
)
}
- pub fn host_filesearch(&self, kind: PathKind) -> filesearch::FileSearch {
+ pub fn host_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> {
filesearch::FileSearch::new(
self.sysroot(),
config::host_triple(),
*incr_comp_session = IncrCompSession::InvalidBecauseOfErrors { session_directory };
}
- pub fn incr_comp_session_dir(&self) -> cell::Ref<PathBuf> {
+ pub fn incr_comp_session_dir(&self) -> cell::Ref<'_, PathBuf> {
let incr_comp_session = self.incr_comp_session.borrow();
cell::Ref::map(
incr_comp_session,
)
}
- pub fn incr_comp_session_dir_opt(&self) -> Option<cell::Ref<PathBuf>> {
+ pub fn incr_comp_session_dir_opt(&self) -> Option<cell::Ref<'_, PathBuf>> {
if self.opts.incremental.is_some() {
Some(self.incr_comp_session_dir())
} else {
}
impl fmt::Display for CrateDisambiguator {
- fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
let (a, b) = self.0.as_value();
let as_u128 = a as u128 | ((b as u128) << 64);
f.write_str(&base_n::encode(as_u128, base_n::CASE_INSENSITIVE))
self.paths.push((kind, PathBuf::from(path)));
}
- pub fn iter(&self, kind: PathKind) -> Iter {
+ pub fn iter(&self, kind: PathKind) -> Iter<'_> {
Iter { kind: kind, iter: self.paths.iter() }
}
}
}
}
- pub fn region_name(&self, region: Region) -> Option<String> {
+ pub fn region_name(&self, region: Region<'_>) -> Option<String> {
match region {
&ty::ReEarlyBound(r) => Some(r.name.to_string()),
_ => None,
}
}
- pub fn get_lifetime(&self, region: Region, names_map: &FxHashMap<String, String>) -> String {
+ pub fn get_lifetime(&self, region: Region<'_>,
+ names_map: &FxHashMap<String, String>) -> String {
self.region_name(region)
.map(|name|
names_map.get(&name).unwrap_or_else(||
finished_map
}
- pub fn is_of_param(&self, substs: &Substs) -> bool {
+ pub fn is_of_param(&self, substs: &Substs<'_>) -> bool {
if substs.is_noop() {
return false;
}
T: Iterator<Item = Obligation<'cx, ty::Predicate<'cx>>>,
>(
&self,
- ty: ty::Ty,
+ ty: ty::Ty<'_>,
nested: T,
computed_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,
fresh_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,
///
/// Note that this function is never called for types that have both type
/// parameters and inference variables.
-fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt,
+fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>,
trait_ref: ty::TraitRef<'tcx>,
in_crate: InCrate)
-> Result<(), OrphanCheckErr<'tcx>>
return Err(OrphanCheckErr::NoLocalInputType);
}
-fn uncovered_tys<'tcx>(tcx: TyCtxt, ty: Ty<'tcx>, in_crate: InCrate)
+fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate)
-> Vec<Ty<'tcx>> {
if ty_is_local_constructor(ty, in_crate) {
vec![]
}
}
-fn is_possibly_remote_type(ty: Ty, _in_crate: InCrate) -> bool {
+fn is_possibly_remote_type(ty: Ty<'_>, _in_crate: InCrate) -> bool {
match ty.sty {
ty::Projection(..) | ty::Param(..) => true,
_ => false,
}
}
-fn ty_is_local(tcx: TyCtxt, ty: Ty, in_crate: InCrate) -> bool {
+fn ty_is_local(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'_>, in_crate: InCrate) -> bool {
ty_is_local_constructor(ty, in_crate) ||
fundamental_ty(tcx, ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, in_crate))
}
-fn fundamental_ty(tcx: TyCtxt, ty: Ty) -> bool {
+fn fundamental_ty(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'_>) -> bool {
match ty.sty {
ty::Ref(..) => true,
ty::Adt(def, _) => def.is_fundamental(),
}
}
-fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
+fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool {
debug!("ty_is_local_constructor({:?})", ty);
match ty.sty {
fn report_similar_impl_candidates(&self,
mut impl_candidates: Vec<ty::TraitRef<'tcx>>,
- err: &mut DiagnosticBuilder)
+ err: &mut DiagnosticBuilder<'_>)
{
if impl_candidates.is_empty() {
return;
/// returns a span and `ArgKind` information that describes the
/// arguments it expects. This can be supplied to
/// `report_arg_count_mismatch`.
- pub fn get_fn_like_arguments(&self, node: Node) -> (Span, Vec<ArgKind>) {
+ pub fn get_fn_like_arguments(&self, node: Node<'_>) -> (Span, Vec<ArgKind>) {
match node {
Node::Expr(&hir::Expr {
node: hir::ExprKind::Closure(_, ref _decl, id, span, _),
}
fn note_obligation_cause<T>(&self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
obligation: &Obligation<'tcx, T>)
where T: fmt::Display
{
}
fn note_obligation_cause_code<T>(&self,
- err: &mut DiagnosticBuilder,
+ err: &mut DiagnosticBuilder<'_>,
predicate: &T,
cause_code: &ObligationCauseCode<'tcx>,
obligated_types: &mut Vec<&ty::TyS<'tcx>>)
}
}
- fn suggest_new_overflow_limit(&self, err: &mut DiagnosticBuilder) {
+ fn suggest_new_overflow_limit(&self, err: &mut DiagnosticBuilder<'_>) {
let current_limit = self.tcx.sess.recursion_limit.get();
let suggested_limit = current_limit * 2;
err.help(&format!("consider adding a `#![recursion_limit=\"{}\"]` attribute to your crate",
}
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
is_object_safe: object_safety::is_object_safe_provider,
specialization_graph_of: specialize::specialization_graph_provider,
}
}
-fn parse_error(tcx: TyCtxt, span: Span,
+fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span,
message: &str,
label: &str,
note: Option<&str>)
where
G: Fn() -> String,
{
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", (self.description)())
}
}
/// Emits notes when the overlap is caused by complex intercrate ambiguities.
/// See #23980 for details.
pub fn add_intercrate_ambiguity_hint<'a, 'tcx>(&self,
- err: &mut ::errors::DiagnosticBuilder) {
+ err: &mut ::errors::DiagnosticBuilder<'_>) {
err.note(&self.intercrate_ambiguity_hint());
}
/// Wraps a commit_if_ok s.t. obligations collected during it are not returned in selection if
/// the transaction fails and s.t. old obligations are retained.
fn commit_if_ok<T, E, F>(&mut self, f: F) -> Result<T, E> where
- F: FnOnce(&mut Self, &infer::CombinedSnapshot) -> Result<T, E>
+ F: FnOnce(&mut Self, &infer::CombinedSnapshot<'cx, 'tcx>) -> Result<T, E>
{
self.infcx.commit_if_ok(|snapshot| f(self, snapshot))
}
// Winnow, but record the exact outcome of evaluation, which
// is needed for specialization. Propagate overflow if it occurs.
- let candidates: Result<Vec<Option<EvaluatedCandidate>>, _> = candidates
+ let candidates: Result<Vec<Option<EvaluatedCandidate<'_>>>, _> = candidates
.into_iter()
.map(|c| match self.evaluate_candidate(stack, &c) {
Ok(eval) if eval.may_apply() => Ok(Some(EvaluatedCandidate {
})
.collect();
- let mut candidates: Vec<EvaluatedCandidate> =
+ let mut candidates: Vec<EvaluatedCandidate<'_>> =
candidates?.into_iter().filter_map(|c| c).collect();
debug!("winnowed to {} candidates for {:?}: {:?}",
}
fn fast_reject_trait_refs(&mut self,
- obligation: &TraitObligation,
- impl_trait_ref: &ty::TraitRef)
+ obligation: &TraitObligation<'_>,
+ impl_trait_ref: &ty::TraitRef<'_>)
-> bool
{
// We can avoid creating type variables and doing the full
}
impl<'o,'tcx> fmt::Debug for TraitObligationStack<'o,'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "TraitObligationStack({:?})", self.obligation)
}
}
WithDepNode { dep_node, cached_value }
}
- pub fn get(&self, tcx: TyCtxt) -> T {
+ pub fn get(&self, tcx: TyCtxt<'_, '_, '_>) -> T {
tcx.dep_graph.read_index(self.dep_node);
self.cached_value.clone()
}
/// Recovers the "impl X for Y" signature from `impl_def_id` and returns it as a
/// string.
-fn to_pretty_impl_header(tcx: TyCtxt, impl_def_id: DefId) -> Option<String> {
+fn to_pretty_impl_header(tcx: TyCtxt<'_, '_, '_>, impl_def_id: DefId) -> Option<String> {
use std::fmt::Write;
let trait_ref = if let Some(tr) = tcx.impl_trait_ref(impl_def_id) {
possible_sibling,
);
- let overlap_error = |overlap: traits::coherence::OverlapResult| {
+ let overlap_error = |overlap: traits::coherence::OverlapResult<'_>| {
// overlap, but no specialization; error out
let trait_ref = overlap.impl_header.trait_ref.unwrap();
let self_ty = trait_ref.self_ty();
/// Walk up the specialization ancestors of a given impl, starting with that
/// impl itself.
-pub fn ancestors(tcx: TyCtxt,
+pub fn ancestors(tcx: TyCtxt<'_, '_, '_>,
trait_def_id: DefId,
start_from_impl: DefId)
-> Ancestors {
// structural impls for the structs in traits
impl<'tcx, T: fmt::Debug> fmt::Debug for Normalized<'tcx, T> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Normalized({:?},{:?})", self.value, self.obligations)
}
}
impl<'tcx, O: fmt::Debug> fmt::Debug for traits::Obligation<'tcx, O> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if ty::tls::with(|tcx| tcx.sess.verbose()) {
write!(
f,
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::Vtable<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
super::VtableImpl(ref v) => write!(f, "{:?}", v),
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableImplData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableImpl(impl_def_id={:?}, substs={:?}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableGeneratorData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableGenerator(generator_def_id={:?}, substs={:?}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableClosureData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableClosure(closure_def_id={:?}, substs={:?}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableBuiltinData<N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "VtableBuiltin(nested={:?})", self.nested)
}
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableAutoImplData<N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableAutoImplData(trait_def_id={:?}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableObjectData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableObject(upcast={:?}, vtable_base={}, nested={:?})",
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableFnPointerData<'tcx, N> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"VtableFnPointer(fn_ty={:?}, nested={:?})",
}
impl<'tcx> fmt::Debug for traits::FulfillmentError<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "FulfillmentError({:?},{:?})", self.obligation, self.code)
}
}
impl<'tcx> fmt::Debug for traits::FulfillmentErrorCode<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
super::CodeSelectionError(ref e) => write!(f, "{:?}", e),
super::CodeProjectionError(ref e) => write!(f, "{:?}", e),
}
impl<'tcx> fmt::Debug for traits::MismatchedProjectionTypes<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "MismatchedProjectionTypes({:?})", self.err)
}
}
}
impl<'tcx> fmt::Display for traits::WhereClause<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::WhereClause::*;
match self {
}
impl<'tcx> fmt::Display for traits::WellFormed<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::WellFormed::*;
match self {
}
impl<'tcx> fmt::Display for traits::FromEnv<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::FromEnv::*;
match self {
}
impl<'tcx> fmt::Display for traits::DomainGoal<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::DomainGoal::*;
match self {
}
impl fmt::Display for traits::QuantifierKind {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::QuantifierKind::*;
match self {
}
impl<'tcx> fmt::Display for traits::Goal<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::Goal::*;
match self {
}
impl<'tcx> fmt::Display for traits::ProgramClause<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let traits::ProgramClause { goal, hypotheses } = self;
write!(fmt, "{}", goal)?;
if !hypotheses.is_empty() {
}
impl<'tcx> fmt::Display for traits::Clause<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::Clause::*;
match self {
read_f64 -> f64;
read_f32 -> f32;
read_char -> char;
- read_str -> Cow<str>;
+ read_str -> Cow<'_, str>;
}
fn error(&mut self, err: &str) -> Self::Error {
}
}
}
-
self.data.get(&id.local_id)
}
- pub fn iter(&self) -> hash_map::Iter<hir::ItemLocalId, V> {
+ pub fn iter(&self) -> hash_map::Iter<'_, hir::ItemLocalId, V> {
self.data.iter()
}
}
self.data.get_mut(&id.local_id)
}
- pub fn entry(&mut self, id: hir::HirId) -> Entry<hir::ItemLocalId, V> {
+ pub fn entry(&mut self, id: hir::HirId) -> Entry<'_, hir::ItemLocalId, V> {
validate_hir_id_for_typeck_tables(self.local_id_root, id, true);
self.data.entry(id.local_id)
}
}
}
- pub fn type_dependent_defs(&self) -> LocalTableInContext<Def> {
+ pub fn type_dependent_defs(&self) -> LocalTableInContext<'_, Def> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.type_dependent_defs
}
}
- pub fn type_dependent_defs_mut(&mut self) -> LocalTableInContextMut<Def> {
+ pub fn type_dependent_defs_mut(&mut self) -> LocalTableInContextMut<'_, Def> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.type_dependent_defs
}
}
- pub fn field_indices(&self) -> LocalTableInContext<usize> {
+ pub fn field_indices(&self) -> LocalTableInContext<'_, usize> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.field_indices
}
}
- pub fn field_indices_mut(&mut self) -> LocalTableInContextMut<usize> {
+ pub fn field_indices_mut(&mut self) -> LocalTableInContextMut<'_, usize> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.field_indices
}
}
- pub fn user_provided_tys(&self) -> LocalTableInContext<CanonicalTy<'tcx>> {
+ pub fn user_provided_tys(&self) -> LocalTableInContext<'_, CanonicalTy<'tcx>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.user_provided_tys
}
}
- pub fn user_provided_tys_mut(&mut self) -> LocalTableInContextMut<CanonicalTy<'tcx>> {
+ pub fn user_provided_tys_mut(&mut self) -> LocalTableInContextMut<'_, CanonicalTy<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.user_provided_tys
}
}
- pub fn node_types(&self) -> LocalTableInContext<Ty<'tcx>> {
+ pub fn node_types(&self) -> LocalTableInContext<'_, Ty<'tcx>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.node_types
}
}
- pub fn node_types_mut(&mut self) -> LocalTableInContextMut<Ty<'tcx>> {
+ pub fn node_types_mut(&mut self) -> LocalTableInContextMut<'_, Ty<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.node_types
self.node_types.get(&id.local_id).cloned()
}
- pub fn node_substs_mut(&mut self) -> LocalTableInContextMut<&'tcx Substs<'tcx>> {
+ pub fn node_substs_mut(&mut self) -> LocalTableInContextMut<'_, &'tcx Substs<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.node_substs
self.node_substs.get(&id.local_id).cloned()
}
- pub fn user_substs_mut(&mut self) -> LocalTableInContextMut<CanonicalSubsts<'tcx>> {
+ pub fn user_substs_mut(&mut self) -> LocalTableInContextMut<'_, CanonicalSubsts<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.user_substs
self.node_id_to_type_opt(expr.hir_id)
}
- pub fn adjustments(&self) -> LocalTableInContext<Vec<ty::adjustment::Adjustment<'tcx>>> {
+ pub fn adjustments(&self) -> LocalTableInContext<'_, Vec<ty::adjustment::Adjustment<'tcx>>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.adjustments
}
pub fn adjustments_mut(&mut self)
- -> LocalTableInContextMut<Vec<ty::adjustment::Adjustment<'tcx>>> {
+ -> LocalTableInContextMut<'_, Vec<ty::adjustment::Adjustment<'tcx>>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.adjustments
}
}
- pub fn pat_binding_modes(&self) -> LocalTableInContext<BindingMode> {
+ pub fn pat_binding_modes(&self) -> LocalTableInContext<'_, BindingMode> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.pat_binding_modes
}
pub fn pat_binding_modes_mut(&mut self)
- -> LocalTableInContextMut<BindingMode> {
+ -> LocalTableInContextMut<'_, BindingMode> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.pat_binding_modes
}
}
- pub fn pat_adjustments(&self) -> LocalTableInContext<Vec<Ty<'tcx>>> {
+ pub fn pat_adjustments(&self) -> LocalTableInContext<'_, Vec<Ty<'tcx>>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.pat_adjustments,
}
pub fn pat_adjustments_mut(&mut self)
- -> LocalTableInContextMut<Vec<Ty<'tcx>>> {
+ -> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.pat_adjustments,
self.upvar_capture_map[&upvar_id]
}
- pub fn closure_kind_origins(&self) -> LocalTableInContext<(Span, ast::Name)> {
+ pub fn closure_kind_origins(&self) -> LocalTableInContext<'_, (Span, ast::Name)> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.closure_kind_origins
}
}
- pub fn closure_kind_origins_mut(&mut self) -> LocalTableInContextMut<(Span, ast::Name)> {
+ pub fn closure_kind_origins_mut(&mut self) -> LocalTableInContextMut<'_, (Span, ast::Name)> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.closure_kind_origins
}
}
- pub fn liberated_fn_sigs(&self) -> LocalTableInContext<ty::FnSig<'tcx>> {
+ pub fn liberated_fn_sigs(&self) -> LocalTableInContext<'_, ty::FnSig<'tcx>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.liberated_fn_sigs
}
}
- pub fn liberated_fn_sigs_mut(&mut self) -> LocalTableInContextMut<ty::FnSig<'tcx>> {
+ pub fn liberated_fn_sigs_mut(&mut self) -> LocalTableInContextMut<'_, ty::FnSig<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.liberated_fn_sigs
}
}
- pub fn fru_field_types(&self) -> LocalTableInContext<Vec<Ty<'tcx>>> {
+ pub fn fru_field_types(&self) -> LocalTableInContext<'_, Vec<Ty<'tcx>>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.fru_field_types
}
}
- pub fn fru_field_types_mut(&mut self) -> LocalTableInContextMut<Vec<Ty<'tcx>>> {
+ pub fn fru_field_types_mut(&mut self) -> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.fru_field_types
}
}
- pub fn cast_kinds(&self) -> LocalTableInContext<ty::cast::CastKind> {
+ pub fn cast_kinds(&self) -> LocalTableInContext<'_, ty::cast::CastKind> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.cast_kinds
}
}
- pub fn cast_kinds_mut(&mut self) -> LocalTableInContextMut<ty::cast::CastKind> {
+ pub fn cast_kinds_mut(&mut self) -> LocalTableInContextMut<'_, ty::cast::CastKind> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.cast_kinds
// Ensure our type representation does not grow
#[cfg(target_pointer_width = "64")]
#[allow(dead_code)]
- static ASSERT_TY_KIND: () = [()][!(::std::mem::size_of::<ty::TyKind>() <= 24) as usize];
+ static ASSERT_TY_KIND: () =
+ [()][!(::std::mem::size_of::<ty::TyKind<'_>>() <= 24) as usize];
#[cfg(target_pointer_width = "64")]
#[allow(dead_code)]
- static ASSERT_TYS: () = [()][!(::std::mem::size_of::<ty::TyS>() <= 32) as usize];
+ static ASSERT_TYS: () = [()][!(::std::mem::size_of::<ty::TyS<'_>>() <= 32) as usize];
let mk = |sty| CtxtInterners::intern_ty(interners, interners, sty);
let mk_region = |r| {
/// This is a callback from libsyntax as it cannot access the implicit state
/// in librustc otherwise
- fn span_debug(span: syntax_pos::Span, f: &mut fmt::Formatter) -> fmt::Result {
+ fn span_debug(span: syntax_pos::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result {
with(|tcx| {
write!(f, "{}", tcx.sess.source_map().span_to_string(span))
})
} else {
// We could get a ImplicitCtxt pointer from another thread.
// Ensure that ImplicitCtxt is Sync
- sync::assert_sync::<ImplicitCtxt>();
+ sync::assert_sync::<ImplicitCtxt<'_, '_, '_>>();
- unsafe { f(Some(&*(context as *const ImplicitCtxt))) }
+ unsafe { f(Some(&*(context as *const ImplicitCtxt<'_, '_, '_>))) }
}
}
unsafe {
let gcx = tcx.gcx as *const _ as usize;
assert!(context.tcx.gcx as *const _ as usize == gcx);
- let context: &ImplicitCtxt = mem::transmute(context);
+ let context: &ImplicitCtxt<'_, '_, '_> = mem::transmute(context);
f(context)
}
})
let interners = tcx.interners as *const _ as usize;
assert!(context.tcx.gcx as *const _ as usize == gcx);
assert!(context.tcx.interners as *const _ as usize == interners);
- let context: &ImplicitCtxt = mem::transmute(context);
+ let context: &ImplicitCtxt<'_, '_, '_> = mem::transmute(context);
f(context)
}
})
both_infer: usize,
}
- pub fn go(tcx: TyCtxt) {
+ pub fn go(tcx: TyCtxt<'_, '_, '_>) {
let mut total = DebugStat {
total: 0,
region_infer: 0, ty_infer: 0, both_infer: 0,
direct_interners!('tcx,
region: mk_region(|r: &RegionKind| r.keep_in_local_tcx()) -> RegionKind,
- const_: mk_const(|c: &Const| keep_local(&c.ty) || keep_local(&c.val)) -> Const<'tcx>
+ const_: mk_const(|c: &Const<'_>| keep_local(&c.ty) || keep_local(&c.val)) -> Const<'tcx>
);
macro_rules! slice_interners {
&[$ty<'tcx>],
|a, v| List::from_arena(a, v),
Deref::deref,
- |xs: &[$ty]| xs.iter().any(keep_local)) -> List<$ty<'tcx>>);)+
+ |xs: &[$ty<'_>]| xs.iter().any(keep_local)) -> List<$ty<'tcx>>);)+
)
}
iter.intern_with(|xs| self.intern_goals(xs))
}
- pub fn mk_goal(self, goal: Goal<'tcx>) -> &'tcx Goal {
+ pub fn mk_goal(self, goal: Goal<'tcx>) -> &'tcx Goal<'_> {
&self.intern_goals(&[goal])[0]
}
}
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
// FIXME(#44234) - almost all of these queries have no sub-queries and
// therefore no actual inputs, they're just reading tables calculated in
// resolve! Does this work? Unsure! That's what the issue is about
use ty::{self, Ty, TyCtxt};
use ty::fold::{TypeFolder, TypeFoldable};
-pub(super) fn provide(providers: &mut ty::query::Providers) {
+pub(super) fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
erase_regions_ty,
..*providers
/// afterwards to present additional details, particularly when it comes to lifetime-related
/// errors.
impl<'tcx> fmt::Display for TypeError<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use self::TypeError::*;
- fn report_maybe_different(f: &mut fmt::Formatter,
+ fn report_maybe_different(f: &mut fmt::Formatter<'_>,
expected: String, found: String) -> fmt::Result {
// A naive approach to making sure that we're not reporting silly errors such as:
// (expected closure, found closure).
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn note_and_explain_type_err(self,
- db: &mut DiagnosticBuilder,
+ db: &mut DiagnosticBuilder<'_>,
err: &TypeError<'tcx>,
sp: Span) {
use self::TypeError::*;
/// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they
/// are to be considered bound.
pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
- ty: Ty,
+ ty: Ty<'_>,
can_simplify_params: bool)
-> Option<SimplifiedType>
{
}
}
- pub fn for_sty(st: &ty::TyKind) -> FlagComputation {
+ pub fn for_sty(st: &ty::TyKind<'_>) -> FlagComputation {
let mut result = FlagComputation::new();
result.add_sty(st);
result
}
}
- fn add_sty(&mut self, st: &ty::TyKind) {
+ fn add_sty(&mut self, st: &ty::TyKind<'_>) {
match st {
&ty::Bool |
&ty::Char |
}
}
- fn add_ty(&mut self, ty: Ty) {
+ fn add_ty(&mut self, ty: Ty<'_>) {
self.add_flags(ty.flags);
self.add_exclusive_binder(ty.outer_exclusive_binder);
}
- fn add_tys(&mut self, tys: &[Ty]) {
+ fn add_tys(&mut self, tys: &[Ty<'_>]) {
for &ty in tys {
self.add_ty(ty);
}
}
- fn add_fn_sig(&mut self, fn_sig: ty::PolyFnSig) {
+ fn add_fn_sig(&mut self, fn_sig: ty::PolyFnSig<'_>) {
let mut computation = FlagComputation::new();
computation.add_tys(fn_sig.skip_binder().inputs());
self.add_bound_computation(&computation);
}
- fn add_region(&mut self, r: ty::Region) {
+ fn add_region(&mut self, r: ty::Region<'_>) {
self.add_flags(r.type_flags());
if let ty::ReLateBound(debruijn, _) = *r {
self.add_binder(debruijn);
}
}
- fn add_const(&mut self, constant: &ty::Const) {
+ fn add_const(&mut self, constant: &ty::Const<'_>) {
self.add_ty(constant.ty);
if let ConstValue::Unevaluated(_, substs) = constant.val {
self.add_flags(TypeFlags::HAS_PROJECTION);
}
}
- fn add_existential_projection(&mut self, projection: &ty::ExistentialProjection) {
+ fn add_existential_projection(&mut self, projection: &ty::ExistentialProjection<'_>) {
self.add_substs(projection.substs);
self.add_ty(projection.ty);
}
- fn add_projection_ty(&mut self, projection_ty: &ty::ProjectionTy) {
+ fn add_projection_ty(&mut self, projection_ty: &ty::ProjectionTy<'_>) {
self.add_substs(projection_ty.substs);
}
- fn add_substs(&mut self, substs: &Substs) {
+ fn add_substs(&mut self, substs: &Substs<'_>) {
for ty in substs.types() {
self.add_ty(ty);
}
}
impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
- fn visit_ty(&mut self, t: Ty) -> bool {
+ fn visit_ty(&mut self, t: Ty<'_>) -> bool {
debug!("HasTypeFlagsVisitor: t={:?} t.flags={:?} self.flags={:?}", t, t.flags, self.flags);
t.flags.intersects(self.flags)
}
}
impl<'tcx> fmt::Display for Instance<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ppaux::parameterized(f, self.substs, self.def_id(), &[])?;
match self.def {
InstanceDef::Item(_) => Ok(()),
/// function tries to find a "characteristic def-id" for a
/// type. It's just a heuristic so it makes some questionable
/// decisions and we may want to adjust it later.
-pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
+pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option<DefId> {
match ty.sty {
ty::Adt(adt_def, _) => Some(adt_def.did),
}
impl<'tcx> fmt::Display for LayoutError<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
LayoutError::Unknown(ty) => {
write!(f, "the type `{:?}` has an unknown layout", ty)
})
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
layout_raw,
..*providers
/// A univariant, but with a prefix of an arbitrary size & alignment (e.g. enum tag).
Prefixed(Size, Align),
}
- let univariant_uninterned = |fields: &[TyLayout], repr: &ReprOptions, kind| {
+ let univariant_uninterned = |fields: &[TyLayout<'_>], repr: &ReprOptions, kind| {
let packed = repr.packed();
if packed && repr.align > 0 {
bug!("struct cannot be packed and aligned");
fields.len()
};
let optimizing = &mut inverse_memory_index[..end];
- let field_align = |f: &TyLayout| {
+ let field_align = |f: &TyLayout<'_>| {
if packed { f.align.min(pack).abi() } else { f.align.abi() }
};
match kind {
size
})
};
- let univariant = |fields: &[TyLayout], repr: &ReprOptions, kind| {
+ let univariant = |fields: &[TyLayout<'_>], repr: &ReprOptions, kind| {
Ok(tcx.intern_layout(univariant_uninterned(fields, repr, kind)?))
};
debug_assert!(!ty.has_infer_types());
// but *not* an encoding of the discriminant (e.g. a tag value).
// See issue #49298 for more details on the need to leave space
// for non-ZST uninhabited data (mostly partial initialization).
- let absent = |fields: &[TyLayout]| {
+ let absent = |fields: &[TyLayout<'_>]| {
let uninhabited = fields.iter().any(|f| f.abi == Abi::Uninhabited);
let is_zst = fields.iter().all(|f| f.is_zst());
uninhabited && is_zst
}
}
- pub fn same_size(self, other: SizeSkeleton) -> bool {
+ pub fn same_size(self, other: SizeSkeleton<'_>) -> bool {
match (self, other) {
(SizeSkeleton::Known(a), SizeSkeleton::Known(b)) => a == b,
(SizeSkeleton::Pointer { tail: a, .. },
}
impl Visibility {
- pub fn from_hir(visibility: &hir::Visibility, id: NodeId, tcx: TyCtxt) -> Self {
+ pub fn from_hir(visibility: &hir::Visibility, id: NodeId, tcx: TyCtxt<'_, '_, '_>) -> Self {
match visibility.node {
hir::VisibilityKind::Public => Visibility::Public,
hir::VisibilityKind::Crate(_) => Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)),
impl<'tcx> Hash for TyS<'tcx> {
fn hash<H: Hasher>(&self, s: &mut H) {
- (self as *const TyS).hash(s)
+ (self as *const TyS<'_>).hash(s)
}
}
}
impl<T: fmt::Debug> fmt::Debug for List<T> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
(**self).fmt(f)
}
}
self.skip_binder().projection_ty.item_def_id
}
- pub fn to_poly_trait_ref(&self, tcx: TyCtxt) -> PolyTraitRef<'tcx> {
+ pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> PolyTraitRef<'tcx> {
// Note: unlike with TraitRef::to_poly_trait_ref(),
// self.0.trait_ref is permitted to have escaping regions.
// This is because here `self` has a `Binder` and so does our
}
impl fmt::Debug for UniverseIndex {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "U{}", self.as_u32())
}
}
});
impl ReprOptions {
- pub fn new(tcx: TyCtxt, did: DefId) -> ReprOptions {
+ pub fn new(tcx: TyCtxt<'_, '_, '_>, did: DefId) -> ReprOptions {
let mut flags = ReprFlags::empty();
let mut size = None;
let mut max_align = 0;
}
impl<'a, 'gcx, 'tcx> AdtDef {
- fn new(tcx: TyCtxt,
+ fn new(tcx: TyCtxt<'_, '_, '_>,
did: DefId,
kind: AdtKind,
variants: Vec<VariantDef>,
}
}
- pub fn field_index(self, node_id: NodeId, tables: &TypeckTables) -> usize {
+ pub fn field_index(self, node_id: NodeId, tables: &TypeckTables<'_>) -> usize {
let hir_id = self.hir.node_to_hir_id(node_id);
tables.field_indices().get(hir_id).cloned().expect("no index for a field")
}
}
/// Yields the parent function's `DefId` if `def_id` is an `impl Trait` definition
-pub fn is_impl_trait_defn(tcx: TyCtxt, def_id: DefId) -> Option<DefId> {
+pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option<DefId> {
if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
if let Node::Item(item) = tcx.hir.get(node_id) {
if let hir::ItemKind::Existential(ref exist_ty) = item.node {
}
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
context::provide(providers);
erase_regions::provide(providers);
layout::provide(providers);
}
impl fmt::Display for SymbolName {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.name, fmt)
}
}
impl fmt::Debug for SymbolName {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.name, fmt)
}
}
```rust
impl<'tcx> QueryDescription for queries::type_of<'tcx> {
- fn describe(tcx: TyCtxt, key: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: DefId) -> String {
format!("computing the type of `{}`", tcx.item_path_str(key))
}
}
}
pub(super) trait QueryDescription<'tcx>: QueryAccessors<'tcx> {
- fn describe(tcx: TyCtxt, key: Self::Key) -> String;
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: Self::Key) -> String;
#[inline]
fn cache_on_disk(_: Self::Key) -> bool {
}
impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M {
- default fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ default fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
if !tcx.sess.verbose() {
format!("processing `{}`", tcx.item_path_str(def_id))
} else {
impl<'tcx> QueryDescription<'tcx> for queries::normalize_projection_ty<'tcx> {
fn describe(
- _tcx: TyCtxt,
+ _tcx: TyCtxt<'_, '_, '_>,
goal: CanonicalProjectionGoal<'tcx>,
) -> String {
format!("normalizing `{:?}`", goal)
}
impl<'tcx> QueryDescription<'tcx> for queries::implied_outlives_bounds<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTyGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTyGoal<'tcx>) -> String {
format!("computing implied outlives bounds for `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::dropck_outlives<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTyGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTyGoal<'tcx>) -> String {
format!("computing dropck types for `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::normalize_ty_after_erasing_regions<'tcx> {
- fn describe(_tcx: TyCtxt, goal: ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("normalizing `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::evaluate_obligation<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalPredicateGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalPredicateGoal<'tcx>) -> String {
format!("evaluating trait selection obligation `{}`", goal.value.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_eq<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpEqGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTypeOpEqGoal<'tcx>) -> String {
format!("evaluating `type_op_eq` `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_subtype<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpSubtypeGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTypeOpSubtypeGoal<'tcx>) -> String {
format!("evaluating `type_op_subtype` `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_prove_predicate<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpProvePredicateGoal<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTypeOpProvePredicateGoal<'tcx>) -> String {
format!("evaluating `type_op_prove_predicate` `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_ty<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>,
+ goal: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>) -> String {
format!("normalizing `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_predicate<'tcx> {
fn describe(
- _tcx: TyCtxt,
+ _tcx: TyCtxt<'_, '_, '_>,
goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::Predicate<'tcx>>,
) -> String {
format!("normalizing `{:?}`", goal)
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_poly_fn_sig<'tcx> {
fn describe(
- _tcx: TyCtxt,
+ _tcx: TyCtxt<'_, '_, '_>,
goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::PolyFnSig<'tcx>>,
) -> String {
format!("normalizing `{:?}`", goal)
}
impl<'tcx> QueryDescription<'tcx> for queries::type_op_normalize_fn_sig<'tcx> {
- fn describe(_tcx: TyCtxt, goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>,
+ goal: CanonicalTypeOpNormalizeGoal<'tcx, ty::FnSig<'tcx>>) -> String {
format!("normalizing `{:?}`", goal)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_copy_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing whether `{}` is `Copy`", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_sized_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing whether `{}` is `Sized`", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_freeze_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing whether `{}` is freeze", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::needs_drop_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing whether `{}` needs drop", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::layout_raw<'tcx> {
- fn describe(_tcx: TyCtxt, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> String {
format!("computing layout of `{}`", env.value)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::super_predicates_of<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("computing the supertraits of `{}`",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::erase_regions_ty<'tcx> {
- fn describe(_tcx: TyCtxt, ty: Ty<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>) -> String {
format!("erasing regions from `{:?}`", ty)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::type_param_predicates<'tcx> {
- fn describe(tcx: TyCtxt, (_, def_id): (DefId, DefId)) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, (_, def_id): (DefId, DefId)) -> String {
let id = tcx.hir.as_local_node_id(def_id).unwrap();
format!("computing the bounds for type parameter `{}`",
tcx.hir.ty_param_name(id))
}
impl<'tcx> QueryDescription<'tcx> for queries::coherent_trait<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("coherence checking all impls of trait `{}`",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::upstream_monomorphizations<'tcx> {
- fn describe(_: TyCtxt, k: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, k: CrateNum) -> String {
format!("collecting available upstream monomorphizations `{:?}`", k)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_inherent_impls<'tcx> {
- fn describe(_: TyCtxt, k: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, k: CrateNum) -> String {
format!("all inherent impls defined in crate `{:?}`", k)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_inherent_impls_overlap_check<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"check for overlap between inherent impls defined in this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_variances<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"computing the variances for items in this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::inferred_outlives_crate<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"computing the inferred outlives predicates for items in this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::mir_shims<'tcx> {
- fn describe(tcx: TyCtxt, def: ty::InstanceDef<'tcx>) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def: ty::InstanceDef<'tcx>) -> String {
format!("generating MIR shim for `{}`",
tcx.item_path_str(def.def_id()))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::privacy_access_levels<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"privacy access levels".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::typeck_item_bodies<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"type-checking all item bodies".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::reachable_set<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"reachability".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::const_eval<'tcx> {
- fn describe(tcx: TyCtxt, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>) -> String {
format!("const-evaluating `{}`", tcx.item_path_str(key.value.instance.def.def_id()))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::mir_keys<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"getting a list of all mir_keys".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::symbol_name<'tcx> {
- fn describe(_tcx: TyCtxt, instance: ty::Instance<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, instance: ty::Instance<'tcx>) -> String {
format!("computing the symbol for `{}`", instance)
}
}
impl<'tcx> QueryDescription<'tcx> for queries::describe_def<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("describe_def")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::def_span<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("def_span")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::lookup_stability<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("stability")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::lookup_deprecation_entry<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("deprecation")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::item_attrs<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("item_attrs")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_reachable_non_generic<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("is_reachable_non_generic")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::fn_arg_names<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("fn_arg_names")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::impl_parent<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("impl_parent")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::trait_of_item<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
bug!("trait_of_item")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::const_is_rvalue_promotable_to_static<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("const checking if rvalue is promotable to static `{}`",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::rvalue_promotable_map<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("checking which parts of `{}` are promotable to static",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_mir_available<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("checking if item is mir available: `{}`",
tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::codegen_fulfill_obligation<'tcx> {
- fn describe(tcx: TyCtxt, key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>,
+ key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> String {
format!("checking if `{}` fulfills its obligations", tcx.item_path_str(key.1.def_id()))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::trait_impls_of<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("trait impls of `{}`", tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_object_safe<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("determine object safety of trait `{}`", tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_const_fn<'tcx> {
- fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> String {
format!("checking if item is const fn: `{}`", tcx.item_path_str(def_id))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::dylib_dependency_formats<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"dylib dependency formats of crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_panic_runtime<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"checking if the crate is_panic_runtime".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_compiler_builtins<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"checking if the crate is_compiler_builtins".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::has_global_allocator<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"checking if the crate has_global_allocator".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::has_panic_handler<'tcx> {
- fn describe(_: TyCtxt, _: CrateNum) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"checking if the crate has_panic_handler".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::extern_crate<'tcx> {
- fn describe(_: TyCtxt, _: DefId) -> String {
+ fn describe(_: TyCtxt<'_, '_, '_>, _: DefId) -> String {
"getting crate's ExternCrateData".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::lint_levels<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"computing the lint levels for items in this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::specializes<'tcx> {
- fn describe(_tcx: TyCtxt, _: (DefId, DefId)) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: (DefId, DefId)) -> String {
"computing whether impls specialize one another".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::in_scope_traits_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> String {
"traits in scope at a block".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_no_builtins<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"test whether a crate has #![no_builtins]".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::panic_strategy<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"query a crate's configured panic strategy".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_profiler_runtime<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"query a crate is #![profiler_runtime]".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_sanitizer_runtime<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"query a crate is #![sanitizer_runtime]".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::reachable_non_generics<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the exported symbols of a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::native_libraries<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the native libraries of a linked crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::foreign_modules<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the foreign modules of a linked crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::plugin_registrar_fn<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the plugin registrar for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::derive_registrar_fn<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the derive registrar for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_disambiguator<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the disambiguator a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_hash<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the hash a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::original_crate_name<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the original name a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::extra_filename<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the extra filename for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::implementations_of_trait<'tcx> {
- fn describe(_tcx: TyCtxt, _: (CrateNum, DefId)) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: (CrateNum, DefId)) -> String {
"looking up implementations of a trait in a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::all_trait_implementations<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up all (?) trait implementations".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::link_args<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up link arguments for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::resolve_lifetimes<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"resolving lifetimes".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::named_region_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> String {
"looking up a named region".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::is_late_bound_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> String {
"testing if a region is late bound".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::object_lifetime_defaults_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefIndex) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefIndex) -> String {
"looking up lifetime defaults for a region".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::dep_kind<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"fetching what a dependency looks like".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::crate_name<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"fetching what a crate is named".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::get_lib_features<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
format!("calculating the lib features map")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::defined_lib_features<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
format!("calculating the lib features defined in a crate")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::get_lang_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the lang items map".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::defined_lang_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the lang items defined in a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::missing_lang_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the missing lang items in a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::visible_parent_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the visible parent map".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::missing_extern_crate_item<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"seeing if we're missing an `extern crate` item for this crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::used_crate_source<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking at the source for a crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::postorder_cnums<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"generating a postorder list of CrateNums".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::maybe_unused_extern_crates<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up all possibly unused extern crates".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::stability_index<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"calculating the stability index for the local crate".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::all_traits<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"fetching all foreign and local traits".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::all_crate_nums<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"fetching all foreign CrateNum instances".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::exported_symbols<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"exported_symbols".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::collect_and_partition_mono_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"collect_and_partition_mono_items".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::codegen_unit<'tcx> {
- fn describe(_tcx: TyCtxt, _: InternedString) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: InternedString) -> String {
"codegen_unit".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::output_filenames<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"output_filenames".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::vtable_methods<'tcx> {
- fn describe(tcx: TyCtxt, key: ty::PolyTraitRef<'tcx> ) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: ty::PolyTraitRef<'tcx> ) -> String {
format!("finding all methods for trait {}", tcx.item_path_str(key.def_id()))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::features_query<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up enabled feature gates".to_string()
}
}
}
impl<'tcx> QueryDescription<'tcx> for queries::substitute_normalize_and_test_predicates<'tcx> {
- fn describe(tcx: TyCtxt, key: (DefId, &'tcx Substs<'tcx>)) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, key: (DefId, &'tcx Substs<'tcx>)) -> String {
format!("testing substituted normalized predicates:`{}`", tcx.item_path_str(key.0))
}
}
impl<'tcx> QueryDescription<'tcx> for queries::target_features_whitelist<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"looking up the whitelist of target features".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::instance_def_size_estimate<'tcx> {
- fn describe(tcx: TyCtxt, def: ty::InstanceDef<'tcx>) -> String {
+ fn describe(tcx: TyCtxt<'_, '_, '_>, def: ty::InstanceDef<'tcx>) -> String {
format!("estimating size for `{}`", tcx.item_path_str(def.def_id()))
}
}
}
impl<'tcx> QueryDescription<'tcx> for queries::program_clauses_for<'tcx> {
- fn describe(_tcx: TyCtxt, _: DefId) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: DefId) -> String {
"generating chalk-style clauses".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::program_clauses_for_env<'tcx> {
- fn describe(_tcx: TyCtxt, _: ty::ParamEnv<'tcx>) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: ty::ParamEnv<'tcx>) -> String {
"generating chalk-style clauses for param env".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::wasm_import_module_map<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"wasm import module map".to_string()
}
}
impl<'tcx> QueryDescription<'tcx> for queries::dllimport_foreign_items<'tcx> {
- fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
+ fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> String {
"wasm import module map".to_string()
}
}
/// In the event that a cycle occurs, if no explicit span has been
/// given for a query with key `self`, what span should we use?
- fn default_span(&self, tcx: TyCtxt) -> Span;
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span;
}
impl<'tcx> Key for ty::InstanceDef<'tcx> {
LOCAL_CRATE
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(self.def_id())
}
}
LOCAL_CRATE
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(self.def_id())
}
}
self.instance.query_crate()
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.instance.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
*self
}
- fn default_span(&self, _: TyCtxt) -> Span {
+ fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _tcx: TyCtxt) -> Span {
+ fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
self.krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(*self)
}
}
fn query_crate(&self) -> CrateNum {
self.0.krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.1.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
self.0
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.1.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
self.0.krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.0.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
self.0.krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.0.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
self.1.def_id().krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(self.1.def_id())
}
}
fn query_crate(&self) -> CrateNum {
self.def_id().krate
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
tcx.def_span(self.def_id())
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _: TyCtxt) -> Span {
+ fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _: TyCtxt) -> Span {
+ fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _: TyCtxt) -> Span {
+ fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
fn query_crate(&self) -> CrateNum {
self.value.query_crate()
}
- fn default_span(&self, tcx: TyCtxt) -> Span {
+ fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span {
self.value.default_span(tcx)
}
}
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
- fn default_span(&self, _tcx: TyCtxt) -> Span {
+ fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
LOCAL_CRATE
}
- fn default_span(&self, _tcx: TyCtxt) -> Span {
+ fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span {
DUMMY_SP
}
}
span: Span,
key: DefId,
) -> Result<&'tcx [Ty<'tcx>], DiagnosticBuilder<'a>> {
- self.try_get_query::<queries::adt_sized_constraint>(span, key)
+ self.try_get_query::<queries::adt_sized_constraint<'_>>(span, key)
}
pub fn try_needs_drop_raw(
self,
span: Span,
key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,
) -> Result<bool, DiagnosticBuilder<'a>> {
- self.try_get_query::<queries::needs_drop_raw>(span, key)
+ self.try_get_query::<queries::needs_drop_raw<'_>>(span, key)
}
pub fn try_optimized_mir(
self,
span: Span,
key: DefId,
) -> Result<&'tcx mir::Mir<'tcx>, DiagnosticBuilder<'a>> {
- self.try_get_query::<queries::optimized_mir>(span, key)
+ self.try_get_query::<queries::optimized_mir<'_>>(span, key)
}
}
let enc = &mut encoder;
let qri = &mut query_result_index;
- encode_query_results::<type_of, _>(tcx, enc, qri)?;
- encode_query_results::<generics_of, _>(tcx, enc, qri)?;
- encode_query_results::<predicates_of, _>(tcx, enc, qri)?;
- encode_query_results::<used_trait_imports, _>(tcx, enc, qri)?;
- encode_query_results::<typeck_tables_of, _>(tcx, enc, qri)?;
- encode_query_results::<codegen_fulfill_obligation, _>(tcx, enc, qri)?;
- encode_query_results::<optimized_mir, _>(tcx, enc, qri)?;
- encode_query_results::<unsafety_check_result, _>(tcx, enc, qri)?;
- encode_query_results::<borrowck, _>(tcx, enc, qri)?;
- encode_query_results::<mir_borrowck, _>(tcx, enc, qri)?;
- encode_query_results::<mir_const_qualif, _>(tcx, enc, qri)?;
- encode_query_results::<def_symbol_name, _>(tcx, enc, qri)?;
- encode_query_results::<const_is_rvalue_promotable_to_static, _>(tcx, enc, qri)?;
- encode_query_results::<symbol_name, _>(tcx, enc, qri)?;
- encode_query_results::<check_match, _>(tcx, enc, qri)?;
- encode_query_results::<codegen_fn_attrs, _>(tcx, enc, qri)?;
- encode_query_results::<specialization_graph_of, _>(tcx, enc, qri)?;
+ encode_query_results::<type_of<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<generics_of<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<predicates_of<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<used_trait_imports<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<typeck_tables_of<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<codegen_fulfill_obligation<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<optimized_mir<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<unsafety_check_result<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<borrowck<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<mir_borrowck<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<mir_const_qualif<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<def_symbol_name<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<const_is_rvalue_promotable_to_static<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<symbol_name<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<check_match<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<codegen_fn_attrs<'_>, _>(tcx, enc, qri)?;
+ encode_query_results::<specialization_graph_of<'_>, _>(tcx, enc, qri)?;
// const eval is special, it only encodes successfully evaluated constants
use ty::query::QueryAccessors;
return Ok(());
- fn sorted_cnums_including_local_crate(tcx: TyCtxt) -> Vec<CrateNum> {
+ fn sorted_cnums_including_local_crate(tcx: TyCtxt<'_, '_, '_>) -> Vec<CrateNum> {
let mut cnums = vec![LOCAL_CRATE];
cnums.extend_from_slice(&tcx.crates()[..]);
cnums.sort_unstable();
// current-session-CrateNum. There might be CrateNums from the previous
// Session that don't occur in the current one. For these, the mapping
// maps to None.
- fn compute_cnum_map(tcx: TyCtxt,
+ fn compute_cnum_map(tcx: TyCtxt<'_, '_, '_>,
prev_cnums: &[(u32, String, CrateDisambiguator)])
-> IndexVec<CrateNum, Option<CrateNum>>
{
}
}
- pub fn describe(&self, tcx: TyCtxt) -> String {
+ pub fn describe(&self, tcx: TyCtxt<'_, '_, '_>) -> String {
let (r, name) = match *self {
$(Query::$name(key) => {
(queries::$name::describe(tcx, key), stringify!($name))
///
/// Note: The optimization is only available during incr. comp.
pub fn ensure(tcx: TyCtxt<'a, $tcx, 'lcx>, key: $K) -> () {
- tcx.ensure_query::<queries::$name>(key);
+ tcx.ensure_query::<queries::$name<'_>>(key);
}
})*
impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> {
$($(#[$attr])*
pub fn $name(self, key: $K) -> $V {
- self.tcx.get_query::<queries::$name>(self.span, key)
+ self.tcx.get_query::<queries::$name<'_>>(self.span, key)
})*
}
)
);
- match tcx.force_query::<::ty::query::queries::$query>($key, DUMMY_SP, *dep_node) {
+ match tcx.force_query::<::ty::query::queries::$query<'_>>(
+ $key, DUMMY_SP, *dep_node
+ ) {
Ok(_) => {},
Err(e) => {
tcx.report_cycle(e).emit();
impl DepNode {
// Check whether the query invocation corresponding to the given
// DepNode is eligible for on-disk-caching.
- pub fn cache_on_disk(&self, tcx: TyCtxt) -> bool {
+ pub fn cache_on_disk(&self, tcx: TyCtxt<'_, '_, '_>) -> bool {
use ty::query::queries;
use ty::query::QueryDescription;
// above `cache_on_disk` methods returns true.
// Also, as a sanity check, it expects that the corresponding query
// invocation has been marked as green already.
- pub fn load_from_on_disk_cache(&self, tcx: TyCtxt) {
+ pub fn load_from_on_disk_cache(&self, tcx: TyCtxt<'_, '_, '_>) {
match self.kind {
$(DepKind::$dep_kind => {
debug_assert!(tcx.dep_graph
}
}
- pub fn borrow(&self) -> MappedReadGuard<T> {
+ pub fn borrow(&self) -> MappedReadGuard<'_, T> {
ReadGuard::map(self.value.borrow(), |opt| match *opt {
None => bug!("attempted to read from stolen value"),
Some(ref v) => v
pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>)
-> ty::TraitRef<'tcx> {
// otherwise the escaping regions would be captured by the binder
- debug_assert!(!self_ty.has_escaping_regions());
+ // debug_assert!(!self_ty.has_escaping_regions());
ty::TraitRef {
def_id: self.def_id,
/// Construct a ProjectionTy by searching the trait from trait_ref for the
/// associated item named item_name.
pub fn from_ref_and_name(
- tcx: TyCtxt, trait_ref: ty::TraitRef<'tcx>, item_name: Ident
+ tcx: TyCtxt<'_, '_, '_>, trait_ref: ty::TraitRef<'tcx>, item_name: Ident
) -> ProjectionTy<'tcx> {
let item_def_id = tcx.associated_items(trait_ref.def_id).find(|item| {
item.kind == ty::AssociatedKind::Type &&
/// Extracts the underlying trait reference from this projection.
/// For example, if this is a projection of `<T as Iterator>::Item`,
/// then this function would return a `T: Iterator` trait reference.
- pub fn trait_ref(&self, tcx: TyCtxt) -> ty::TraitRef<'tcx> {
+ pub fn trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> ty::TraitRef<'tcx> {
let def_id = tcx.associated_item(self.item_def_id).container.id();
ty::TraitRef {
def_id,
/// For example, if this is a projection of `exists T. <T as Iterator>::Item == X`,
/// then this function would return a `exists T. T: Iterator` existential trait
/// reference.
- pub fn trait_ref(&self, tcx: TyCtxt) -> ty::ExistentialTraitRef<'tcx> {
+ pub fn trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> ty::ExistentialTraitRef<'tcx> {
let def_id = tcx.associated_item(self.item_def_id).container.id();
ty::ExistentialTraitRef{
def_id,
}
}
- pub fn simd_size(&self, _cx: TyCtxt) -> usize {
+ pub fn simd_size(&self, _cx: TyCtxt<'_, '_, '_>) -> usize {
match self.sty {
Adt(def, _) => def.non_enum_variant().fields.len(),
_ => bug!("simd_size called on invalid type")
}
impl<'tcx> Ord for Kind<'tcx> {
- fn cmp(&self, other: &Kind) -> Ordering {
+ fn cmp(&self, other: &Kind<'_>) -> Ordering {
self.unpack().cmp(&other.unpack())
}
}
impl<'tcx> PartialOrd for Kind<'tcx> {
- fn partial_cmp(&self, other: &Kind) -> Option<Ordering> {
+ fn partial_cmp(&self, other: &Kind<'_>) -> Option<Ordering> {
Some(self.cmp(&other))
}
}
}
impl<'tcx> fmt::Debug for Kind<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.unpack() {
UnpackedKind::Lifetime(lt) => write!(f, "{:?}", lt),
UnpackedKind::Type(ty) => write!(f, "{:?}", ty),
}
impl<'tcx> fmt::Display for Kind<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.unpack() {
UnpackedKind::Lifetime(lt) => write!(f, "{}", lt),
UnpackedKind::Type(ty) => write!(f, "{}", ty),
}
impl<'tcx> fmt::Display for Discr<'tcx> {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.ty.sty {
ty::Int(ity) => {
let bits = ty::tls::with(|tcx| {
// To avoid a stack overflow when checking an enum variant or struct that
// contains a different, structurally recursive type, maintain a stack
// of seen types and check recursion for each of them (issues #3008, #3779).
- let mut seen: Vec<Ty> = Vec::new();
+ let mut seen: Vec<Ty<'_>> = Vec::new();
let mut representable_cache = FxHashMap();
let r = is_type_structurally_recursive(
tcx, sp, &mut seen, &mut representable_cache, self);
}
}
-pub fn provide(providers: &mut ty::query::Providers) {
+pub fn provide(providers: &mut ty::query::Providers<'_>) {
*providers = ty::query::Providers {
is_copy_raw,
is_sized_raw,
#[cold]
#[inline(never)]
-pub fn bug_fmt(file: &'static str, line: u32, args: fmt::Arguments) -> ! {
+pub fn bug_fmt(file: &'static str, line: u32, args: fmt::Arguments<'_>) -> ! {
// this wrapper mostly exists so I don't have to write a fully
// qualified path of None::<Span> inside the bug!() macro definition
opt_span_bug_fmt(file, line, None::<Span>, args);
file: &'static str,
line: u32,
span: S,
- args: fmt::Arguments,
+ args: fmt::Arguments<'_>,
) -> ! {
opt_span_bug_fmt(file, line, Some(span), args);
}
file: &'static str,
line: u32,
span: Option<S>,
- args: fmt::Arguments,
+ args: fmt::Arguments<'_>,
) -> ! {
tls::with_opt(move |tcx| {
let msg = format!("{}:{}: {}", file, line, args);
thread_local!(static TIME_DEPTH: Cell<usize> = Cell::new(0));
lazy_static! {
- static ref DEFAULT_HOOK: Box<dyn Fn(&panic::PanicInfo) + Sync + Send + 'static> = {
+ static ref DEFAULT_HOOK: Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static> = {
let hook = panic::take_hook();
panic::set_hook(Box::new(panic_hook));
hook
};
}
-fn panic_hook(info: &panic::PanicInfo) {
+fn panic_hook(info: &panic::PanicInfo<'_>) {
if !proc_macro::__internal::in_sess() {
(*DEFAULT_HOOK)(info);
macro_rules! gen_display_debug_body {
( $with:path ) => {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut cx = PrintContext::new();
$with(self, f, &mut cx)
}
impl PrintContext {
fn fn_sig<F: fmt::Write>(&mut self,
f: &mut F,
- inputs: &[Ty],
+ inputs: &[Ty<'_>],
variadic: bool,
- output: Ty)
+ output: Ty<'_>)
-> fmt::Result {
write!(f, "(")?;
let mut inputs = inputs.iter();
fn parameterized<F: fmt::Write>(&mut self,
f: &mut F,
- substs: &subst::Substs,
+ substs: &subst::Substs<'_>,
mut did: DefId,
- projections: &[ty::ProjectionPredicate])
+ projections: &[ty::ProjectionPredicate<'_>])
-> fmt::Result {
let key = ty::tls::with(|tcx| tcx.def_key(did));
let mut item_name = if let Some(name) = key.disambiguated_data.data.get_opt_name() {
let print_regions = |f: &mut F, start: &str, skip, count| {
// Don't print any regions if they're all erased.
let regions = || substs.regions().skip(skip).take(count);
- if regions().all(|r: ty::Region| *r == ty::ReErased) {
+ if regions().all(|r: ty::Region<'_>| *r == ty::ReErased) {
return Ok(());
}
for region in regions() {
- let region: ty::Region = region;
+ let region: ty::Region<'_> = region;
start_or_continue(f, start, ", ")?;
if verbose {
write!(f, "{:?}", region)?;
}
pub fn parameterized<F: fmt::Write>(f: &mut F,
- substs: &subst::Substs,
+ substs: &subst::Substs<'_>,
did: DefId,
- projections: &[ty::ProjectionPredicate])
+ projections: &[ty::ProjectionPredicate<'_>])
-> fmt::Result {
PrintContext::new().parameterized(f, substs, did, projections)
}
}
impl fmt::Debug for ty::GenericParamDef {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let type_name = match self.kind {
ty::GenericParamDefKind::Lifetime => "Lifetime",
ty::GenericParamDefKind::Type {..} => "Type",
}
impl fmt::Debug for ty::TraitDef {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
write!(f, "{}", tcx.item_path_str(self.def_id))
})
}
impl fmt::Debug for ty::AdtDef {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
write!(f, "{}", tcx.item_path_str(self.did))
})
}
impl<'tcx> fmt::Debug for ty::ClosureUpvar<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ClosureUpvar({:?},{:?})",
self.def,
self.ty)
}
impl fmt::Debug for ty::UpvarId {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "UpvarId({:?};`{}`;{:?})",
self.var_id,
ty::tls::with(|tcx| tcx.hir.name(tcx.hir.hir_to_node_id(self.var_id))),
}
impl<'tcx> fmt::Debug for ty::UpvarBorrow<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "UpvarBorrow({:?}, {:?})",
self.kind, self.region)
}
}
impl fmt::Debug for ty::TyVid {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "_#{}t", self.index)
}
}
impl fmt::Debug for ty::IntVid {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "_#{}i", self.index)
}
}
impl fmt::Debug for ty::FloatVid {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "_#{}f", self.index)
}
}
impl fmt::Debug for ty::RegionVid {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some((region, counter)) = get_highlight_region_for_regionvid() {
debug!("RegionVid.fmt: region={:?} self={:?} counter={:?}", region, self, counter);
return if *self == region {
}
impl fmt::Debug for ty::IntVarValue {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
ty::IntType(ref v) => v.fmt(f),
ty::UintType(ref v) => v.fmt(f),
}
impl fmt::Debug for ty::FloatVarValue {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
where T: fmt::Display + for<'a> ty::Lift<'a>,
for<'a> <T as ty::Lift<'a>>::Lifted: fmt::Display + TypeFoldable<'a>
{
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| in_binder(f, tcx, self, tcx.lift(self)))
}
}*/
}
}
- fn print(&self, lock: &mut StdoutLock) {
+ fn print(&self, lock: &mut StdoutLock<'_>) {
writeln!(lock, "| Phase | Time (ms) | Queries | Hits (%) |")
.unwrap();
writeln!(lock, "| ---------------- | -------------- | -------------- | -------- |")