Remove needless lifetimes
This commit is contained in:
parent
d50a3a7b86
commit
ec711767a7
29 changed files with 99 additions and 99 deletions
|
@ -84,9 +84,9 @@ struct PropagationContext<'a, 'tcx, O> {
|
|||
changed: bool,
|
||||
}
|
||||
|
||||
fn get_cfg_indices<'a>(id: hir::ItemLocalId,
|
||||
index: &'a FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>)
|
||||
-> &'a [CFGIndex] {
|
||||
fn get_cfg_indices(id: hir::ItemLocalId,
|
||||
index: &FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>)
|
||||
-> &[CFGIndex] {
|
||||
index.get(&id).map_or(&[], |v| &v[..])
|
||||
}
|
||||
|
||||
|
|
|
@ -123,8 +123,8 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'tcx>, cgu_name: InternedString) {
|
|||
|
||||
submit_codegened_module_to_llvm(&LlvmCodegenBackend(()), tcx, module, cost);
|
||||
|
||||
fn module_codegen<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn module_codegen(
|
||||
tcx: TyCtxt<'_>,
|
||||
cgu_name: InternedString,
|
||||
) -> ModuleCodegen<ModuleLlvm> {
|
||||
let cgu = tcx.codegen_unit(cgu_name);
|
||||
|
|
|
@ -144,7 +144,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn build_sibling_block<'b>(&self, name: &'b str) -> Self {
|
||||
fn build_sibling_block(&self, name: &str) -> Self {
|
||||
Builder::new_block(self.cx, self.llfn(), name)
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend {
|
|||
) {
|
||||
unsafe { allocator::codegen(tcx, mods, kind) }
|
||||
}
|
||||
fn compile_codegen_unit<'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: InternedString) {
|
||||
fn compile_codegen_unit(&self, tcx: TyCtxt<'_>, cgu_name: InternedString) {
|
||||
base::compile_codegen_unit(tcx, cgu_name);
|
||||
}
|
||||
fn target_machine_factory(
|
||||
|
|
|
@ -700,7 +700,7 @@ impl<B: ExtraBackendMethods> Drop for AbortCodegenOnDrop<B> {
|
|||
}
|
||||
}
|
||||
|
||||
fn assert_and_save_dep_graph<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||
fn assert_and_save_dep_graph(tcx: TyCtxt<'_>) {
|
||||
time(tcx.sess,
|
||||
"assert dep graph",
|
||||
|| ::rustc_incremental::assert_dep_graph(tcx));
|
||||
|
|
|
@ -11,7 +11,7 @@ use syntax::symbol::{Symbol, sym};
|
|||
const SYMBOL_NAME: Symbol = sym::rustc_symbol_name;
|
||||
const DEF_PATH: Symbol = sym::rustc_def_path;
|
||||
|
||||
pub fn report_symbol_names<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||
pub fn report_symbol_names(tcx: TyCtxt<'_>) {
|
||||
// if the `rustc_attrs` feature is not enabled, then the
|
||||
// attributes we are interested in cannot be present anyway, so
|
||||
// skip the walk.
|
||||
|
|
|
@ -168,7 +168,7 @@ impl<T: Idx> BitSet<T> {
|
|||
|
||||
/// Iterates over the indices of set bits in a sorted order.
|
||||
#[inline]
|
||||
pub fn iter<'a>(&'a self) -> BitIter<'a, T> {
|
||||
pub fn iter(&self) -> BitIter<'_, T> {
|
||||
BitIter {
|
||||
cur: None,
|
||||
iter: self.words.iter().enumerate(),
|
||||
|
@ -849,7 +849,7 @@ impl<R: Idx, C: Idx> BitMatrix<R, C> {
|
|||
|
||||
/// Iterates through all the columns set to true in a given row of
|
||||
/// the matrix.
|
||||
pub fn iter<'a>(&'a self, row: R) -> BitIter<'a, C> {
|
||||
pub fn iter(&self, row: R) -> BitIter<'_, C> {
|
||||
assert!(row.index() < self.num_rows);
|
||||
let (start, end) = self.range(row);
|
||||
BitIter {
|
||||
|
|
|
@ -58,7 +58,7 @@ impl Fingerprint {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn decode_opaque<'a>(decoder: &mut Decoder<'a>) -> Result<Fingerprint, String> {
|
||||
pub fn decode_opaque(decoder: &mut Decoder<'_>) -> Result<Fingerprint, String> {
|
||||
let mut bytes = [0; 16];
|
||||
|
||||
decoder.read_raw_bytes(&mut bytes)?;
|
||||
|
|
|
@ -188,7 +188,7 @@ impl PpSourceMode {
|
|||
_ => panic!("Should use call_with_pp_support_hir"),
|
||||
}
|
||||
}
|
||||
fn call_with_pp_support_hir<'tcx, A, F>(&self, tcx: TyCtxt<'tcx>, f: F) -> A
|
||||
fn call_with_pp_support_hir<A, F>(&self, tcx: TyCtxt<'_>, f: F) -> A
|
||||
where
|
||||
F: FnOnce(&dyn HirPrinterSupport<'_>, &hir::Crate) -> A,
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ impl PpSourceMode {
|
|||
trait PrinterSupport: pprust::PpAnn {
|
||||
/// Provides a uniform interface for re-extracting a reference to a
|
||||
/// `Session` from a value that now owns it.
|
||||
fn sess<'a>(&'a self) -> &'a Session;
|
||||
fn sess(&self) -> &Session;
|
||||
|
||||
/// Produces the pretty-print annotation object.
|
||||
///
|
||||
|
@ -240,7 +240,7 @@ trait PrinterSupport: pprust::PpAnn {
|
|||
trait HirPrinterSupport<'hir>: pprust_hir::PpAnn {
|
||||
/// Provides a uniform interface for re-extracting a reference to a
|
||||
/// `Session` from a value that now owns it.
|
||||
fn sess<'a>(&'a self) -> &'a Session;
|
||||
fn sess(&self) -> &Session;
|
||||
|
||||
/// Provides a uniform interface for re-extracting a reference to an
|
||||
/// `hir_map::Map` from a value that now owns it.
|
||||
|
@ -272,7 +272,7 @@ struct NoAnn<'hir> {
|
|||
}
|
||||
|
||||
impl<'hir> PrinterSupport for NoAnn<'hir> {
|
||||
fn sess<'a>(&'a self) -> &'a Session {
|
||||
fn sess(&self) -> &Session {
|
||||
self.sess
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ impl<'hir> PrinterSupport for NoAnn<'hir> {
|
|||
}
|
||||
|
||||
impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> {
|
||||
fn sess<'a>(&'a self) -> &'a Session {
|
||||
fn sess(&self) -> &Session {
|
||||
self.sess
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ struct IdentifiedAnnotation<'hir> {
|
|||
}
|
||||
|
||||
impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> {
|
||||
fn sess<'a>(&'a self) -> &'a Session {
|
||||
fn sess(&self) -> &Session {
|
||||
self.sess
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ impl<'hir> pprust::PpAnn for IdentifiedAnnotation<'hir> {
|
|||
}
|
||||
|
||||
impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> {
|
||||
fn sess<'a>(&'a self) -> &'a Session {
|
||||
fn sess(&self) -> &Session {
|
||||
self.sess
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ struct TypedAnnotation<'a, 'tcx> {
|
|||
}
|
||||
|
||||
impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
|
||||
fn sess<'a>(&'a self) -> &'a Session {
|
||||
fn sess(&self) -> &Session {
|
||||
&self.tcx.sess
|
||||
}
|
||||
|
||||
|
@ -866,8 +866,8 @@ pub fn print_after_hir_lowering<'tcx>(
|
|||
// analysis is performed. However, we want to call `phase_3_run_analysis_passes`
|
||||
// with a different callback than the standard driver, so that isn't easy.
|
||||
// Instead, we call that function ourselves.
|
||||
fn print_with_analysis<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn print_with_analysis(
|
||||
tcx: TyCtxt<'_>,
|
||||
ppm: PpMode,
|
||||
uii: Option<UserIdentifiedItem>,
|
||||
ofile: Option<&Path>,
|
||||
|
|
|
@ -1635,7 +1635,7 @@ impl Destination {
|
|||
}
|
||||
}
|
||||
|
||||
fn writable<'a>(&'a mut self) -> WritableDst<'a> {
|
||||
fn writable(&mut self) -> WritableDst<'_> {
|
||||
match *self {
|
||||
Destination::Terminal(ref mut t) => WritableDst::Terminal(t),
|
||||
Destination::Buffered(ref mut t) => {
|
||||
|
|
|
@ -438,14 +438,14 @@ impl Handler {
|
|||
self.err_count.store(0, SeqCst);
|
||||
}
|
||||
|
||||
pub fn struct_dummy<'a>(&'a self) -> DiagnosticBuilder<'a> {
|
||||
pub fn struct_dummy(&self) -> DiagnosticBuilder<'_> {
|
||||
DiagnosticBuilder::new(self, Level::Cancelled, "")
|
||||
}
|
||||
|
||||
pub fn struct_span_warn<'a, S: Into<MultiSpan>>(&'a self,
|
||||
pub fn struct_span_warn<S: Into<MultiSpan>>(&self,
|
||||
sp: S,
|
||||
msg: &str)
|
||||
-> DiagnosticBuilder<'a> {
|
||||
-> DiagnosticBuilder<'_> {
|
||||
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
|
||||
result.set_span(sp);
|
||||
if !self.flags.can_emit_warnings {
|
||||
|
@ -453,11 +453,11 @@ impl Handler {
|
|||
}
|
||||
result
|
||||
}
|
||||
pub fn struct_span_warn_with_code<'a, S: Into<MultiSpan>>(&'a self,
|
||||
pub fn struct_span_warn_with_code<S: Into<MultiSpan>>(&self,
|
||||
sp: S,
|
||||
msg: &str,
|
||||
code: DiagnosticId)
|
||||
-> DiagnosticBuilder<'a> {
|
||||
-> DiagnosticBuilder<'_> {
|
||||
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
|
||||
result.set_span(sp);
|
||||
result.code(code);
|
||||
|
@ -466,63 +466,63 @@ impl Handler {
|
|||
}
|
||||
result
|
||||
}
|
||||
pub fn struct_warn<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
|
||||
pub fn struct_warn(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
|
||||
if !self.flags.can_emit_warnings {
|
||||
result.cancel();
|
||||
}
|
||||
result
|
||||
}
|
||||
pub fn struct_span_err<'a, S: Into<MultiSpan>>(&'a self,
|
||||
pub fn struct_span_err<S: Into<MultiSpan>>(&self,
|
||||
sp: S,
|
||||
msg: &str)
|
||||
-> DiagnosticBuilder<'a> {
|
||||
-> DiagnosticBuilder<'_> {
|
||||
let mut result = DiagnosticBuilder::new(self, Level::Error, msg);
|
||||
result.set_span(sp);
|
||||
result
|
||||
}
|
||||
pub fn struct_span_err_with_code<'a, S: Into<MultiSpan>>(&'a self,
|
||||
pub fn struct_span_err_with_code<S: Into<MultiSpan>>(&self,
|
||||
sp: S,
|
||||
msg: &str,
|
||||
code: DiagnosticId)
|
||||
-> DiagnosticBuilder<'a> {
|
||||
-> DiagnosticBuilder<'_> {
|
||||
let mut result = DiagnosticBuilder::new(self, Level::Error, msg);
|
||||
result.set_span(sp);
|
||||
result.code(code);
|
||||
result
|
||||
}
|
||||
// FIXME: This method should be removed (every error should have an associated error code).
|
||||
pub fn struct_err<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
|
||||
pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||
DiagnosticBuilder::new(self, Level::Error, msg)
|
||||
}
|
||||
pub fn struct_err_with_code<'a>(
|
||||
&'a self,
|
||||
pub fn struct_err_with_code(
|
||||
&self,
|
||||
msg: &str,
|
||||
code: DiagnosticId,
|
||||
) -> DiagnosticBuilder<'a> {
|
||||
) -> DiagnosticBuilder<'_> {
|
||||
let mut result = DiagnosticBuilder::new(self, Level::Error, msg);
|
||||
result.code(code);
|
||||
result
|
||||
}
|
||||
pub fn struct_span_fatal<'a, S: Into<MultiSpan>>(&'a self,
|
||||
pub fn struct_span_fatal<S: Into<MultiSpan>>(&self,
|
||||
sp: S,
|
||||
msg: &str)
|
||||
-> DiagnosticBuilder<'a> {
|
||||
-> DiagnosticBuilder<'_> {
|
||||
let mut result = DiagnosticBuilder::new(self, Level::Fatal, msg);
|
||||
result.set_span(sp);
|
||||
result
|
||||
}
|
||||
pub fn struct_span_fatal_with_code<'a, S: Into<MultiSpan>>(&'a self,
|
||||
pub fn struct_span_fatal_with_code<S: Into<MultiSpan>>(&self,
|
||||
sp: S,
|
||||
msg: &str,
|
||||
code: DiagnosticId)
|
||||
-> DiagnosticBuilder<'a> {
|
||||
-> DiagnosticBuilder<'_> {
|
||||
let mut result = DiagnosticBuilder::new(self, Level::Fatal, msg);
|
||||
result.set_span(sp);
|
||||
result.code(code);
|
||||
result
|
||||
}
|
||||
pub fn struct_fatal<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
|
||||
pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||
DiagnosticBuilder::new(self, Level::Fatal, msg)
|
||||
}
|
||||
|
||||
|
@ -563,10 +563,10 @@ impl Handler {
|
|||
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
|
||||
self.emit(&sp.into(), msg, Error);
|
||||
}
|
||||
pub fn mut_span_err<'a, S: Into<MultiSpan>>(&'a self,
|
||||
pub fn mut_span_err<S: Into<MultiSpan>>(&self,
|
||||
sp: S,
|
||||
msg: &str)
|
||||
-> DiagnosticBuilder<'a> {
|
||||
-> DiagnosticBuilder<'_> {
|
||||
let mut result = DiagnosticBuilder::new(self, Level::Error, msg);
|
||||
result.set_span(sp);
|
||||
result
|
||||
|
@ -605,10 +605,10 @@ impl Handler {
|
|||
pub fn span_note_without_error<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
|
||||
self.emit(&sp.into(), msg, Note);
|
||||
}
|
||||
pub fn span_note_diag<'a>(&'a self,
|
||||
pub fn span_note_diag(&self,
|
||||
sp: Span,
|
||||
msg: &str)
|
||||
-> DiagnosticBuilder<'a> {
|
||||
-> DiagnosticBuilder<'_> {
|
||||
let mut db = DiagnosticBuilder::new(self, Note, msg);
|
||||
db.set_span(sp);
|
||||
db
|
||||
|
|
|
@ -51,7 +51,7 @@ use std::io::Write;
|
|||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
|
||||
pub fn assert_dep_graph<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||
pub fn assert_dep_graph(tcx: TyCtxt<'_>) {
|
||||
tcx.dep_graph.with_ignore(|| {
|
||||
if tcx.sess.opts.debugging_opts.dump_dep_graph {
|
||||
dump_graph(tcx);
|
||||
|
|
|
@ -35,7 +35,7 @@ const MODULE: Symbol = sym::module;
|
|||
const CFG: Symbol = sym::cfg;
|
||||
const KIND: Symbol = sym::kind;
|
||||
|
||||
pub fn assert_module_sources<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||
pub fn assert_module_sources(tcx: TyCtxt<'_>) {
|
||||
tcx.dep_graph.with_ignore(|| {
|
||||
if tcx.sess.opts.incremental.is_none() {
|
||||
return;
|
||||
|
|
|
@ -878,7 +878,7 @@ pub fn create_global_ctxt(
|
|||
|
||||
/// Runs the resolution, type-checking, region checking and other
|
||||
/// miscellaneous analysis passes on the crate.
|
||||
fn analysis<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Result<()> {
|
||||
fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
let sess = tcx.sess;
|
||||
|
@ -995,8 +995,8 @@ fn analysis<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn encode_and_write_metadata<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn encode_and_write_metadata(
|
||||
tcx: TyCtxt<'_>,
|
||||
outputs: &OutputFilenames,
|
||||
) -> (middle::cstore::EncodedMetadata, bool) {
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
||||
|
|
|
@ -6,11 +6,11 @@ use rustc::ty::query::Providers;
|
|||
use syntax::attr;
|
||||
use syntax::symbol::sym;
|
||||
|
||||
pub fn find<'tcx>(tcx: TyCtxt<'tcx>) -> Option<DefId> {
|
||||
pub fn find(tcx: TyCtxt<'_>) -> Option<DefId> {
|
||||
tcx.proc_macro_decls_static(LOCAL_CRATE)
|
||||
}
|
||||
|
||||
fn proc_macro_decls_static<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Option<DefId> {
|
||||
fn proc_macro_decls_static(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<DefId> {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
let mut finder = Finder { decls: None };
|
||||
|
|
|
@ -74,7 +74,7 @@ pub fn provide(providers: &mut Providers<'_>) {
|
|||
};
|
||||
}
|
||||
|
||||
fn lint_mod<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
|
||||
fn lint_mod(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
||||
lint::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new());
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
exported_symbols => { Arc::new(cdata.exported_symbols(tcx)) }
|
||||
}
|
||||
|
||||
pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
|
||||
pub fn provide(providers: &mut 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
|
||||
|
@ -550,7 +550,7 @@ impl CrateStore for cstore::CStore {
|
|||
self.do_postorder_cnums_untracked()
|
||||
}
|
||||
|
||||
fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx>) -> EncodedMetadata {
|
||||
fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata {
|
||||
encoder::encode_metadata(tcx)
|
||||
}
|
||||
|
||||
|
|
|
@ -1863,7 +1863,7 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> {
|
|||
// will allow us to slice the metadata to the precise length that we just
|
||||
// generated regardless of trailing bytes that end up in it.
|
||||
|
||||
pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx>) -> EncodedMetadata {
|
||||
pub fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata {
|
||||
let mut encoder = opaque::Encoder::new(vec![]);
|
||||
encoder.emit_raw_bytes(METADATA_HEADER);
|
||||
|
||||
|
@ -1905,7 +1905,7 @@ pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx>) -> EncodedMetadata {
|
|||
EncodedMetadata { raw_data: result }
|
||||
}
|
||||
|
||||
pub fn get_repr_options<'tcx>(tcx: TyCtxt<'tcx>, did: DefId) -> ReprOptions {
|
||||
pub fn get_repr_options(tcx: TyCtxt<'_>, did: DefId) -> ReprOptions {
|
||||
let ty = tcx.type_of(did);
|
||||
match ty.sty {
|
||||
ty::Adt(ref def, _) => return def.repr,
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::hir;
|
|||
use rustc::middle::cstore::ForeignModule;
|
||||
use rustc::ty::TyCtxt;
|
||||
|
||||
pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> Vec<ForeignModule> {
|
||||
pub fn collect(tcx: TyCtxt<'_>) -> Vec<ForeignModule> {
|
||||
let mut collector = Collector {
|
||||
tcx,
|
||||
modules: Vec::new(),
|
||||
|
|
|
@ -4,7 +4,7 @@ use rustc::ty::TyCtxt;
|
|||
use rustc_target::spec::abi::Abi;
|
||||
use syntax::symbol::sym;
|
||||
|
||||
pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> Vec<String> {
|
||||
pub fn collect(tcx: TyCtxt<'_>) -> Vec<String> {
|
||||
let mut collector = Collector {
|
||||
args: Vec::new(),
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ use syntax::feature_gate::{self, GateIssue};
|
|||
use syntax::symbol::{Symbol, sym};
|
||||
use syntax::{span_err, struct_span_err};
|
||||
|
||||
pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> Vec<NativeLibrary> {
|
||||
pub fn collect(tcx: TyCtxt<'_>) -> Vec<NativeLibrary> {
|
||||
let mut collector = Collector {
|
||||
tcx,
|
||||
libs: Vec::new(),
|
||||
|
|
|
@ -829,7 +829,7 @@ fn build_call_shim<'tcx>(
|
|||
body
|
||||
}
|
||||
|
||||
pub fn build_adt_ctor<'tcx>(tcx: TyCtxt<'tcx>, ctor_id: DefId) -> &'tcx Body<'tcx> {
|
||||
pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> &Body<'_> {
|
||||
debug_assert!(tcx.is_constructor(ctor_id));
|
||||
|
||||
let span = tcx.hir().span_if_local(ctor_id)
|
||||
|
|
|
@ -38,7 +38,7 @@ pub fn print_hir_stats(krate: &hir::Crate) {
|
|||
collector.print("HIR STATS");
|
||||
}
|
||||
|
||||
pub fn print_ast_stats<'v>(krate: &'v ast::Crate, title: &str) {
|
||||
pub fn print_ast_stats(krate: &ast::Crate, title: &str) {
|
||||
let mut collector = StatCollector {
|
||||
krate: None,
|
||||
data: FxHashMap::default(),
|
||||
|
|
|
@ -14,7 +14,7 @@ use rustc::ty::TyCtxt;
|
|||
use syntax::ast::Attribute;
|
||||
use syntax::symbol::sym;
|
||||
|
||||
pub fn test_layout<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||
pub fn test_layout(tcx: TyCtxt<'_>) {
|
||||
if tcx.features().rustc_attrs {
|
||||
// if the `rustc_attrs` feature is not enabled, don't bother testing layout
|
||||
tcx.hir()
|
||||
|
|
|
@ -45,7 +45,7 @@ struct CheckLoopVisitor<'a, 'hir> {
|
|||
cx: Context,
|
||||
}
|
||||
|
||||
fn check_mod_loops<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
|
||||
fn check_mod_loops(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
||||
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckLoopVisitor {
|
||||
sess: &tcx.sess,
|
||||
hir_map: &tcx.hir(),
|
||||
|
|
|
@ -39,7 +39,7 @@ pub fn provide(providers: &mut Providers<'_>) {
|
|||
};
|
||||
}
|
||||
|
||||
fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
|
||||
fn const_is_rvalue_promotable_to_static(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
assert!(def_id.is_local());
|
||||
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id)
|
||||
|
@ -48,7 +48,7 @@ fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId)
|
|||
tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id)
|
||||
}
|
||||
|
||||
fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ItemLocalSet {
|
||||
fn rvalue_promotable_map(tcx: TyCtxt<'_>, def_id: DefId) -> &ItemLocalSet {
|
||||
let outer_def_id = tcx.closure_base_def_id(def_id);
|
||||
if outer_def_id != def_id {
|
||||
return tcx.rvalue_promotable_map(outer_def_id);
|
||||
|
|
|
@ -30,11 +30,11 @@ impl<'v> ItemLikeVisitor<'v> for RegistrarFinder {
|
|||
}
|
||||
|
||||
/// Finds the function marked with `#[plugin_registrar]`, if any.
|
||||
pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'tcx>) -> Option<DefId> {
|
||||
pub fn find_plugin_registrar(tcx: TyCtxt<'_>) -> Option<DefId> {
|
||||
tcx.plugin_registrar_fn(LOCAL_CRATE)
|
||||
}
|
||||
|
||||
fn plugin_registrar_fn<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Option<DefId> {
|
||||
fn plugin_registrar_fn(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<DefId> {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
let mut finder = RegistrarFinder { registrars: Vec::new() };
|
||||
|
|
|
@ -77,7 +77,7 @@ impl<'a> Registry<'a> {
|
|||
///
|
||||
/// Returns empty slice in case the plugin was loaded
|
||||
/// with `--extra-plugins`
|
||||
pub fn args<'b>(&'b self) -> &'b [ast::NestedMetaItem] {
|
||||
pub fn args(&self) -> &[ast::NestedMetaItem] {
|
||||
self.args_hidden.as_ref().map(|v| &v[..]).unwrap_or(&[])
|
||||
}
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ fn item_tables<'a, 'tcx>(
|
|||
if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables }
|
||||
}
|
||||
|
||||
fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx>) -> ty::Visibility {
|
||||
fn min(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'_>) -> ty::Visibility {
|
||||
if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 }
|
||||
}
|
||||
|
||||
|
@ -384,14 +384,14 @@ impl<'a, 'tcx, VL: VisibilityLike> DefIdVisitor<'tcx> for FindMin<'a, 'tcx, VL>
|
|||
trait VisibilityLike: Sized {
|
||||
const MAX: Self;
|
||||
const SHALLOW: bool = false;
|
||||
fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self;
|
||||
fn new_min(find: &FindMin<'_, '_, Self>, def_id: DefId) -> Self;
|
||||
|
||||
// Returns an over-approximation (`skip_assoc_tys` = true) of visibility due to
|
||||
// associated types for which we can't determine visibility precisely.
|
||||
fn of_impl<'a, 'tcx>(
|
||||
fn of_impl(
|
||||
hir_id: hir::HirId,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
access_levels: &'a AccessLevels,
|
||||
tcx: TyCtxt<'_>,
|
||||
access_levels: &AccessLevels,
|
||||
) -> Self {
|
||||
let mut find = FindMin { tcx, access_levels, min: Self::MAX };
|
||||
let def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
|
@ -404,7 +404,7 @@ trait VisibilityLike: Sized {
|
|||
}
|
||||
impl VisibilityLike for ty::Visibility {
|
||||
const MAX: Self = ty::Visibility::Public;
|
||||
fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self {
|
||||
fn new_min(find: &FindMin<'_, '_, Self>, def_id: DefId) -> Self {
|
||||
min(def_id_visibility(find.tcx, def_id).0, find.min, find.tcx)
|
||||
}
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ impl VisibilityLike for Option<AccessLevel> {
|
|||
// both "shallow" version of its self type and "shallow" version of its trait if it exists
|
||||
// (which require reaching the `DefId`s in them).
|
||||
const SHALLOW: bool = true;
|
||||
fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self {
|
||||
fn new_min(find: &FindMin<'_, '_, Self>, def_id: DefId) -> Self {
|
||||
cmp::min(if let Some(hir_id) = find.tcx.hir().as_local_hir_id(def_id) {
|
||||
find.access_levels.map.get(&hir_id).cloned()
|
||||
} else {
|
||||
|
@ -1828,7 +1828,7 @@ pub fn provide(providers: &mut Providers<'_>) {
|
|||
};
|
||||
}
|
||||
|
||||
fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
|
||||
fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
||||
let empty_tables = ty::TypeckTables::empty(None);
|
||||
|
||||
// Check privacy of names not checked in previous compilation stages.
|
||||
|
@ -1855,7 +1855,7 @@ fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
|
|||
intravisit::walk_mod(&mut visitor, module, hir_id);
|
||||
}
|
||||
|
||||
fn privacy_access_levels<'tcx>(tcx: TyCtxt<'tcx>, krate: CrateNum) -> &'tcx AccessLevels {
|
||||
fn privacy_access_levels(tcx: TyCtxt<'_>, krate: CrateNum) -> &AccessLevels {
|
||||
assert_eq!(krate, LOCAL_CRATE);
|
||||
|
||||
// Build up a set of all exported items in the AST. This is a set of all
|
||||
|
@ -1879,7 +1879,7 @@ fn privacy_access_levels<'tcx>(tcx: TyCtxt<'tcx>, krate: CrateNum) -> &'tcx Acce
|
|||
tcx.arena.alloc(visitor.access_levels)
|
||||
}
|
||||
|
||||
fn check_private_in_public<'tcx>(tcx: TyCtxt<'tcx>, krate: CrateNum) {
|
||||
fn check_private_in_public(tcx: TyCtxt<'_>, krate: CrateNum) {
|
||||
assert_eq!(krate, LOCAL_CRATE);
|
||||
|
||||
let access_levels = tcx.privacy_access_levels(LOCAL_CRATE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue