未验证 提交 4d5ffc48 编写于 作者: M Matthias Krüger 提交者: GitHub

Rollup merge of #91984 - Aaron1011:rustc-middle-lifetime, r=oli-obk

Remove `in_band_lifetimes` from `rustc_middle`

See #91867

This was mostly straightforward. In several places, I take advantage
of the fact that lifetimes are non-hygenic: a macro declares the
'tcx' lifetime, which is then used in types passed in as macro
arguments.
use quote::quote; use quote::quote;
use syn::parse_quote;
pub fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { pub fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
if let syn::Data::Union(_) = s.ast().data { if let syn::Data::Union(_) = s.ast().data {
panic!("cannot derive on union") panic!("cannot derive on union")
} }
if !s.ast().generics.lifetimes().any(|lt| lt.lifetime.ident == "tcx") {
s.add_impl_generic(parse_quote! { 'tcx });
}
s.add_bounds(synstructure::AddBounds::Generics); s.add_bounds(synstructure::AddBounds::Generics);
let body_visit = s.each(|bind| { let body_visit = s.each(|bind| {
quote! { quote! {
......
...@@ -201,7 +201,7 @@ pub mod label_strs { ...@@ -201,7 +201,7 @@ pub mod label_strs {
// WARNING: `construct` is generic and does not know that `CompileMonoItem` takes `MonoItem`s as keys. // WARNING: `construct` is generic and does not know that `CompileMonoItem` takes `MonoItem`s as keys.
// Be very careful changing this type signature! // Be very careful changing this type signature!
crate fn make_compile_mono_item(tcx: TyCtxt<'tcx>, mono_item: &MonoItem<'tcx>) -> DepNode { crate fn make_compile_mono_item<'tcx>(tcx: TyCtxt<'tcx>, mono_item: &MonoItem<'tcx>) -> DepNode {
DepNode::construct(tcx, DepKind::CompileMonoItem, mono_item) DepNode::construct(tcx, DepKind::CompileMonoItem, mono_item)
} }
...@@ -264,7 +264,7 @@ fn from_def_path_hash(tcx: TyCtxt<'_>, def_path_hash: DefPathHash, kind: DepKind ...@@ -264,7 +264,7 @@ fn from_def_path_hash(tcx: TyCtxt<'_>, def_path_hash: DefPathHash, kind: DepKind
/// DepNode. Condition (2) might not be fulfilled if a DepNode /// DepNode. Condition (2) might not be fulfilled if a DepNode
/// refers to something from the previous compilation session that /// refers to something from the previous compilation session that
/// has been removed. /// has been removed.
fn extract_def_id(&self, tcx: TyCtxt<'tcx>) -> Option<DefId> { fn extract_def_id<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Option<DefId> {
if self.kind.fingerprint_style(tcx) == FingerprintStyle::DefPathHash { if self.kind.fingerprint_style(tcx) == FingerprintStyle::DefPathHash {
Some(tcx.def_path_hash_to_def_id(DefPathHash(self.hash.into()))) Some(tcx.def_path_hash_to_def_id(DefPathHash(self.hash.into())))
} else { } else {
......
...@@ -75,7 +75,7 @@ pub struct OriginalQueryValues<'tcx> { ...@@ -75,7 +75,7 @@ pub struct OriginalQueryValues<'tcx> {
pub var_values: SmallVec<[GenericArg<'tcx>; 8]>, pub var_values: SmallVec<[GenericArg<'tcx>; 8]>,
} }
impl Default for OriginalQueryValues<'tcx> { impl<'tcx> Default for OriginalQueryValues<'tcx> {
fn default() -> Self { fn default() -> Self {
let mut universe_map = SmallVec::default(); let mut universe_map = SmallVec::default();
universe_map.push(ty::UniverseIndex::ROOT); universe_map.push(ty::UniverseIndex::ROOT);
......
...@@ -164,7 +164,7 @@ fn unify_values(&value1: &Self, &value2: &Self) -> Result<Self, Self::Error> { ...@@ -164,7 +164,7 @@ fn unify_values(&value1: &Self, &value2: &Self) -> Result<Self, Self::Error> {
impl<'tcx> EqUnifyValue for &'tcx ty::Const<'tcx> {} impl<'tcx> EqUnifyValue for &'tcx ty::Const<'tcx> {}
pub fn replace_if_possible<V, L>( pub fn replace_if_possible<'tcx, V, L>(
table: &mut UnificationTable<InPlace<ty::ConstVid<'tcx>, V, L>>, table: &mut UnificationTable<InPlace<ty::ConstVid<'tcx>, V, L>>,
c: &'tcx ty::Const<'tcx>, c: &'tcx ty::Const<'tcx>,
) -> &'tcx ty::Const<'tcx> ) -> &'tcx ty::Const<'tcx>
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#![feature(let_else)] #![feature(let_else)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(trusted_len)] #![feature(trusted_len)]
#![feature(in_band_lifetimes)]
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]
#![feature(associated_type_bounds)] #![feature(associated_type_bounds)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
......
...@@ -212,7 +212,7 @@ pub fn struct_lint_level<'s, 'd>( ...@@ -212,7 +212,7 @@ pub fn struct_lint_level<'s, 'd>(
) { ) {
// Avoid codegen bloat from monomorphization by immediately doing dyn dispatch of `decorate` to // Avoid codegen bloat from monomorphization by immediately doing dyn dispatch of `decorate` to
// the "real" work. // the "real" work.
fn struct_lint_level_impl( fn struct_lint_level_impl<'s, 'd>(
sess: &'s Session, sess: &'s Session,
lint: &'static Lint, lint: &'static Lint,
level: Level, level: Level,
......
...@@ -229,7 +229,7 @@ pub fn deprecation_message_and_lint( ...@@ -229,7 +229,7 @@ pub fn deprecation_message_and_lint(
) )
} }
pub fn early_report_deprecation( pub fn early_report_deprecation<'a>(
lint_buffer: &'a mut LintBuffer, lint_buffer: &'a mut LintBuffer,
message: &str, message: &str,
suggestion: Option<Symbol>, suggestion: Option<Symbol>,
......
...@@ -63,7 +63,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -63,7 +63,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
} }
} }
impl InterpErrorInfo<'tcx> { impl<'tcx> InterpErrorInfo<'tcx> {
pub fn print_backtrace(&self) { pub fn print_backtrace(&self) {
if let Some(backtrace) = self.0.backtrace.as_ref() { if let Some(backtrace) = self.0.backtrace.as_ref() {
print_backtrace(backtrace); print_backtrace(backtrace);
......
...@@ -145,7 +145,7 @@ pub struct GlobalId<'tcx> { ...@@ -145,7 +145,7 @@ pub struct GlobalId<'tcx> {
pub promoted: Option<mir::Promoted>, pub promoted: Option<mir::Promoted>,
} }
impl GlobalId<'tcx> { impl<'tcx> GlobalId<'tcx> {
pub fn display(self, tcx: TyCtxt<'tcx>) -> String { pub fn display(self, tcx: TyCtxt<'tcx>) -> String {
let instance_name = with_no_trimmed_paths(|| tcx.def_path_str(self.instance.def.def_id())); let instance_name = with_no_trimmed_paths(|| tcx.def_path_str(self.instance.def.def_id()));
if let Some(promoted) = self.promoted { if let Some(promoted) = self.promoted {
...@@ -273,7 +273,7 @@ pub struct AllocDecodingSession<'s> { ...@@ -273,7 +273,7 @@ pub struct AllocDecodingSession<'s> {
impl<'s> AllocDecodingSession<'s> { impl<'s> AllocDecodingSession<'s> {
/// Decodes an `AllocId` in a thread-safe way. /// Decodes an `AllocId` in a thread-safe way.
pub fn decode_alloc_id<D>(&self, decoder: &mut D) -> Result<AllocId, D::Error> pub fn decode_alloc_id<'tcx, D>(&self, decoder: &mut D) -> Result<AllocId, D::Error>
where where
D: TyDecoder<'tcx>, D: TyDecoder<'tcx>,
{ {
...@@ -390,7 +390,7 @@ pub enum GlobalAlloc<'tcx> { ...@@ -390,7 +390,7 @@ pub enum GlobalAlloc<'tcx> {
Memory(&'tcx Allocation), Memory(&'tcx Allocation),
} }
impl GlobalAlloc<'tcx> { impl<'tcx> GlobalAlloc<'tcx> {
/// Panics if the `GlobalAlloc` does not refer to an `GlobalAlloc::Memory` /// Panics if the `GlobalAlloc` does not refer to an `GlobalAlloc::Memory`
#[track_caller] #[track_caller]
#[inline] #[inline]
......
...@@ -2033,7 +2033,7 @@ impl SourceScope { ...@@ -2033,7 +2033,7 @@ impl SourceScope {
/// Finds the original HirId this MIR item came from. /// Finds the original HirId this MIR item came from.
/// This is necessary after MIR optimizations, as otherwise we get a HirId /// This is necessary after MIR optimizations, as otherwise we get a HirId
/// from the function that was inlined instead of the function call site. /// from the function that was inlined instead of the function call site.
pub fn lint_root( pub fn lint_root<'tcx>(
self, self,
source_scopes: &IndexVec<SourceScope, SourceScopeData<'tcx>>, source_scopes: &IndexVec<SourceScope, SourceScopeData<'tcx>>,
) -> Option<HirId> { ) -> Option<HirId> {
...@@ -2543,7 +2543,7 @@ pub enum ConstantKind<'tcx> { ...@@ -2543,7 +2543,7 @@ pub enum ConstantKind<'tcx> {
Val(interpret::ConstValue<'tcx>, Ty<'tcx>), Val(interpret::ConstValue<'tcx>, Ty<'tcx>),
} }
impl Constant<'tcx> { impl<'tcx> Constant<'tcx> {
pub fn check_static_ptr(&self, tcx: TyCtxt<'_>) -> Option<DefId> { pub fn check_static_ptr(&self, tcx: TyCtxt<'_>) -> Option<DefId> {
match self.literal.const_for_ty()?.val.try_to_scalar() { match self.literal.const_for_ty()?.val.try_to_scalar() {
Some(Scalar::Ptr(ptr, _size)) => match tcx.global_alloc(ptr.provenance) { Some(Scalar::Ptr(ptr, _size)) => match tcx.global_alloc(ptr.provenance) {
...@@ -2562,14 +2562,14 @@ pub fn ty(&self) -> Ty<'tcx> { ...@@ -2562,14 +2562,14 @@ pub fn ty(&self) -> Ty<'tcx> {
} }
} }
impl From<&'tcx ty::Const<'tcx>> for ConstantKind<'tcx> { impl<'tcx> From<&'tcx ty::Const<'tcx>> for ConstantKind<'tcx> {
#[inline] #[inline]
fn from(ct: &'tcx ty::Const<'tcx>) -> Self { fn from(ct: &'tcx ty::Const<'tcx>) -> Self {
Self::Ty(ct) Self::Ty(ct)
} }
} }
impl ConstantKind<'tcx> { impl<'tcx> ConstantKind<'tcx> {
/// Returns `None` if the constant is not trivially safe for use in the type system. /// Returns `None` if the constant is not trivially safe for use in the type system.
pub fn const_for_ty(&self) -> Option<&'tcx ty::Const<'tcx>> { pub fn const_for_ty(&self) -> Option<&'tcx ty::Const<'tcx>> {
match self { match self {
...@@ -2851,7 +2851,7 @@ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result { ...@@ -2851,7 +2851,7 @@ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
} }
} }
fn pretty_print_const( fn pretty_print_const<'tcx>(
c: &ty::Const<'tcx>, c: &ty::Const<'tcx>,
fmt: &mut Formatter<'_>, fmt: &mut Formatter<'_>,
print_types: bool, print_types: bool,
...@@ -2866,7 +2866,7 @@ fn pretty_print_const( ...@@ -2866,7 +2866,7 @@ fn pretty_print_const(
}) })
} }
fn pretty_print_const_value( fn pretty_print_const_value<'tcx>(
val: interpret::ConstValue<'tcx>, val: interpret::ConstValue<'tcx>,
ty: Ty<'tcx>, ty: Ty<'tcx>,
fmt: &mut Formatter<'_>, fmt: &mut Formatter<'_>,
...@@ -2913,12 +2913,12 @@ impl<'a, 'b> graph::GraphSuccessors<'b> for Body<'a> { ...@@ -2913,12 +2913,12 @@ impl<'a, 'b> graph::GraphSuccessors<'b> for Body<'a> {
type Iter = iter::Cloned<Successors<'b>>; type Iter = iter::Cloned<Successors<'b>>;
} }
impl graph::GraphPredecessors<'graph> for Body<'tcx> { impl<'tcx, 'graph> graph::GraphPredecessors<'graph> for Body<'tcx> {
type Item = BasicBlock; type Item = BasicBlock;
type Iter = std::iter::Copied<std::slice::Iter<'graph, BasicBlock>>; type Iter = std::iter::Copied<std::slice::Iter<'graph, BasicBlock>>;
} }
impl graph::WithPredecessors for Body<'tcx> { impl<'tcx> graph::WithPredecessors for Body<'tcx> {
#[inline] #[inline]
fn predecessors(&self, node: Self::Node) -> <Self as graph::GraphPredecessors<'_>>::Iter { fn predecessors(&self, node: Self::Node) -> <Self as graph::GraphPredecessors<'_>>::Iter {
self.predecessors()[node].iter().copied() self.predecessors()[node].iter().copied()
......
...@@ -431,7 +431,7 @@ pub struct CodegenUnitNameBuilder<'tcx> { ...@@ -431,7 +431,7 @@ pub struct CodegenUnitNameBuilder<'tcx> {
cache: FxHashMap<CrateNum, String>, cache: FxHashMap<CrateNum, String>,
} }
impl CodegenUnitNameBuilder<'tcx> { impl<'tcx> CodegenUnitNameBuilder<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>) -> Self { pub fn new(tcx: TyCtxt<'tcx>) -> Self {
CodegenUnitNameBuilder { tcx, cache: Default::default() } CodegenUnitNameBuilder { tcx, cache: Default::default() }
} }
......
...@@ -167,8 +167,8 @@ fn dump_matched_mir_node<'tcx, F>( ...@@ -167,8 +167,8 @@ fn dump_matched_mir_node<'tcx, F>(
/// Returns the file basename portion (without extension) of a filename path /// Returns the file basename portion (without extension) of a filename path
/// where we should dump a MIR representation output files. /// where we should dump a MIR representation output files.
fn dump_file_basename( fn dump_file_basename<'tcx>(
tcx: TyCtxt<'_>, tcx: TyCtxt<'tcx>,
pass_num: Option<&dyn Display>, pass_num: Option<&dyn Display>,
pass_name: &str, pass_name: &str,
disambiguator: &dyn Display, disambiguator: &dyn Display,
...@@ -251,8 +251,8 @@ fn create_dump_file_with_basename( ...@@ -251,8 +251,8 @@ fn create_dump_file_with_basename(
/// bit of MIR-related data. Used by `mir-dump`, but also by other /// bit of MIR-related data. Used by `mir-dump`, but also by other
/// bits of code (e.g., NLL inference) that dump graphviz data or /// bits of code (e.g., NLL inference) that dump graphviz data or
/// other things, and hence takes the extension as an argument. /// other things, and hence takes the extension as an argument.
pub fn create_dump_file( pub fn create_dump_file<'tcx>(
tcx: TyCtxt<'_>, tcx: TyCtxt<'tcx>,
extension: &str, extension: &str,
pass_num: Option<&dyn Display>, pass_num: Option<&dyn Display>,
pass_name: &str, pass_name: &str,
...@@ -419,7 +419,7 @@ struct ExtraComments<'tcx> { ...@@ -419,7 +419,7 @@ struct ExtraComments<'tcx> {
comments: Vec<String>, comments: Vec<String>,
} }
impl ExtraComments<'tcx> { impl<'tcx> ExtraComments<'tcx> {
fn push(&mut self, lines: &str) { fn push(&mut self, lines: &str) {
for line in lines.split('\n') { for line in lines.split('\n') {
self.comments.push(line.to_string()); self.comments.push(line.to_string());
...@@ -427,7 +427,7 @@ fn push(&mut self, lines: &str) { ...@@ -427,7 +427,7 @@ fn push(&mut self, lines: &str) {
} }
} }
fn use_verbose(ty: &&TyS<'tcx>, fn_def: bool) -> bool { fn use_verbose<'tcx>(ty: &&TyS<'tcx>, fn_def: bool) -> bool {
match ty.kind() { match ty.kind() {
ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char | ty::Float(_) => false, ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char | ty::Float(_) => false,
// Unit type // Unit type
...@@ -439,7 +439,7 @@ fn use_verbose(ty: &&TyS<'tcx>, fn_def: bool) -> bool { ...@@ -439,7 +439,7 @@ fn use_verbose(ty: &&TyS<'tcx>, fn_def: bool) -> bool {
} }
} }
impl Visitor<'tcx> for ExtraComments<'tcx> { impl<'tcx> Visitor<'tcx> for ExtraComments<'tcx> {
fn visit_constant(&mut self, constant: &Constant<'tcx>, location: Location) { fn visit_constant(&mut self, constant: &Constant<'tcx>, location: Location) {
self.super_constant(constant, location); self.super_constant(constant, location);
let Constant { span, user_ty, literal } = constant; let Constant { span, user_ty, literal } = constant;
...@@ -762,7 +762,7 @@ fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<Self::BreakTy ...@@ -762,7 +762,7 @@ fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow<Self::BreakTy
/// After the hex dump, an ascii dump follows, replacing all unprintable characters (control /// After the hex dump, an ascii dump follows, replacing all unprintable characters (control
/// characters or characters whose value is larger than 127) with a `.` /// characters or characters whose value is larger than 127) with a `.`
/// This also prints relocations adequately. /// This also prints relocations adequately.
pub fn display_allocation<Tag, Extra>( pub fn display_allocation<'a, 'tcx, Tag, Extra>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
alloc: &'a Allocation<Tag, Extra>, alloc: &'a Allocation<Tag, Extra>,
) -> RenderAllocation<'a, 'tcx, Tag, Extra> { ) -> RenderAllocation<'a, 'tcx, Tag, Extra> {
...@@ -775,7 +775,9 @@ pub struct RenderAllocation<'a, 'tcx, Tag, Extra> { ...@@ -775,7 +775,9 @@ pub struct RenderAllocation<'a, 'tcx, Tag, Extra> {
alloc: &'a Allocation<Tag, Extra>, alloc: &'a Allocation<Tag, Extra>,
} }
impl<Tag: Provenance, Extra> std::fmt::Display for RenderAllocation<'a, 'tcx, Tag, Extra> { impl<'a, 'tcx, Tag: Provenance, Extra> std::fmt::Display
for RenderAllocation<'a, 'tcx, Tag, Extra>
{
fn fmt(&self, w: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, w: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let RenderAllocation { tcx, alloc } = *self; let RenderAllocation { tcx, alloc } = *self;
write!(w, "size: {}, align: {})", alloc.size().bytes(), alloc.align.bytes())?; write!(w, "size: {}, align: {})", alloc.size().bytes(), alloc.align.bytes())?;
...@@ -818,7 +820,7 @@ fn write_allocation_newline( ...@@ -818,7 +820,7 @@ fn write_allocation_newline(
/// The `prefix` argument allows callers to add an arbitrary prefix before each line (even if there /// The `prefix` argument allows callers to add an arbitrary prefix before each line (even if there
/// is only one line). Note that your prefix should contain a trailing space as the lines are /// is only one line). Note that your prefix should contain a trailing space as the lines are
/// printed directly after it. /// printed directly after it.
fn write_allocation_bytes<Tag: Provenance, Extra>( fn write_allocation_bytes<'tcx, Tag: Provenance, Extra>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
alloc: &Allocation<Tag, Extra>, alloc: &Allocation<Tag, Extra>,
w: &mut dyn std::fmt::Write, w: &mut dyn std::fmt::Write,
......
...@@ -300,7 +300,7 @@ pub fn reachable<'a, 'tcx>( ...@@ -300,7 +300,7 @@ pub fn reachable<'a, 'tcx>(
} }
/// Returns a `BitSet` containing all basic blocks reachable from the `START_BLOCK`. /// Returns a `BitSet` containing all basic blocks reachable from the `START_BLOCK`.
pub fn reachable_as_bitset(body: &Body<'tcx>) -> BitSet<BasicBlock> { pub fn reachable_as_bitset<'tcx>(body: &Body<'tcx>) -> BitSet<BasicBlock> {
let mut iter = preorder(body); let mut iter = preorder(body);
(&mut iter).for_each(drop); (&mut iter).for_each(drop);
iter.visited iter.visited
......
...@@ -965,7 +965,7 @@ fn super_place( ...@@ -965,7 +965,7 @@ fn super_place(
} }
} }
fn process_projection( fn process_projection<'a>(
&mut self, &mut self,
projection: &'a [PlaceElem<'tcx>], projection: &'a [PlaceElem<'tcx>],
location: Location, location: Location,
......
...@@ -101,7 +101,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -101,7 +101,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
} }
} }
impl Deref for ObligationCause<'tcx> { impl<'tcx> Deref for ObligationCause<'tcx> {
type Target = ObligationCauseData<'tcx>; type Target = ObligationCauseData<'tcx>;
#[inline(always)] #[inline(always)]
......
...@@ -216,7 +216,7 @@ pub fn leaf_def( ...@@ -216,7 +216,7 @@ pub fn leaf_def(
/// ///
/// Returns `Err` if an error was reported while building the specialization /// Returns `Err` if an error was reported while building the specialization
/// graph. /// graph.
pub fn ancestors( pub fn ancestors<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
trait_def_id: DefId, trait_def_id: DefId,
start_from_impl: DefId, start_from_impl: DefId,
......
...@@ -74,7 +74,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -74,7 +74,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
} }
} }
impl<N: fmt::Debug> fmt::Debug for traits::ImplSourceTraitUpcastingData<'tcx, N> { impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceTraitUpcastingData<'tcx, N> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!( write!(
f, f,
......
...@@ -23,13 +23,13 @@ pub struct Match<'tcx> { ...@@ -23,13 +23,13 @@ pub struct Match<'tcx> {
param_env: ty::ParamEnv<'tcx>, param_env: ty::ParamEnv<'tcx>,
} }
impl Match<'tcx> { impl<'tcx> Match<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Match<'tcx> { pub fn new(tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Match<'tcx> {
Match { tcx, param_env } Match { tcx, param_env }
} }
} }
impl TypeRelation<'tcx> for Match<'tcx> { impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
fn tag(&self) -> &'static str { fn tag(&self) -> &'static str {
"Match" "Match"
} }
......
...@@ -83,7 +83,7 @@ pub struct Adjustment<'tcx> { ...@@ -83,7 +83,7 @@ pub struct Adjustment<'tcx> {
pub target: Ty<'tcx>, pub target: Ty<'tcx>,
} }
impl Adjustment<'tcx> { impl<'tcx> Adjustment<'tcx> {
pub fn is_region_borrow(&self) -> bool { pub fn is_region_borrow(&self) -> bool {
matches!(self.kind, Adjust::Borrow(AutoBorrow::Ref(..))) matches!(self.kind, Adjust::Borrow(AutoBorrow::Ref(..)))
} }
......
...@@ -139,7 +139,7 @@ pub fn filter_by_name_unhygienic( ...@@ -139,7 +139,7 @@ pub fn filter_by_name_unhygienic(
/// Multiple items may have the same name if they are in different `Namespace`s. For example, /// Multiple items may have the same name if they are in different `Namespace`s. For example,
/// an associated type can have the same name as a method. Use one of the `find_by_name_and_*` /// an associated type can have the same name as a method. Use one of the `find_by_name_and_*`
/// methods below if you know which item you are looking for. /// methods below if you know which item you are looking for.
pub fn filter_by_name( pub fn filter_by_name<'a>(
&'a self, &'a self,
tcx: TyCtxt<'a>, tcx: TyCtxt<'a>,
ident: Ident, ident: Ident,
......
...@@ -156,7 +156,7 @@ pub struct CapturedPlace<'tcx> { ...@@ -156,7 +156,7 @@ pub struct CapturedPlace<'tcx> {
pub mutability: hir::Mutability, pub mutability: hir::Mutability,
} }
impl CapturedPlace<'tcx> { impl<'tcx> CapturedPlace<'tcx> {
pub fn to_string(&self, tcx: TyCtxt<'tcx>) -> String { pub fn to_string(&self, tcx: TyCtxt<'tcx>) -> String {
place_to_string_for_capture(tcx, &self.place) place_to_string_for_capture(tcx, &self.place)
} }
...@@ -328,7 +328,7 @@ pub struct CaptureInfo<'tcx> { ...@@ -328,7 +328,7 @@ pub struct CaptureInfo<'tcx> {
pub capture_kind: UpvarCapture<'tcx>, pub capture_kind: UpvarCapture<'tcx>,
} }
pub fn place_to_string_for_capture(tcx: TyCtxt<'tcx>, place: &HirPlace<'tcx>) -> String { pub fn place_to_string_for_capture<'tcx>(tcx: TyCtxt<'tcx>, place: &HirPlace<'tcx>) -> String {
let mut curr_string: String = match place.base { let mut curr_string: String = match place.base {
HirPlaceBase::Upvar(upvar_id) => tcx.hir().name(upvar_id.var_path.hir_id).to_string(), HirPlaceBase::Upvar(upvar_id) => tcx.hir().name(upvar_id.var_path.hir_id).to_string(),
_ => bug!("Capture_information should only contain upvars"), _ => bug!("Capture_information should only contain upvars"),
......
...@@ -76,7 +76,11 @@ pub trait RefDecodable<'tcx, D: TyDecoder<'tcx>> { ...@@ -76,7 +76,11 @@ pub trait RefDecodable<'tcx, D: TyDecoder<'tcx>> {
} }
/// Encode the given value or a previously cached shorthand. /// Encode the given value or a previously cached shorthand.
pub fn encode_with_shorthand<E, T, M>(encoder: &mut E, value: &T, cache: M) -> Result<(), E::Error> pub fn encode_with_shorthand<'tcx, E, T, M>(
encoder: &mut E,
value: &T,
cache: M,
) -> Result<(), E::Error>
where where
E: TyEncoder<'tcx>, E: TyEncoder<'tcx>,
M: for<'b> Fn(&'b mut E) -> &'b mut FxHashMap<T, usize>, M: for<'b> Fn(&'b mut E) -> &'b mut FxHashMap<T, usize>,
......
...@@ -234,7 +234,7 @@ pub fn to_bits(self, target_size: Size) -> Result<u128, Size> { ...@@ -234,7 +234,7 @@ pub fn to_bits(self, target_size: Size) -> Result<u128, Size> {
} }
#[inline] #[inline]
pub fn try_to_machine_usize(&self, tcx: TyCtxt<'tcx>) -> Result<u64, Size> { pub fn try_to_machine_usize<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Result<u64, Size> {
Ok(self.to_bits(tcx.data_layout.pointer_size)? as u64) Ok(self.to_bits(tcx.data_layout.pointer_size)? as u64)
} }
} }
......
...@@ -27,7 +27,7 @@ pub enum ValTree<'tcx> { ...@@ -27,7 +27,7 @@ pub enum ValTree<'tcx> {
Branch(&'tcx [ValTree<'tcx>]), Branch(&'tcx [ValTree<'tcx>]),
} }
impl ValTree<'tcx> { impl<'tcx> ValTree<'tcx> {
pub fn zst() -> Self { pub fn zst() -> Self {
Self::Branch(&[]) Self::Branch(&[])
} }
......
...@@ -824,7 +824,7 @@ pub struct CanonicalUserTypeAnnotation<'tcx> { ...@@ -824,7 +824,7 @@ pub struct CanonicalUserTypeAnnotation<'tcx> {
/// Canonicalized user type annotation. /// Canonicalized user type annotation.
pub type CanonicalUserType<'tcx> = Canonical<'tcx, UserType<'tcx>>; pub type CanonicalUserType<'tcx> = Canonical<'tcx, UserType<'tcx>>;
impl CanonicalUserType<'tcx> { impl<'tcx> CanonicalUserType<'tcx> {
/// Returns `true` if this represents a substitution of the form `[?0, ?1, ?2]`, /// Returns `true` if this represents a substitution of the form `[?0, ?1, ?2]`,
/// i.e., each thing is mapped to a canonical variable with the same index. /// i.e., each thing is mapped to a canonical variable with the same index.
pub fn is_identity(&self) -> bool { pub fn is_identity(&self) -> bool {
...@@ -1893,7 +1893,7 @@ impl<'tcx> TyCtxt<'tcx> { ...@@ -1893,7 +1893,7 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn debug_stats(self) -> impl std::fmt::Debug + 'tcx { pub fn debug_stats(self) -> impl std::fmt::Debug + 'tcx {
struct DebugStats<'tcx>(TyCtxt<'tcx>); struct DebugStats<'tcx>(TyCtxt<'tcx>);
impl std::fmt::Debug for DebugStats<'tcx> { impl<'tcx> std::fmt::Debug for DebugStats<'tcx> {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
sty_debug_print!( sty_debug_print!(
fmt, fmt,
...@@ -2711,7 +2711,7 @@ pub fn is_const_fn(self, def_id: DefId) -> bool { ...@@ -2711,7 +2711,7 @@ pub fn is_const_fn(self, def_id: DefId) -> bool {
} }
} }
impl TyCtxtAt<'tcx> { impl<'tcx> TyCtxtAt<'tcx> {
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` to ensure it gets used. /// Constructs a `TyKind::Error` type and registers a `delay_span_bug` to ensure it gets used.
#[track_caller] #[track_caller]
pub fn ty_error(self) -> Ty<'tcx> { pub fn ty_error(self) -> Ty<'tcx> {
......
...@@ -37,7 +37,7 @@ struct RegionEraserVisitor<'tcx> { ...@@ -37,7 +37,7 @@ struct RegionEraserVisitor<'tcx> {
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
} }
impl TypeFolder<'tcx> for RegionEraserVisitor<'tcx> { impl<'tcx> TypeFolder<'tcx> for RegionEraserVisitor<'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> { fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.tcx self.tcx
} }
......
...@@ -22,7 +22,7 @@ pub fn for_kind(kind: &ty::TyKind<'_>) -> FlagComputation { ...@@ -22,7 +22,7 @@ pub fn for_kind(kind: &ty::TyKind<'_>) -> FlagComputation {
result result
} }
pub fn for_predicate(binder: ty::Binder<'tcx, ty::PredicateKind<'_>>) -> FlagComputation { pub fn for_predicate<'tcx>(binder: ty::Binder<'tcx, ty::PredicateKind<'_>>) -> FlagComputation {
let mut result = FlagComputation::new(); let mut result = FlagComputation::new();
result.add_predicate(binder); result.add_predicate(binder);
result result
...@@ -216,7 +216,7 @@ fn add_kind(&mut self, kind: &ty::TyKind<'_>) { ...@@ -216,7 +216,7 @@ fn add_kind(&mut self, kind: &ty::TyKind<'_>) {
} }
} }
fn add_predicate(&mut self, binder: ty::Binder<'tcx, ty::PredicateKind<'_>>) { fn add_predicate(&mut self, binder: ty::Binder<'_, ty::PredicateKind<'_>>) {
self.bound_computation(binder, |computation, atom| computation.add_predicate_atom(atom)); self.bound_computation(binder, |computation, atom| computation.add_predicate_atom(atom));
} }
...@@ -310,7 +310,7 @@ fn add_const(&mut self, c: &ty::Const<'_>) { ...@@ -310,7 +310,7 @@ fn add_const(&mut self, c: &ty::Const<'_>) {
} }
} }
fn add_unevaluated_const<P>(&mut self, ct: ty::Unevaluated<'tcx, P>) { fn add_unevaluated_const<P>(&mut self, ct: ty::Unevaluated<'_, P>) {
// The generic arguments of unevaluated consts are a bit special, // The generic arguments of unevaluated consts are a bit special,
// see the `rustc-dev-guide` for more information. // see the `rustc-dev-guide` for more information.
// //
......
...@@ -199,7 +199,7 @@ fn still_further_specializable(&self) -> bool { ...@@ -199,7 +199,7 @@ fn still_further_specializable(&self) -> bool {
} }
} }
impl TypeFoldable<'tcx> for hir::Constness { impl<'tcx> TypeFoldable<'tcx> for hir::Constness {
fn try_super_fold_with<F: TypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> { fn try_super_fold_with<F: TypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> {
Ok(self) Ok(self)
} }
...@@ -1060,13 +1060,13 @@ struct Shifter<'tcx> { ...@@ -1060,13 +1060,13 @@ struct Shifter<'tcx> {
amount: u32, amount: u32,
} }
impl Shifter<'tcx> { impl<'tcx> Shifter<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>, amount: u32) -> Self { pub fn new(tcx: TyCtxt<'tcx>, amount: u32) -> Self {
Shifter { tcx, current_index: ty::INNERMOST, amount } Shifter { tcx, current_index: ty::INNERMOST, amount }
} }
} }
impl TypeFolder<'tcx> for Shifter<'tcx> { impl<'tcx> TypeFolder<'tcx> for Shifter<'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> { fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.tcx self.tcx
} }
...@@ -1257,7 +1257,7 @@ struct HasTypeFlagsVisitor<'tcx> { ...@@ -1257,7 +1257,7 @@ struct HasTypeFlagsVisitor<'tcx> {
flags: ty::TypeFlags, flags: ty::TypeFlags,
} }
impl std::fmt::Debug for HasTypeFlagsVisitor<'tcx> { impl<'tcx> std::fmt::Debug for HasTypeFlagsVisitor<'tcx> {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.flags.fmt(fmt) self.flags.fmt(fmt)
} }
...@@ -1454,7 +1454,7 @@ struct LateBoundRegionsCollector<'tcx> { ...@@ -1454,7 +1454,7 @@ struct LateBoundRegionsCollector<'tcx> {
just_constrained: bool, just_constrained: bool,
} }
impl LateBoundRegionsCollector<'tcx> { impl<'tcx> LateBoundRegionsCollector<'tcx> {
fn new(tcx: TyCtxt<'tcx>, just_constrained: bool) -> Self { fn new(tcx: TyCtxt<'tcx>, just_constrained: bool) -> Self {
LateBoundRegionsCollector { LateBoundRegionsCollector {
tcx, tcx,
......
...@@ -30,7 +30,7 @@ pub enum DefIdForest { ...@@ -30,7 +30,7 @@ pub enum DefIdForest {
/// Tests whether a slice of roots contains a given DefId. /// Tests whether a slice of roots contains a given DefId.
#[inline] #[inline]
fn slice_contains(tcx: TyCtxt<'tcx>, slice: &[DefId], id: DefId) -> bool { fn slice_contains<'tcx>(tcx: TyCtxt<'tcx>, slice: &[DefId], id: DefId) -> bool {
slice.iter().any(|root_id| tcx.is_descendant_of(id, *root_id)) slice.iter().any(|root_id| tcx.is_descendant_of(id, *root_id))
} }
......
...@@ -635,7 +635,7 @@ struct PolymorphizationFolder<'tcx> { ...@@ -635,7 +635,7 @@ struct PolymorphizationFolder<'tcx> {
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
} }
impl ty::TypeFolder<'tcx> for PolymorphizationFolder<'tcx> { impl<'tcx> ty::TypeFolder<'tcx> for PolymorphizationFolder<'tcx> {
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> { fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
self.tcx self.tcx
} }
......
...@@ -168,7 +168,7 @@ fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { ...@@ -168,7 +168,7 @@ fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
/// Return an *integer* type matching this primitive. /// Return an *integer* type matching this primitive.
/// Useful in particular when dealing with enum discriminants. /// Useful in particular when dealing with enum discriminants.
#[inline] #[inline]
fn to_int_ty(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { fn to_int_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
match *self { match *self {
Int(i, signed) => i.to_ty(tcx, signed), Int(i, signed) => i.to_ty(tcx, signed),
Pointer => tcx.types.usize, Pointer => tcx.types.usize,
...@@ -2195,9 +2195,9 @@ fn spanned_layout_of(&self, ty: Ty<'tcx>, span: Span) -> Self::LayoutOfResult { ...@@ -2195,9 +2195,9 @@ fn spanned_layout_of(&self, ty: Ty<'tcx>, span: Span) -> Self::LayoutOfResult {
} }
} }
impl<C: LayoutOfHelpers<'tcx>> LayoutOf<'tcx> for C {} impl<'tcx, C: LayoutOfHelpers<'tcx>> LayoutOf<'tcx> for C {}
impl LayoutOfHelpers<'tcx> for LayoutCx<'tcx, TyCtxt<'tcx>> { impl<'tcx> LayoutOfHelpers<'tcx> for LayoutCx<'tcx, TyCtxt<'tcx>> {
type LayoutOfResult = Result<TyAndLayout<'tcx>, LayoutError<'tcx>>; type LayoutOfResult = Result<TyAndLayout<'tcx>, LayoutError<'tcx>>;
#[inline] #[inline]
...@@ -2206,7 +2206,7 @@ fn handle_layout_err(&self, err: LayoutError<'tcx>, _: Span, _: Ty<'tcx>) -> Lay ...@@ -2206,7 +2206,7 @@ fn handle_layout_err(&self, err: LayoutError<'tcx>, _: Span, _: Ty<'tcx>) -> Lay
} }
} }
impl LayoutOfHelpers<'tcx> for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> { impl<'tcx> LayoutOfHelpers<'tcx> for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> {
type LayoutOfResult = Result<TyAndLayout<'tcx>, LayoutError<'tcx>>; type LayoutOfResult = Result<TyAndLayout<'tcx>, LayoutError<'tcx>>;
#[inline] #[inline]
...@@ -2282,7 +2282,7 @@ enum TyMaybeWithLayout<'tcx> { ...@@ -2282,7 +2282,7 @@ enum TyMaybeWithLayout<'tcx> {
TyAndLayout(TyAndLayout<'tcx>), TyAndLayout(TyAndLayout<'tcx>),
} }
fn field_ty_or_layout( fn field_ty_or_layout<'tcx>(
this: TyAndLayout<'tcx>, this: TyAndLayout<'tcx>,
cx: &(impl HasTyCtxt<'tcx> + HasParamEnv<'tcx>), cx: &(impl HasTyCtxt<'tcx> + HasParamEnv<'tcx>),
i: usize, i: usize,
...@@ -2724,7 +2724,7 @@ fn fn_sig_for_fn_abi(&self, tcx: TyCtxt<'tcx>) -> ty::PolyFnSig<'tcx> { ...@@ -2724,7 +2724,7 @@ fn fn_sig_for_fn_abi(&self, tcx: TyCtxt<'tcx>) -> ty::PolyFnSig<'tcx> {
/// with `-Cpanic=abort` will look like they can't unwind when in fact they /// with `-Cpanic=abort` will look like they can't unwind when in fact they
/// might (from a foreign exception or similar). /// might (from a foreign exception or similar).
#[inline] #[inline]
pub fn fn_can_unwind( pub fn fn_can_unwind<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
codegen_fn_attr_flags: CodegenFnAttrFlags, codegen_fn_attr_flags: CodegenFnAttrFlags,
abi: SpecAbi, abi: SpecAbi,
...@@ -2842,7 +2842,7 @@ pub enum FnAbiError<'tcx> { ...@@ -2842,7 +2842,7 @@ pub enum FnAbiError<'tcx> {
AdjustForForeignAbi(call::AdjustForForeignAbiError), AdjustForForeignAbi(call::AdjustForForeignAbiError),
} }
impl From<LayoutError<'tcx>> for FnAbiError<'tcx> { impl<'tcx> From<LayoutError<'tcx>> for FnAbiError<'tcx> {
fn from(err: LayoutError<'tcx>) -> Self { fn from(err: LayoutError<'tcx>) -> Self {
Self::Layout(err) Self::Layout(err)
} }
...@@ -2942,7 +2942,7 @@ fn fn_abi_of_instance( ...@@ -2942,7 +2942,7 @@ fn fn_abi_of_instance(
} }
} }
impl<C: FnAbiOfHelpers<'tcx>> FnAbiOf<'tcx> for C {} impl<'tcx, C: FnAbiOfHelpers<'tcx>> FnAbiOf<'tcx> for C {}
fn fn_abi_of_fn_ptr<'tcx>( fn fn_abi_of_fn_ptr<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
......
...@@ -852,7 +852,7 @@ pub trait ToPredicate<'tcx> { ...@@ -852,7 +852,7 @@ pub trait ToPredicate<'tcx> {
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx>; fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx>;
} }
impl ToPredicate<'tcx> for Binder<'tcx, PredicateKind<'tcx>> { impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, PredicateKind<'tcx>> {
#[inline(always)] #[inline(always)]
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> { fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
tcx.mk_predicate(self) tcx.mk_predicate(self)
...@@ -1418,7 +1418,7 @@ pub fn and<T: TypeFoldable<'tcx>>(self, value: T) -> ParamEnvAnd<'tcx, T> { ...@@ -1418,7 +1418,7 @@ pub fn and<T: TypeFoldable<'tcx>>(self, value: T) -> ParamEnvAnd<'tcx, T> {
// FIXME(ecstaticmorse): Audit all occurrences of `without_const().to_predicate(tcx)` to ensure that // FIXME(ecstaticmorse): Audit all occurrences of `without_const().to_predicate(tcx)` to ensure that
// the constness of trait bounds is being propagated correctly. // the constness of trait bounds is being propagated correctly.
impl PolyTraitRef<'tcx> { impl<'tcx> PolyTraitRef<'tcx> {
#[inline] #[inline]
pub fn with_constness(self, constness: BoundConstness) -> PolyTraitPredicate<'tcx> { pub fn with_constness(self, constness: BoundConstness) -> PolyTraitPredicate<'tcx> {
self.map_bound(|trait_ref| ty::TraitPredicate { self.map_bound(|trait_ref| ty::TraitPredicate {
......
...@@ -183,7 +183,7 @@ fn normalize_generic_arg_after_erasing_regions( ...@@ -183,7 +183,7 @@ fn normalize_generic_arg_after_erasing_regions(
} }
} }
impl TypeFolder<'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> { impl<'tcx> TypeFolder<'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> { fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx self.tcx
} }
...@@ -228,7 +228,7 @@ fn try_normalize_generic_arg_after_erasing_regions( ...@@ -228,7 +228,7 @@ fn try_normalize_generic_arg_after_erasing_regions(
} }
} }
impl TypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> { impl<'tcx> TypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> {
type Error = NormalizationError<'tcx>; type Error = NormalizationError<'tcx>;
fn tcx(&self) -> TyCtxt<'tcx> { fn tcx(&self) -> TyCtxt<'tcx> {
...@@ -236,7 +236,7 @@ fn tcx(&self) -> TyCtxt<'tcx> { ...@@ -236,7 +236,7 @@ fn tcx(&self) -> TyCtxt<'tcx> {
} }
} }
impl FallibleTypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> { impl<'tcx> FallibleTypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> {
fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> { fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> {
match self.try_normalize_generic_arg_after_erasing_regions(ty.into()) { match self.try_normalize_generic_arg_after_erasing_regions(ty.into()) {
Ok(t) => Ok(t.expect_ty()), Ok(t) => Ok(t.expect_ty()),
......
...@@ -37,7 +37,7 @@ pub trait Printer<'tcx>: Sized { ...@@ -37,7 +37,7 @@ pub trait Printer<'tcx>: Sized {
type DynExistential; type DynExistential;
type Const; type Const;
fn tcx(&'a self) -> TyCtxt<'tcx>; fn tcx<'a>(&'a self) -> TyCtxt<'tcx>;
fn print_def_path( fn print_def_path(
self, self,
......
...@@ -1513,7 +1513,7 @@ pub struct FmtPrinterData<'a, 'tcx, F> { ...@@ -1513,7 +1513,7 @@ pub struct FmtPrinterData<'a, 'tcx, F> {
pub name_resolver: Option<Box<&'a dyn Fn(ty::TyVid) -> Option<String>>>, pub name_resolver: Option<Box<&'a dyn Fn(ty::TyVid) -> Option<String>>>,
} }
impl<F> Deref for FmtPrinter<'a, 'tcx, F> { impl<'a, 'tcx, F> Deref for FmtPrinter<'a, 'tcx, F> {
type Target = FmtPrinterData<'a, 'tcx, F>; type Target = FmtPrinterData<'a, 'tcx, F>;
fn deref(&self) -> &Self::Target { fn deref(&self) -> &Self::Target {
&self.0 &self.0
...@@ -1526,7 +1526,7 @@ fn deref_mut(&mut self) -> &mut Self::Target { ...@@ -1526,7 +1526,7 @@ fn deref_mut(&mut self) -> &mut Self::Target {
} }
} }
impl<F> FmtPrinter<'a, 'tcx, F> { impl<'a, 'tcx, F> FmtPrinter<'a, 'tcx, F> {
pub fn new(tcx: TyCtxt<'tcx>, fmt: F, ns: Namespace) -> Self { pub fn new(tcx: TyCtxt<'tcx>, fmt: F, ns: Namespace) -> Self {
FmtPrinter(Box::new(FmtPrinterData { FmtPrinter(Box::new(FmtPrinterData {
tcx, tcx,
...@@ -1563,7 +1563,7 @@ fn guess_def_namespace(tcx: TyCtxt<'_>, def_id: DefId) -> Namespace { ...@@ -1563,7 +1563,7 @@ fn guess_def_namespace(tcx: TyCtxt<'_>, def_id: DefId) -> Namespace {
} }
} }
impl TyCtxt<'t> { impl<'t> TyCtxt<'t> {
/// Returns a string identifying this `DefId`. This string is /// Returns a string identifying this `DefId`. This string is
/// suitable for user output. /// suitable for user output.
pub fn def_path_str(self, def_id: DefId) -> String { pub fn def_path_str(self, def_id: DefId) -> String {
...@@ -1585,7 +1585,7 @@ fn write_str(&mut self, s: &str) -> fmt::Result { ...@@ -1585,7 +1585,7 @@ fn write_str(&mut self, s: &str) -> fmt::Result {
} }
} }
impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> { impl<'tcx, F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
type Error = fmt::Error; type Error = fmt::Error;
type Path = Self; type Path = Self;
...@@ -1594,7 +1594,7 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> { ...@@ -1594,7 +1594,7 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
type DynExistential = Self; type DynExistential = Self;
type Const = Self; type Const = Self;
fn tcx(&'a self) -> TyCtxt<'tcx> { fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
self.tcx self.tcx
} }
...@@ -1792,7 +1792,7 @@ fn path_generic_args( ...@@ -1792,7 +1792,7 @@ fn path_generic_args(
} }
} }
impl<F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> { impl<'tcx, F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
fn infer_ty_name(&self, id: ty::TyVid) -> Option<String> { fn infer_ty_name(&self, id: ty::TyVid) -> Option<String> {
self.0.name_resolver.as_ref().and_then(|func| func(id)) self.0.name_resolver.as_ref().and_then(|func| func(id))
} }
...@@ -2058,7 +2058,7 @@ fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> { ...@@ -2058,7 +2058,7 @@ fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
// HACK(eddyb) limited to `FmtPrinter` because of `binder_depth`, // HACK(eddyb) limited to `FmtPrinter` because of `binder_depth`,
// `region_index` and `used_region_names`. // `region_index` and `used_region_names`.
impl<F: fmt::Write> FmtPrinter<'_, 'tcx, F> { impl<'tcx, F: fmt::Write> FmtPrinter<'_, 'tcx, F> {
pub fn name_all_regions<T>( pub fn name_all_regions<T>(
mut self, mut self,
value: &ty::Binder<'tcx, T>, value: &ty::Binder<'tcx, T>,
...@@ -2312,7 +2312,8 @@ fn print(&self, mut cx: P) -> Result<Self::Output, Self::Error> { ...@@ -2312,7 +2312,8 @@ fn print(&self, mut cx: P) -> Result<Self::Output, Self::Error> {
macro_rules! forward_display_to_print { macro_rules! forward_display_to_print {
($($ty:ty),+) => { ($($ty:ty),+) => {
$(impl fmt::Display for $ty { // Some of the $ty arguments may not actually use 'tcx
$(#[allow(unused_lifetimes)] impl<'tcx> fmt::Display for $ty {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| { ty::tls::with(|tcx| {
tcx.lift(*self) tcx.lift(*self)
...@@ -2360,7 +2361,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -2360,7 +2361,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[derive(Copy, Clone, TypeFoldable, Lift)] #[derive(Copy, Clone, TypeFoldable, Lift)]
pub struct TraitRefPrintOnlyTraitPath<'tcx>(ty::TraitRef<'tcx>); pub struct TraitRefPrintOnlyTraitPath<'tcx>(ty::TraitRef<'tcx>);
impl fmt::Debug for TraitRefPrintOnlyTraitPath<'tcx> { impl<'tcx> fmt::Debug for TraitRefPrintOnlyTraitPath<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f) fmt::Display::fmt(self, f)
} }
...@@ -2372,13 +2373,13 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -2372,13 +2373,13 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[derive(Copy, Clone, TypeFoldable, Lift)] #[derive(Copy, Clone, TypeFoldable, Lift)]
pub struct TraitRefPrintOnlyTraitName<'tcx>(ty::TraitRef<'tcx>); pub struct TraitRefPrintOnlyTraitName<'tcx>(ty::TraitRef<'tcx>);
impl fmt::Debug for TraitRefPrintOnlyTraitName<'tcx> { impl<'tcx> fmt::Debug for TraitRefPrintOnlyTraitName<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f) fmt::Display::fmt(self, f)
} }
} }
impl ty::TraitRef<'tcx> { impl<'tcx> ty::TraitRef<'tcx> {
pub fn print_only_trait_path(self) -> TraitRefPrintOnlyTraitPath<'tcx> { pub fn print_only_trait_path(self) -> TraitRefPrintOnlyTraitPath<'tcx> {
TraitRefPrintOnlyTraitPath(self) TraitRefPrintOnlyTraitPath(self)
} }
...@@ -2388,7 +2389,7 @@ pub fn print_only_trait_name(self) -> TraitRefPrintOnlyTraitName<'tcx> { ...@@ -2388,7 +2389,7 @@ pub fn print_only_trait_name(self) -> TraitRefPrintOnlyTraitName<'tcx> {
} }
} }
impl ty::Binder<'tcx, ty::TraitRef<'tcx>> { impl<'tcx> ty::Binder<'tcx, ty::TraitRef<'tcx>> {
pub fn print_only_trait_path(self) -> ty::Binder<'tcx, TraitRefPrintOnlyTraitPath<'tcx>> { pub fn print_only_trait_path(self) -> ty::Binder<'tcx, TraitRefPrintOnlyTraitPath<'tcx>> {
self.map_bound(|tr| tr.print_only_trait_path()) self.map_bound(|tr| tr.print_only_trait_path())
} }
......
...@@ -69,7 +69,7 @@ pub struct TyCtxtAt<'tcx> { ...@@ -69,7 +69,7 @@ pub struct TyCtxtAt<'tcx> {
pub span: Span, pub span: Span,
} }
impl Deref for TyCtxtAt<'tcx> { impl<'tcx> Deref for TyCtxtAt<'tcx> {
type Target = TyCtxt<'tcx>; type Target = TyCtxt<'tcx>;
#[inline(always)] #[inline(always)]
fn deref(&self) -> &Self::Target { fn deref(&self) -> &Self::Target {
...@@ -82,7 +82,7 @@ pub struct TyCtxtEnsure<'tcx> { ...@@ -82,7 +82,7 @@ pub struct TyCtxtEnsure<'tcx> {
pub tcx: TyCtxt<'tcx>, pub tcx: TyCtxt<'tcx>,
} }
impl TyCtxt<'tcx> { impl<'tcx> TyCtxt<'tcx> {
/// Returns a transparent wrapper for `TyCtxt`, which ensures queries /// Returns a transparent wrapper for `TyCtxt`, which ensures queries
/// are executed instead of just returning their results. /// are executed instead of just returning their results.
#[inline(always)] #[inline(always)]
...@@ -207,7 +207,7 @@ pub struct QueryCaches<$tcx> { ...@@ -207,7 +207,7 @@ pub struct QueryCaches<$tcx> {
$($(#[$attr])* pub $name: QueryCacheStore<query_storage::$name<$tcx>>,)* $($(#[$attr])* pub $name: QueryCacheStore<query_storage::$name<$tcx>>,)*
} }
impl TyCtxtEnsure<$tcx> { impl<$tcx> TyCtxtEnsure<$tcx> {
$($(#[$attr])* $($(#[$attr])*
#[inline(always)] #[inline(always)]
pub fn $name(self, key: query_helper_param_ty!($($K)*)) { pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
...@@ -225,7 +225,7 @@ pub fn $name(self, key: query_helper_param_ty!($($K)*)) { ...@@ -225,7 +225,7 @@ pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
})* })*
} }
impl TyCtxt<$tcx> { impl<$tcx> TyCtxt<$tcx> {
$($(#[$attr])* $($(#[$attr])*
#[inline(always)] #[inline(always)]
#[must_use] #[must_use]
...@@ -235,7 +235,7 @@ pub fn $name(self, key: query_helper_param_ty!($($K)*)) -> query_stored::$name<$ ...@@ -235,7 +235,7 @@ pub fn $name(self, key: query_helper_param_ty!($($K)*)) -> query_stored::$name<$
})* })*
} }
impl TyCtxtAt<$tcx> { impl<$tcx> TyCtxtAt<$tcx> {
$($(#[$attr])* $($(#[$attr])*
#[inline(always)] #[inline(always)]
pub fn $name(self, key: query_helper_param_ty!($($K)*)) -> query_stored::$name<$tcx> pub fn $name(self, key: query_helper_param_ty!($($K)*)) -> query_stored::$name<$tcx>
...@@ -357,7 +357,7 @@ fn into_query_param(self) -> DefId { ...@@ -357,7 +357,7 @@ fn into_query_param(self) -> DefId {
use sealed::IntoQueryParam; use sealed::IntoQueryParam;
impl TyCtxt<'tcx> { impl<'tcx> TyCtxt<'tcx> {
pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind { pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind {
let def_id = def_id.into_query_param(); let def_id = def_id.into_query_param();
self.opt_def_kind(def_id) self.opt_def_kind(def_id)
...@@ -365,7 +365,7 @@ pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind { ...@@ -365,7 +365,7 @@ pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind {
} }
} }
impl TyCtxtAt<'tcx> { impl<'tcx> TyCtxtAt<'tcx> {
pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind { pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind {
let def_id = def_id.into_query_param(); let def_id = def_id.into_query_param();
self.opt_def_kind(def_id) self.opt_def_kind(def_id)
......
...@@ -132,7 +132,7 @@ pub fn relate_type_and_mut<'tcx, R: TypeRelation<'tcx>>( ...@@ -132,7 +132,7 @@ pub fn relate_type_and_mut<'tcx, R: TypeRelation<'tcx>>(
} }
} }
pub fn relate_substs<R: TypeRelation<'tcx>>( pub fn relate_substs<'tcx, R: TypeRelation<'tcx>>(
relation: &mut R, relation: &mut R,
variances: Option<&[ty::Variance]>, variances: Option<&[ty::Variance]>,
a_subst: SubstsRef<'tcx>, a_subst: SubstsRef<'tcx>,
...@@ -353,7 +353,7 @@ fn relate<R: TypeRelation<'tcx>>( ...@@ -353,7 +353,7 @@ fn relate<R: TypeRelation<'tcx>>(
/// The main "type relation" routine. Note that this does not handle /// The main "type relation" routine. Note that this does not handle
/// inference artifacts, so you should filter those out before calling /// inference artifacts, so you should filter those out before calling
/// it. /// it.
pub fn super_relate_tys<R: TypeRelation<'tcx>>( pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
relation: &mut R, relation: &mut R,
a: Ty<'tcx>, a: Ty<'tcx>,
b: Ty<'tcx>, b: Ty<'tcx>,
...@@ -526,7 +526,7 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>( ...@@ -526,7 +526,7 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
/// The main "const relation" routine. Note that this does not handle /// The main "const relation" routine. Note that this does not handle
/// inference artifacts, so you should filter those out before calling /// inference artifacts, so you should filter those out before calling
/// it. /// it.
pub fn super_relate_consts<R: TypeRelation<'tcx>>( pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
relation: &mut R, relation: &mut R,
a: &'tcx ty::Const<'tcx>, a: &'tcx ty::Const<'tcx>,
b: &'tcx ty::Const<'tcx>, b: &'tcx ty::Const<'tcx>,
...@@ -599,7 +599,7 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>( ...@@ -599,7 +599,7 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
if is_match { Ok(a) } else { Err(TypeError::ConstMismatch(expected_found(relation, a, b))) } if is_match { Ok(a) } else { Err(TypeError::ConstMismatch(expected_found(relation, a, b))) }
} }
fn check_const_value_eq<R: TypeRelation<'tcx>>( fn check_const_value_eq<'tcx, R: TypeRelation<'tcx>>(
relation: &mut R, relation: &mut R,
a_val: ConstValue<'tcx>, a_val: ConstValue<'tcx>,
b_val: ConstValue<'tcx>, b_val: ConstValue<'tcx>,
...@@ -832,7 +832,7 @@ fn relate<R: TypeRelation<'tcx>>( ...@@ -832,7 +832,7 @@ fn relate<R: TypeRelation<'tcx>>(
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Error handling // Error handling
pub fn expected_found<R, T>(relation: &mut R, a: T, b: T) -> ExpectedFound<T> pub fn expected_found<'tcx, R, T>(relation: &mut R, a: T, b: T) -> ExpectedFound<T>
where where
R: TypeRelation<'tcx>, R: TypeRelation<'tcx>,
{ {
......
...@@ -47,19 +47,19 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -47,19 +47,19 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
} }
} }
impl fmt::Debug for ty::UpvarBorrow<'tcx> { 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) write!(f, "UpvarBorrow({:?}, {:?})", self.kind, self.region)
} }
} }
impl fmt::Debug for ty::ExistentialTraitRef<'tcx> { impl<'tcx> fmt::Debug for ty::ExistentialTraitRef<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
with_no_trimmed_paths(|| fmt::Display::fmt(self, f)) with_no_trimmed_paths(|| fmt::Display::fmt(self, f))
} }
} }
impl fmt::Debug for ty::adjustment::Adjustment<'tcx> { impl<'tcx> fmt::Debug for ty::adjustment::Adjustment<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?} -> {}", self.kind, self.target) write!(f, "{:?} -> {}", self.kind, self.target)
} }
...@@ -111,7 +111,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -111,7 +111,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
} }
} }
impl fmt::Debug for ty::FnSig<'tcx> { impl<'tcx> fmt::Debug for ty::FnSig<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({:?}; c_variadic: {})->{:?}", self.inputs(), self.c_variadic, self.output()) write!(f, "({:?}; c_variadic: {})->{:?}", self.inputs(), self.c_variadic, self.output())
} }
...@@ -129,13 +129,13 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -129,13 +129,13 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
} }
} }
impl fmt::Debug for ty::TraitRef<'tcx> { impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
with_no_trimmed_paths(|| fmt::Display::fmt(self, f)) with_no_trimmed_paths(|| fmt::Display::fmt(self, f))
} }
} }
impl fmt::Debug for Ty<'tcx> { impl<'tcx> fmt::Debug for Ty<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
with_no_trimmed_paths(|| fmt::Display::fmt(self, f)) with_no_trimmed_paths(|| fmt::Display::fmt(self, f))
} }
...@@ -153,7 +153,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -153,7 +153,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
} }
} }
impl fmt::Debug for ty::TraitPredicate<'tcx> { impl<'tcx> fmt::Debug for ty::TraitPredicate<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let ty::BoundConstness::ConstIfConst = self.constness { if let ty::BoundConstness::ConstIfConst = self.constness {
write!(f, "~const ")?; write!(f, "~const ")?;
...@@ -162,19 +162,19 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -162,19 +162,19 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
} }
} }
impl fmt::Debug for ty::ProjectionPredicate<'tcx> { impl<'tcx> fmt::Debug for ty::ProjectionPredicate<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ProjectionPredicate({:?}, {:?})", self.projection_ty, self.ty) write!(f, "ProjectionPredicate({:?}, {:?})", self.projection_ty, self.ty)
} }
} }
impl fmt::Debug for ty::Predicate<'tcx> { impl<'tcx> fmt::Debug for ty::Predicate<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.kind()) write!(f, "{:?}", self.kind())
} }
} }
impl fmt::Debug for ty::PredicateKind<'tcx> { impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self { match *self {
ty::PredicateKind::Trait(ref a) => a.fmt(f), ty::PredicateKind::Trait(ref a) => a.fmt(f),
......
...@@ -198,7 +198,7 @@ pub enum TyKind<'tcx> { ...@@ -198,7 +198,7 @@ pub enum TyKind<'tcx> {
Error(DelaySpanBugEmitted), Error(DelaySpanBugEmitted),
} }
impl TyKind<'tcx> { impl<'tcx> TyKind<'tcx> {
#[inline] #[inline]
pub fn is_primitive(&self) -> bool { pub fn is_primitive(&self) -> bool {
matches!(self, Bool | Char | Int(_) | Uint(_) | Float(_)) matches!(self, Bool | Char | Int(_) | Uint(_) | Float(_))
......
...@@ -67,7 +67,7 @@ fn pack(self) -> GenericArg<'tcx> { ...@@ -67,7 +67,7 @@ fn pack(self) -> GenericArg<'tcx> {
} }
} }
impl fmt::Debug for GenericArg<'tcx> { impl<'tcx> fmt::Debug for GenericArg<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.unpack() { match self.unpack() {
GenericArgKind::Lifetime(lt) => lt.fmt(f), GenericArgKind::Lifetime(lt) => lt.fmt(f),
......
...@@ -981,7 +981,7 @@ pub fn determine<P>(self_arg_ty: Ty<'tcx>, is_self_ty: P) -> ExplicitSelf<'tcx> ...@@ -981,7 +981,7 @@ pub fn determine<P>(self_arg_ty: Ty<'tcx>, is_self_ty: P) -> ExplicitSelf<'tcx>
/// Returns a list of types such that the given type needs drop if and only if /// Returns a list of types such that the given type needs drop if and only if
/// *any* of the returned types need drop. Returns `Err(AlwaysRequiresDrop)` if /// *any* of the returned types need drop. Returns `Err(AlwaysRequiresDrop)` if
/// this type always needs drop. /// this type always needs drop.
pub fn needs_drop_components( pub fn needs_drop_components<'tcx>(
ty: Ty<'tcx>, ty: Ty<'tcx>,
target_layout: &TargetDataLayout, target_layout: &TargetDataLayout,
) -> Result<SmallVec<[Ty<'tcx>; 2]>, AlwaysRequiresDrop> { ) -> Result<SmallVec<[Ty<'tcx>; 2]>, AlwaysRequiresDrop> {
...@@ -1083,7 +1083,7 @@ pub fn fold_list<'tcx, F, T>( ...@@ -1083,7 +1083,7 @@ pub fn fold_list<'tcx, F, T>(
/// Normalizes all opaque types in the given value, replacing them /// Normalizes all opaque types in the given value, replacing them
/// with their underlying types. /// with their underlying types.
pub fn normalize_opaque_types( pub fn normalize_opaque_types<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
val: &'tcx List<ty::Predicate<'tcx>>, val: &'tcx List<ty::Predicate<'tcx>>,
) -> &'tcx List<ty::Predicate<'tcx>> { ) -> &'tcx List<ty::Predicate<'tcx>> {
......
...@@ -69,7 +69,7 @@ fn next(&mut self) -> Option<GenericArg<'tcx>> { ...@@ -69,7 +69,7 @@ fn next(&mut self) -> Option<GenericArg<'tcx>> {
} }
} }
impl GenericArg<'tcx> { impl<'tcx> GenericArg<'tcx> {
/// Iterator that walks `self` and any types reachable from /// Iterator that walks `self` and any types reachable from
/// `self`, in depth-first order. Note that just walks the types /// `self`, in depth-first order. Note that just walks the types
/// that appear in `self`, it does not descend into the fields of /// that appear in `self`, it does not descend into the fields of
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册