Remove needless lifetimes
This commit is contained in:
parent
ec711767a7
commit
d28832dde9
48 changed files with 182 additions and 182 deletions
|
@ -765,7 +765,7 @@ pub fn maybe_lint_level_root(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
|
||||||
attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some())
|
attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lint_levels<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap {
|
fn lint_levels(tcx: TyCtxt<'_>, cnum: CrateNum) -> &LintLevelMap {
|
||||||
assert_eq!(cnum, LOCAL_CRATE);
|
assert_eq!(cnum, LOCAL_CRATE);
|
||||||
let mut builder = LintLevelMapBuilder {
|
let mut builder = LintLevelMapBuilder {
|
||||||
levels: LintLevelSets::builder(tcx.sess),
|
levels: LintLevelSets::builder(tcx.sess),
|
||||||
|
|
|
@ -211,7 +211,7 @@ pub trait CrateStore {
|
||||||
fn crates_untracked(&self) -> Vec<CrateNum>;
|
fn crates_untracked(&self) -> Vec<CrateNum>;
|
||||||
|
|
||||||
// utility functions
|
// utility functions
|
||||||
fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx>) -> EncodedMetadata;
|
fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata;
|
||||||
fn metadata_encoding_version(&self) -> &[u8];
|
fn metadata_encoding_version(&self) -> &[u8];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ use syntax_pos;
|
||||||
// explored. For example, if it's a live Node::Item that is a
|
// explored. For example, if it's a live Node::Item that is a
|
||||||
// function, then we should explore its block to check for codes that
|
// function, then we should explore its block to check for codes that
|
||||||
// may need to be marked as live.
|
// may need to be marked as live.
|
||||||
fn should_explore<'tcx>(tcx: TyCtxt<'tcx>, hir_id: hir::HirId) -> bool {
|
fn should_explore(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
|
||||||
match tcx.hir().find(hir_id) {
|
match tcx.hir().find(hir_id) {
|
||||||
Some(Node::Item(..)) |
|
Some(Node::Item(..)) |
|
||||||
Some(Node::ImplItem(..)) |
|
Some(Node::ImplItem(..)) |
|
||||||
|
@ -662,7 +662,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn check_crate(tcx: TyCtxt<'_>) {
|
||||||
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
||||||
let krate = tcx.hir().krate();
|
let krate = tcx.hir().krate();
|
||||||
let live_symbols = find_live(tcx, access_levels, krate);
|
let live_symbols = find_live(tcx, access_levels, krate);
|
||||||
|
|
|
@ -81,7 +81,7 @@ pub enum Linkage {
|
||||||
Dynamic,
|
Dynamic,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn calculate<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn calculate(tcx: TyCtxt<'_>) {
|
||||||
let sess = &tcx.sess;
|
let sess = &tcx.sess;
|
||||||
let fmts = sess.crate_types.borrow().iter().map(|&ty| {
|
let fmts = sess.crate_types.borrow().iter().map(|&ty| {
|
||||||
let linkage = calculate_type(tcx, ty);
|
let linkage = calculate_type(tcx, ty);
|
||||||
|
@ -92,7 +92,7 @@ pub fn calculate<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||||
sess.dependency_formats.set(fmts);
|
sess.dependency_formats.set(fmts);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn calculate_type<'tcx>(tcx: TyCtxt<'tcx>, ty: config::CrateType) -> DependencyList {
|
fn calculate_type(tcx: TyCtxt<'_>, ty: config::CrateType) -> DependencyList {
|
||||||
let sess = &tcx.sess;
|
let sess = &tcx.sess;
|
||||||
|
|
||||||
if !sess.opts.output_types.should_codegen() {
|
if !sess.opts.output_types.should_codegen() {
|
||||||
|
@ -267,7 +267,7 @@ fn add_library(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn attempt_static<'tcx>(tcx: TyCtxt<'tcx>) -> Option<DependencyList> {
|
fn attempt_static(tcx: TyCtxt<'_>) -> Option<DependencyList> {
|
||||||
let sess = &tcx.sess;
|
let sess = &tcx.sess;
|
||||||
let crates = cstore::used_crates(tcx, RequireStatic);
|
let crates = cstore::used_crates(tcx, RequireStatic);
|
||||||
if !crates.iter().by_ref().all(|&(_, ref p)| p.is_some()) {
|
if !crates.iter().by_ref().all(|&(_, ref p)| p.is_some()) {
|
||||||
|
@ -324,7 +324,7 @@ fn activate_injected_dep(injected: Option<CrateNum>,
|
||||||
|
|
||||||
// After the linkage for a crate has been determined we need to verify that
|
// After the linkage for a crate has been determined we need to verify that
|
||||||
// there's only going to be one allocator in the output.
|
// there's only going to be one allocator in the output.
|
||||||
fn verify_ok<'tcx>(tcx: TyCtxt<'tcx>, list: &[Linkage]) {
|
fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
|
||||||
let sess = &tcx.sess;
|
let sess = &tcx.sess;
|
||||||
if list.len() == 0 {
|
if list.len() == 0 {
|
||||||
return
|
return
|
||||||
|
|
|
@ -10,7 +10,7 @@ use syntax_pos::{Span, sym};
|
||||||
use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
|
use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
|
||||||
use crate::hir;
|
use crate::hir;
|
||||||
|
|
||||||
fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
|
fn check_mod_intrinsics(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
||||||
tcx.hir().visit_item_likes_in_module(
|
tcx.hir().visit_item_likes_in_module(
|
||||||
module_def_id,
|
module_def_id,
|
||||||
&mut ItemVisitor { tcx }.as_deep_visitor()
|
&mut ItemVisitor { tcx }.as_deep_visitor()
|
||||||
|
|
|
@ -142,7 +142,7 @@ impl Visitor<'tcx> for LibFeatureCollector<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> LibFeatures {
|
pub fn collect(tcx: TyCtxt<'_>) -> LibFeatures {
|
||||||
let mut collector = LibFeatureCollector::new(tcx);
|
let mut collector = LibFeatureCollector::new(tcx);
|
||||||
intravisit::walk_crate(&mut collector, tcx.hir().krate());
|
intravisit::walk_crate(&mut collector, tcx.hir().krate());
|
||||||
collector.lib_features
|
collector.lib_features
|
||||||
|
|
|
@ -181,7 +181,7 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> {
|
||||||
fn visit_arm(&mut self, a: &'tcx hir::Arm) { visit_arm(self, a); }
|
fn visit_arm(&mut self, a: &'tcx hir::Arm) { visit_arm(self, a); }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_mod_liveness<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
|
fn check_mod_liveness(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
||||||
tcx.hir().visit_item_likes_in_module(
|
tcx.hir().visit_item_likes_in_module(
|
||||||
module_def_id,
|
module_def_id,
|
||||||
&mut IrMaps::new(tcx, module_def_id).as_deep_visitor(),
|
&mut IrMaps::new(tcx, module_def_id).as_deep_visitor(),
|
||||||
|
|
|
@ -42,8 +42,8 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item, attrs: CodegenFnAt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn method_might_be_inlined<'tcx>(
|
fn method_might_be_inlined(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
impl_item: &hir::ImplItem,
|
impl_item: &hir::ImplItem,
|
||||||
impl_src: DefId,
|
impl_src: DefId,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -391,7 +391,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx
|
||||||
#[derive(Clone, HashStable)]
|
#[derive(Clone, HashStable)]
|
||||||
pub struct ReachableSet(pub Lrc<HirIdSet>);
|
pub struct ReachableSet(pub Lrc<HirIdSet>);
|
||||||
|
|
||||||
fn reachable_set<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> ReachableSet {
|
fn reachable_set(tcx: TyCtxt<'_>, crate_num: CrateNum) -> ReachableSet {
|
||||||
debug_assert!(crate_num == LOCAL_CRATE);
|
debug_assert!(crate_num == LOCAL_CRATE);
|
||||||
|
|
||||||
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
||||||
|
|
|
@ -1446,7 +1446,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ScopeTree {
|
fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree {
|
||||||
let closure_base_def_id = tcx.closure_base_def_id(def_id);
|
let closure_base_def_id = tcx.closure_base_def_id(def_id);
|
||||||
if closure_base_def_id != def_id {
|
if closure_base_def_id != def_id {
|
||||||
return tcx.region_scope_tree(closure_base_def_id);
|
return tcx.region_scope_tree(closure_base_def_id);
|
||||||
|
|
|
@ -368,7 +368,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
|
||||||
/// entire crate. You should not read the result of this query
|
/// entire crate. You should not read the result of this query
|
||||||
/// directly, but rather use `named_region_map`, `is_late_bound_map`,
|
/// directly, but rather use `named_region_map`, `is_late_bound_map`,
|
||||||
/// etc.
|
/// etc.
|
||||||
fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx>, for_krate: CrateNum) -> &'tcx ResolveLifetimes {
|
fn resolve_lifetimes(tcx: TyCtxt<'_>, for_krate: CrateNum) -> &ResolveLifetimes {
|
||||||
assert_eq!(for_krate, LOCAL_CRATE);
|
assert_eq!(for_krate, LOCAL_CRATE);
|
||||||
|
|
||||||
let named_region_map = krate(tcx);
|
let named_region_map = krate(tcx);
|
||||||
|
@ -395,7 +395,7 @@ fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx>, for_krate: CrateNum) -> &'tcx Reso
|
||||||
tcx.arena.alloc(rl)
|
tcx.arena.alloc(rl)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn krate<'tcx>(tcx: TyCtxt<'tcx>) -> NamedRegionMap {
|
fn krate(tcx: TyCtxt<'_>) -> NamedRegionMap {
|
||||||
let krate = tcx.hir().krate();
|
let krate = tcx.hir().krate();
|
||||||
let mut map = NamedRegionMap {
|
let mut map = NamedRegionMap {
|
||||||
defs: Default::default(),
|
defs: Default::default(),
|
||||||
|
|
|
@ -466,7 +466,7 @@ impl<'tcx> Index<'tcx> {
|
||||||
|
|
||||||
/// Cross-references the feature names of unstable APIs with enabled
|
/// Cross-references the feature names of unstable APIs with enabled
|
||||||
/// features and possibly prints errors.
|
/// features and possibly prints errors.
|
||||||
fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
|
fn check_mod_unstable_api_usage(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
||||||
tcx.hir().visit_item_likes_in_module(module_def_id, &mut Checker { tcx }.as_deep_visitor());
|
tcx.hir().visit_item_likes_in_module(module_def_id, &mut Checker { tcx }.as_deep_visitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,7 +836,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
/// Given the list of enabled features that were not language features (i.e., that
|
/// Given the list of enabled features that were not language features (i.e., that
|
||||||
/// were expected to be library features), and the list of features used from
|
/// were expected to be library features), and the list of features used from
|
||||||
/// libraries, identify activated features that don't exist and error about them.
|
/// libraries, identify activated features that don't exist and error about them.
|
||||||
pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
|
||||||
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
||||||
|
|
||||||
if tcx.stability().staged_api[&LOCAL_CRATE] {
|
if tcx.stability().staged_api[&LOCAL_CRATE] {
|
||||||
|
@ -920,8 +920,8 @@ pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||||
// don't lint about unused features. We should reenable this one day!
|
// don't lint about unused features. We should reenable this one day!
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unnecessary_stable_feature_lint<'tcx>(
|
fn unnecessary_stable_feature_lint(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
span: Span,
|
span: Span,
|
||||||
feature: Symbol,
|
feature: Symbol,
|
||||||
since: Symbol,
|
since: Symbol,
|
||||||
|
|
|
@ -2867,19 +2867,19 @@ impl<'tcx> graph::WithStartNode for Body<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> graph::WithPredecessors for Body<'tcx> {
|
impl<'tcx> graph::WithPredecessors for Body<'tcx> {
|
||||||
fn predecessors<'graph>(
|
fn predecessors(
|
||||||
&'graph self,
|
&self,
|
||||||
node: Self::Node,
|
node: Self::Node,
|
||||||
) -> <Self as GraphPredecessors<'graph>>::Iter {
|
) -> <Self as GraphPredecessors<'_>>::Iter {
|
||||||
self.predecessors_for(node).clone().into_iter()
|
self.predecessors_for(node).clone().into_iter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> graph::WithSuccessors for Body<'tcx> {
|
impl<'tcx> graph::WithSuccessors for Body<'tcx> {
|
||||||
fn successors<'graph>(
|
fn successors(
|
||||||
&'graph self,
|
&self,
|
||||||
node: Self::Node,
|
node: Self::Node,
|
||||||
) -> <Self as GraphSuccessors<'graph>>::Iter {
|
) -> <Self as GraphSuccessors<'_>>::Iter {
|
||||||
self.basic_blocks[node].terminator().successors().cloned()
|
self.basic_blocks[node].terminator().successors().cloned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,11 +269,11 @@ impl OutputTypes {
|
||||||
self.0.contains_key(key)
|
self.0.contains_key(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn keys<'a>(&'a self) -> BTreeMapKeysIter<'a, OutputType, Option<PathBuf>> {
|
pub fn keys(&self) -> BTreeMapKeysIter<'_, OutputType, Option<PathBuf>> {
|
||||||
self.0.keys()
|
self.0.keys()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn values<'a>(&'a self) -> BTreeMapValuesIter<'a, OutputType, Option<PathBuf>> {
|
pub fn values(&self) -> BTreeMapValuesIter<'_, OutputType, Option<PathBuf>> {
|
||||||
self.0.values()
|
self.0.values()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ impl Externs {
|
||||||
self.0.get(key)
|
self.0.get(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter<'a>(&'a self) -> BTreeMapIter<'a, String, ExternEntry> {
|
pub fn iter(&self) -> BTreeMapIter<'_, String, ExternEntry> {
|
||||||
self.0.iter()
|
self.0.iter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,66 +215,66 @@ impl Session {
|
||||||
*self.crate_disambiguator.get()
|
*self.crate_disambiguator.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn struct_span_warn<'a, S: Into<MultiSpan>>(
|
pub fn struct_span_warn<S: Into<MultiSpan>>(
|
||||||
&'a self,
|
&self,
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: &str,
|
msg: &str,
|
||||||
) -> DiagnosticBuilder<'a> {
|
) -> DiagnosticBuilder<'_> {
|
||||||
self.diagnostic().struct_span_warn(sp, msg)
|
self.diagnostic().struct_span_warn(sp, msg)
|
||||||
}
|
}
|
||||||
pub fn struct_span_warn_with_code<'a, S: Into<MultiSpan>>(
|
pub fn struct_span_warn_with_code<S: Into<MultiSpan>>(
|
||||||
&'a self,
|
&self,
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: &str,
|
msg: &str,
|
||||||
code: DiagnosticId,
|
code: DiagnosticId,
|
||||||
) -> DiagnosticBuilder<'a> {
|
) -> DiagnosticBuilder<'_> {
|
||||||
self.diagnostic().struct_span_warn_with_code(sp, msg, code)
|
self.diagnostic().struct_span_warn_with_code(sp, msg, code)
|
||||||
}
|
}
|
||||||
pub fn struct_warn<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
|
pub fn struct_warn(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||||
self.diagnostic().struct_warn(msg)
|
self.diagnostic().struct_warn(msg)
|
||||||
}
|
}
|
||||||
pub fn struct_span_err<'a, S: Into<MultiSpan>>(
|
pub fn struct_span_err<S: Into<MultiSpan>>(
|
||||||
&'a self,
|
&self,
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: &str,
|
msg: &str,
|
||||||
) -> DiagnosticBuilder<'a> {
|
) -> DiagnosticBuilder<'_> {
|
||||||
self.diagnostic().struct_span_err(sp, msg)
|
self.diagnostic().struct_span_err(sp, msg)
|
||||||
}
|
}
|
||||||
pub fn struct_span_err_with_code<'a, S: Into<MultiSpan>>(
|
pub fn struct_span_err_with_code<S: Into<MultiSpan>>(
|
||||||
&'a self,
|
&self,
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: &str,
|
msg: &str,
|
||||||
code: DiagnosticId,
|
code: DiagnosticId,
|
||||||
) -> DiagnosticBuilder<'a> {
|
) -> DiagnosticBuilder<'_> {
|
||||||
self.diagnostic().struct_span_err_with_code(sp, msg, code)
|
self.diagnostic().struct_span_err_with_code(sp, msg, code)
|
||||||
}
|
}
|
||||||
// FIXME: This method should be removed (every error should have an associated error code).
|
// 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<'_> {
|
||||||
self.diagnostic().struct_err(msg)
|
self.diagnostic().struct_err(msg)
|
||||||
}
|
}
|
||||||
pub fn struct_err_with_code<'a>(
|
pub fn struct_err_with_code(
|
||||||
&'a self,
|
&self,
|
||||||
msg: &str,
|
msg: &str,
|
||||||
code: DiagnosticId,
|
code: DiagnosticId,
|
||||||
) -> DiagnosticBuilder<'a> {
|
) -> DiagnosticBuilder<'_> {
|
||||||
self.diagnostic().struct_err_with_code(msg, code)
|
self.diagnostic().struct_err_with_code(msg, code)
|
||||||
}
|
}
|
||||||
pub fn struct_span_fatal<'a, S: Into<MultiSpan>>(
|
pub fn struct_span_fatal<S: Into<MultiSpan>>(
|
||||||
&'a self,
|
&self,
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: &str,
|
msg: &str,
|
||||||
) -> DiagnosticBuilder<'a> {
|
) -> DiagnosticBuilder<'_> {
|
||||||
self.diagnostic().struct_span_fatal(sp, msg)
|
self.diagnostic().struct_span_fatal(sp, msg)
|
||||||
}
|
}
|
||||||
pub fn struct_span_fatal_with_code<'a, S: Into<MultiSpan>>(
|
pub fn struct_span_fatal_with_code<S: Into<MultiSpan>>(
|
||||||
&'a self,
|
&self,
|
||||||
sp: S,
|
sp: S,
|
||||||
msg: &str,
|
msg: &str,
|
||||||
code: DiagnosticId,
|
code: DiagnosticId,
|
||||||
) -> DiagnosticBuilder<'a> {
|
) -> DiagnosticBuilder<'_> {
|
||||||
self.diagnostic().struct_span_fatal_with_code(sp, msg, code)
|
self.diagnostic().struct_span_fatal_with_code(sp, msg, code)
|
||||||
}
|
}
|
||||||
pub fn struct_fatal<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
|
pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||||
self.diagnostic().struct_fatal(msg)
|
self.diagnostic().struct_fatal(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ impl Session {
|
||||||
pub fn next_node_id(&self) -> NodeId {
|
pub fn next_node_id(&self) -> NodeId {
|
||||||
self.reserve_node_ids(1)
|
self.reserve_node_ids(1)
|
||||||
}
|
}
|
||||||
pub fn diagnostic<'a>(&'a self) -> &'a errors::Handler {
|
pub fn diagnostic(&self) -> &errors::Handler {
|
||||||
&self.parse_sess.span_diagnostic
|
&self.parse_sess.span_diagnostic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ impl Session {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn source_map<'a>(&'a self) -> &'a source_map::SourceMap {
|
pub fn source_map(&self) -> &source_map::SourceMap {
|
||||||
self.parse_sess.source_map()
|
self.parse_sess.source_map()
|
||||||
}
|
}
|
||||||
pub fn verbose(&self) -> bool {
|
pub fn verbose(&self) -> bool {
|
||||||
|
|
|
@ -145,8 +145,8 @@ pub fn find_associated_item<'tcx>(
|
||||||
/// Specialization is determined by the sets of types to which the impls apply;
|
/// Specialization is determined by the sets of types to which the impls apply;
|
||||||
/// `impl1` specializes `impl2` if it applies to a subset of the types `impl2` applies
|
/// `impl1` specializes `impl2` if it applies to a subset of the types `impl2` applies
|
||||||
/// to.
|
/// to.
|
||||||
pub(super) fn specializes<'tcx>(
|
pub(super) fn specializes(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
(impl1_def_id, impl2_def_id): (DefId, DefId),
|
(impl1_def_id, impl2_def_id): (DefId, DefId),
|
||||||
) -> bool {
|
) -> bool {
|
||||||
debug!("specializes({:?}, {:?})", impl1_def_id, impl2_def_id);
|
debug!("specializes({:?}, {:?})", impl1_def_id, impl2_def_id);
|
||||||
|
@ -282,10 +282,10 @@ fn fulfill_implication<'a, 'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query provider for `specialization_graph_of`.
|
// Query provider for `specialization_graph_of`.
|
||||||
pub(super) fn specialization_graph_provider<'tcx>(
|
pub(super) fn specialization_graph_provider(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
trait_id: DefId,
|
trait_id: DefId,
|
||||||
) -> &'tcx specialization_graph::Graph {
|
) -> &specialization_graph::Graph {
|
||||||
let mut sg = specialization_graph::Graph::new();
|
let mut sg = specialization_graph::Graph::new();
|
||||||
|
|
||||||
let mut trait_impls = tcx.all_impls(trait_id);
|
let mut trait_impls = tcx.all_impls(trait_id);
|
||||||
|
|
|
@ -306,9 +306,9 @@ impl<'sess> OnDiskCache<'sess> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads a diagnostic emitted during the previous compilation session.
|
/// Loads a diagnostic emitted during the previous compilation session.
|
||||||
pub fn load_diagnostics<'tcx>(
|
pub fn load_diagnostics(
|
||||||
&self,
|
&self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
dep_node_index: SerializedDepNodeIndex,
|
dep_node_index: SerializedDepNodeIndex,
|
||||||
) -> Vec<Diagnostic> {
|
) -> Vec<Diagnostic> {
|
||||||
let diagnostics: Option<EncodedDiagnostics> = self.load_indexed(
|
let diagnostics: Option<EncodedDiagnostics> = self.load_indexed(
|
||||||
|
@ -335,9 +335,9 @@ impl<'sess> OnDiskCache<'sess> {
|
||||||
|
|
||||||
/// Returns the cached query result if there is something in the cache for
|
/// Returns the cached query result if there is something in the cache for
|
||||||
/// the given `SerializedDepNodeIndex`; otherwise returns `None`.
|
/// the given `SerializedDepNodeIndex`; otherwise returns `None`.
|
||||||
pub fn try_load_query_result<'tcx, T>(
|
pub fn try_load_query_result<T>(
|
||||||
&self,
|
&self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
dep_node_index: SerializedDepNodeIndex,
|
dep_node_index: SerializedDepNodeIndex,
|
||||||
) -> Option<T>
|
) -> Option<T>
|
||||||
where
|
where
|
||||||
|
|
|
@ -1166,7 +1166,7 @@ macro_rules! define_provider_struct {
|
||||||
/// then `force_from_dep_node()` should not fail for it. Otherwise, you can just
|
/// then `force_from_dep_node()` should not fail for it. Otherwise, you can just
|
||||||
/// add it to the "We don't have enough information to reconstruct..." group in
|
/// add it to the "We don't have enough information to reconstruct..." group in
|
||||||
/// the match below.
|
/// the match below.
|
||||||
pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool {
|
pub fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: &DepNode) -> bool {
|
||||||
use crate::dep_graph::RecoverKey;
|
use crate::dep_graph::RecoverKey;
|
||||||
|
|
||||||
// We must avoid ever having to call force_from_dep_node() for a
|
// We must avoid ever having to call force_from_dep_node() for a
|
||||||
|
|
|
@ -273,7 +273,7 @@ impl CleanupKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cleanup_kinds<'tcx>(mir: &mir::Body<'tcx>) -> IndexVec<mir::BasicBlock, CleanupKind> {
|
pub fn cleanup_kinds(mir: &mir::Body<'_>) -> IndexVec<mir::BasicBlock, CleanupKind> {
|
||||||
fn discover_masters<'tcx>(result: &mut IndexVec<mir::BasicBlock, CleanupKind>,
|
fn discover_masters<'tcx>(result: &mut IndexVec<mir::BasicBlock, CleanupKind>,
|
||||||
mir: &mir::Body<'tcx>) {
|
mir: &mir::Body<'tcx>) {
|
||||||
for (bb, data) in mir.basic_blocks().iter_enumerated() {
|
for (bb, data) in mir.basic_blocks().iter_enumerated() {
|
||||||
|
|
|
@ -206,7 +206,7 @@ impl Assertion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_dirty_clean_annotations<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) {
|
||||||
// can't add `#[rustc_dirty]` etc without opting in to this feature
|
// can't add `#[rustc_dirty]` etc without opting in to this feature
|
||||||
if !tcx.features().rustc_attrs {
|
if !tcx.features().rustc_attrs {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -15,7 +15,7 @@ use super::fs::*;
|
||||||
use super::file_format;
|
use super::file_format;
|
||||||
use super::work_product;
|
use super::work_product;
|
||||||
|
|
||||||
pub fn dep_graph_tcx_init<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn dep_graph_tcx_init(tcx: TyCtxt<'_>) {
|
||||||
if !tcx.dep_graph.is_fully_enabled() {
|
if !tcx.dep_graph.is_fully_enabled() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_query_result_cache<'sess>(sess: &'sess Session) -> OnDiskCache<'sess> {
|
pub fn load_query_result_cache(sess: &Session) -> OnDiskCache<'_> {
|
||||||
if sess.opts.incremental.is_none() ||
|
if sess.opts.incremental.is_none() ||
|
||||||
!sess.opts.debugging_opts.incremental_queries {
|
!sess.opts.debugging_opts.incremental_queries {
|
||||||
return OnDiskCache::new_empty(sess.source_map());
|
return OnDiskCache::new_empty(sess.source_map());
|
||||||
|
|
|
@ -15,7 +15,7 @@ use super::dirty_clean;
|
||||||
use super::file_format;
|
use super::file_format;
|
||||||
use super::work_product;
|
use super::work_product;
|
||||||
|
|
||||||
pub fn save_dep_graph<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn save_dep_graph(tcx: TyCtxt<'_>) {
|
||||||
debug!("save_dep_graph()");
|
debug!("save_dep_graph()");
|
||||||
tcx.dep_graph.with_ignore(|| {
|
tcx.dep_graph.with_ignore(|| {
|
||||||
let sess = tcx.sess;
|
let sess = tcx.sess;
|
||||||
|
|
|
@ -162,7 +162,7 @@ impl<N: Idx> LivenessValues<N> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate through each region that has a value in this set.
|
/// Iterate through each region that has a value in this set.
|
||||||
crate fn rows<'a>(&'a self) -> impl Iterator<Item = N> {
|
crate fn rows(&self) -> impl Iterator<Item=N> {
|
||||||
self.points.rows()
|
self.points.rows()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -826,6 +826,6 @@ impl Test<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_switch_ty<'tcx>(ty: Ty<'tcx>) -> bool {
|
fn is_switch_ty(ty: Ty<'_>) -> bool {
|
||||||
ty.is_integral() || ty.is_char() || ty.is_bool()
|
ty.is_integral() || ty.is_char() || ty.is_bool()
|
||||||
}
|
}
|
||||||
|
|
|
@ -835,7 +835,7 @@ impl<'tcx> IntRange<'tcx> {
|
||||||
fn from_ctor(tcx: TyCtxt<'tcx>, ctor: &Constructor<'tcx>) -> Option<IntRange<'tcx>> {
|
fn from_ctor(tcx: TyCtxt<'tcx>, ctor: &Constructor<'tcx>) -> Option<IntRange<'tcx>> {
|
||||||
// Floating-point ranges are permitted and we don't want
|
// Floating-point ranges are permitted and we don't want
|
||||||
// to consider them when constructing integer ranges.
|
// to consider them when constructing integer ranges.
|
||||||
fn is_integral<'tcx>(ty: Ty<'tcx>) -> bool {
|
fn is_integral(ty: Ty<'_>) -> bool {
|
||||||
match ty.sty {
|
match ty.sty {
|
||||||
ty::Char | ty::Int(_) | ty::Uint(_) => true,
|
ty::Char | ty::Int(_) | ty::Uint(_) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|
|
@ -26,7 +26,7 @@ use std::slice;
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use syntax_pos::{Span, DUMMY_SP, MultiSpan};
|
use syntax_pos::{Span, DUMMY_SP, MultiSpan};
|
||||||
|
|
||||||
pub(crate) fn check_match<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
|
pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
|
||||||
let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) {
|
let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) {
|
||||||
tcx.hir().body_owned_by(id)
|
tcx.hir().body_owned_by(id)
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,7 +43,7 @@ pub(crate) fn check_match<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
|
||||||
}.visit_body(tcx.hir().body(body_id));
|
}.visit_body(tcx.hir().body(body_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> DiagnosticBuilder<'a> {
|
fn create_e0004(sess: &Session, sp: Span, error_message: String) -> DiagnosticBuilder<'_> {
|
||||||
struct_span_err!(sess, sp, E0004, "{}", &error_message)
|
struct_span_err!(sess, sp, E0004, "{}", &error_message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,10 +281,10 @@ impl<'tcx> InliningMap<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn collect_crate_mono_items<'tcx>(
|
pub fn collect_crate_mono_items(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
mode: MonoItemCollectionMode,
|
mode: MonoItemCollectionMode,
|
||||||
) -> (FxHashSet<MonoItem<'tcx>>, InliningMap<'tcx>) {
|
) -> (FxHashSet<MonoItem<'_>>, InliningMap<'_>) {
|
||||||
let roots = time(tcx.sess, "collecting roots", || {
|
let roots = time(tcx.sess, "collecting roots", || {
|
||||||
collect_roots(tcx, mode)
|
collect_roots(tcx, mode)
|
||||||
});
|
});
|
||||||
|
@ -315,7 +315,7 @@ pub fn collect_crate_mono_items<'tcx>(
|
||||||
|
|
||||||
// Find all non-generic items by walking the HIR. These items serve as roots to
|
// Find all non-generic items by walking the HIR. These items serve as roots to
|
||||||
// start monomorphizing from.
|
// start monomorphizing from.
|
||||||
fn collect_roots<'tcx>(tcx: TyCtxt<'tcx>, mode: MonoItemCollectionMode) -> Vec<MonoItem<'tcx>> {
|
fn collect_roots(tcx: TyCtxt<'_>, mode: MonoItemCollectionMode) -> Vec<MonoItem<'_>> {
|
||||||
debug!("Collecting roots");
|
debug!("Collecting roots");
|
||||||
let mut roots = Vec::new();
|
let mut roots = Vec::new();
|
||||||
|
|
||||||
|
@ -912,7 +912,7 @@ fn find_vtable_types_for_unsizing<'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_fn_mono_item<'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> {
|
fn create_fn_mono_item(instance: Instance<'_>) -> MonoItem<'_> {
|
||||||
debug!("create_fn_mono_item(instance={})", instance);
|
debug!("create_fn_mono_item(instance={})", instance);
|
||||||
MonoItem::Fn(instance)
|
MonoItem::Fn(instance)
|
||||||
}
|
}
|
||||||
|
@ -1114,7 +1114,7 @@ impl RootCollector<'_, 'v> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn item_requires_monomorphization<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
|
fn item_requires_monomorphization(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||||
let generics = tcx.generics_of(def_id);
|
let generics = tcx.generics_of(def_id);
|
||||||
generics.requires_monomorphization(tcx)
|
generics.requires_monomorphization(tcx)
|
||||||
}
|
}
|
||||||
|
@ -1243,7 +1243,7 @@ fn collect_neighbours<'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> String {
|
fn def_id_to_string(tcx: TyCtxt<'_>, def_id: DefId) -> String {
|
||||||
let mut output = String::new();
|
let mut output = String::new();
|
||||||
let printer = DefPathBasedNames::new(tcx, false, false);
|
let printer = DefPathBasedNames::new(tcx, false, false);
|
||||||
printer.push_def_path(def_id, &mut output);
|
printer.push_def_path(def_id, &mut output);
|
||||||
|
|
|
@ -839,10 +839,10 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_and_partition_mono_items<'tcx>(
|
fn collect_and_partition_mono_items(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
cnum: CrateNum,
|
cnum: CrateNum,
|
||||||
) -> (Arc<DefIdSet>, Arc<Vec<Arc<CodegenUnit<'tcx>>>>) {
|
) -> (Arc<DefIdSet>, Arc<Vec<Arc<CodegenUnit<'_>>>>) {
|
||||||
assert_eq!(cnum, LOCAL_CRATE);
|
assert_eq!(cnum, LOCAL_CRATE);
|
||||||
|
|
||||||
let collection_mode = match tcx.sess.opts.debugging_opts.print_mono_items {
|
let collection_mode = match tcx.sess.opts.debugging_opts.print_mono_items {
|
||||||
|
|
|
@ -8,8 +8,8 @@ use std::io::{self, Write};
|
||||||
use super::pretty::dump_mir_def_ids;
|
use super::pretty::dump_mir_def_ids;
|
||||||
|
|
||||||
/// Write a graphviz DOT graph of a list of MIRs.
|
/// Write a graphviz DOT graph of a list of MIRs.
|
||||||
pub fn write_mir_graphviz<'tcx, W>(
|
pub fn write_mir_graphviz<W>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
single: Option<DefId>,
|
single: Option<DefId>,
|
||||||
w: &mut W,
|
w: &mut W,
|
||||||
) -> io::Result<()>
|
) -> io::Result<()>
|
||||||
|
|
|
@ -56,8 +56,8 @@ pub struct LivenessResult {
|
||||||
|
|
||||||
/// Computes which local variables are live within the given function
|
/// Computes which local variables are live within the given function
|
||||||
/// `mir`, including drops.
|
/// `mir`, including drops.
|
||||||
pub fn liveness_of_locals<'tcx>(
|
pub fn liveness_of_locals(
|
||||||
body: &Body<'tcx>,
|
body: &Body<'_>,
|
||||||
) -> LivenessResult {
|
) -> LivenessResult {
|
||||||
let num_live_vars = body.local_decls.len();
|
let num_live_vars = body.local_decls.len();
|
||||||
|
|
||||||
|
@ -243,8 +243,8 @@ impl<'tcx> Visitor<'tcx> for DefsUsesVisitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block<'tcx>(
|
fn block(
|
||||||
b: &BasicBlockData<'tcx>,
|
b: &BasicBlockData<'_>,
|
||||||
locals: usize,
|
locals: usize,
|
||||||
) -> DefsUses {
|
) -> DefsUses {
|
||||||
let mut visitor = DefsUsesVisitor {
|
let mut visitor = DefsUsesVisitor {
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub use self::graphviz::{graphviz_safe_def_name, write_mir_graphviz};
|
||||||
pub use self::graphviz::write_node_label as write_graphviz_node_label;
|
pub use self::graphviz::write_node_label as write_graphviz_node_label;
|
||||||
|
|
||||||
/// If possible, suggest replacing `ref` with `ref mut`.
|
/// If possible, suggest replacing `ref` with `ref mut`.
|
||||||
pub fn suggest_ref_mut<'tcx>(tcx: TyCtxt<'tcx>, binding_span: Span) -> Option<(String)> {
|
pub fn suggest_ref_mut(tcx: TyCtxt<'_>, binding_span: Span) -> Option<(String)> {
|
||||||
let hi_src = tcx.sess.source_map().span_to_snippet(binding_span).unwrap();
|
let hi_src = tcx.sess.source_map().span_to_snippet(binding_span).unwrap();
|
||||||
if hi_src.starts_with("ref")
|
if hi_src.starts_with("ref")
|
||||||
&& hi_src["ref".len()..].starts_with(Pattern_White_Space)
|
&& hi_src["ref".len()..].starts_with(Pattern_White_Space)
|
||||||
|
|
|
@ -198,9 +198,9 @@ enum ResolutionError<'a> {
|
||||||
///
|
///
|
||||||
/// This takes the error provided, combines it with the span and any additional spans inside the
|
/// This takes the error provided, combines it with the span and any additional spans inside the
|
||||||
/// error and emits it.
|
/// error and emits it.
|
||||||
fn resolve_error<'sess, 'a>(resolver: &'sess Resolver<'_>,
|
fn resolve_error(resolver: &Resolver<'_>,
|
||||||
span: Span,
|
span: Span,
|
||||||
resolution_error: ResolutionError<'a>) {
|
resolution_error: ResolutionError<'_>) {
|
||||||
resolve_struct_error(resolver, span, resolution_error).emit();
|
resolve_struct_error(resolver, span, resolution_error).emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::lowering::Lower;
|
||||||
use crate::generic_types;
|
use crate::generic_types;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
crate fn wf_clause_for_raw_ptr<'tcx>(tcx: TyCtxt<'tcx>, mutbl: hir::Mutability) -> Clauses<'tcx> {
|
crate fn wf_clause_for_raw_ptr(tcx: TyCtxt<'_>, mutbl: hir::Mutability) -> Clauses<'_> {
|
||||||
let ptr_ty = generic_types::raw_ptr(tcx, mutbl);
|
let ptr_ty = generic_types::raw_ptr(tcx, mutbl);
|
||||||
|
|
||||||
let wf_clause = ProgramClause {
|
let wf_clause = ProgramClause {
|
||||||
|
@ -29,13 +29,13 @@ crate fn wf_clause_for_raw_ptr<'tcx>(tcx: TyCtxt<'tcx>, mutbl: hir::Mutability)
|
||||||
tcx.mk_clauses(iter::once(wf_clause))
|
tcx.mk_clauses(iter::once(wf_clause))
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn wf_clause_for_fn_ptr<'tcx>(
|
crate fn wf_clause_for_fn_ptr(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
arity_and_output: usize,
|
arity_and_output: usize,
|
||||||
variadic: bool,
|
variadic: bool,
|
||||||
unsafety: hir::Unsafety,
|
unsafety: hir::Unsafety,
|
||||||
abi: abi::Abi,
|
abi: abi::Abi,
|
||||||
) -> Clauses<'tcx> {
|
) -> Clauses<'_> {
|
||||||
let fn_ptr = generic_types::fn_ptr(tcx, arity_and_output, variadic, unsafety, abi);
|
let fn_ptr = generic_types::fn_ptr(tcx, arity_and_output, variadic, unsafety, abi);
|
||||||
|
|
||||||
let wf_clause = ProgramClause {
|
let wf_clause = ProgramClause {
|
||||||
|
@ -50,7 +50,7 @@ crate fn wf_clause_for_fn_ptr<'tcx>(
|
||||||
tcx.mk_clauses(iter::once(wf_clause))
|
tcx.mk_clauses(iter::once(wf_clause))
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'tcx>) -> Clauses<'tcx> {
|
crate fn wf_clause_for_slice(tcx: TyCtxt<'_>) -> Clauses<'_> {
|
||||||
let ty = generic_types::bound(tcx, 0);
|
let ty = generic_types::bound(tcx, 0);
|
||||||
let slice_ty = tcx.mk_slice(ty);
|
let slice_ty = tcx.mk_slice(ty);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ crate fn wf_clause_for_array<'tcx>(
|
||||||
tcx.mk_clauses(iter::once(wf_clause))
|
tcx.mk_clauses(iter::once(wf_clause))
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn wf_clause_for_tuple<'tcx>(tcx: TyCtxt<'tcx>, arity: usize) -> Clauses<'tcx> {
|
crate fn wf_clause_for_tuple(tcx: TyCtxt<'_>, arity: usize) -> Clauses<'_> {
|
||||||
let type_list = generic_types::type_list(tcx, arity);
|
let type_list = generic_types::type_list(tcx, arity);
|
||||||
let tuple_ty = tcx.mk_ty(ty::Tuple(type_list));
|
let tuple_ty = tcx.mk_ty(ty::Tuple(type_list));
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ crate fn wf_clause_for_tuple<'tcx>(tcx: TyCtxt<'tcx>, arity: usize) -> Clauses<'
|
||||||
tcx.mk_clauses(iter::once(wf_clause))
|
tcx.mk_clauses(iter::once(wf_clause))
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn wf_clause_for_ref<'tcx>(tcx: TyCtxt<'tcx>, mutbl: hir::Mutability) -> Clauses<'tcx> {
|
crate fn wf_clause_for_ref(tcx: TyCtxt<'_>, mutbl: hir::Mutability) -> Clauses<'_> {
|
||||||
let region = tcx.mk_region(
|
let region = tcx.mk_region(
|
||||||
ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0))
|
ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0))
|
||||||
);
|
);
|
||||||
|
@ -176,7 +176,7 @@ crate fn wf_clause_for_ref<'tcx>(tcx: TyCtxt<'tcx>, mutbl: hir::Mutability) -> C
|
||||||
tcx.mk_clauses(iter::once(wf_clause))
|
tcx.mk_clauses(iter::once(wf_clause))
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn wf_clause_for_fn_def<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Clauses<'tcx> {
|
crate fn wf_clause_for_fn_def(tcx: TyCtxt<'_>, def_id: DefId) -> Clauses<'_> {
|
||||||
let fn_def = generic_types::fn_def(tcx, def_id);
|
let fn_def = generic_types::fn_def(tcx, def_id);
|
||||||
|
|
||||||
let wf_clause = ProgramClause {
|
let wf_clause = ProgramClause {
|
||||||
|
|
|
@ -279,10 +279,10 @@ fn dtorck_constraint_for_ty<'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calculates the dtorck constraint for a type.
|
/// Calculates the dtorck constraint for a type.
|
||||||
crate fn adt_dtorck_constraint<'tcx>(
|
crate fn adt_dtorck_constraint(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> Result<DtorckConstraint<'tcx>, NoSolution> {
|
) -> Result<DtorckConstraint<'_>, NoSolution> {
|
||||||
let def = tcx.adt_def(def_id);
|
let def = tcx.adt_def(def_id);
|
||||||
let span = tcx.def_span(def_id);
|
let span = tcx.def_span(def_id);
|
||||||
debug!("dtorck_constraint: {:?}", def);
|
debug!("dtorck_constraint: {:?}", def);
|
||||||
|
@ -313,7 +313,7 @@ crate fn adt_dtorck_constraint<'tcx>(
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dedup_dtorck_constraint<'tcx>(c: &mut DtorckConstraint<'tcx>) {
|
fn dedup_dtorck_constraint(c: &mut DtorckConstraint<'_>) {
|
||||||
let mut outlives = FxHashSet::default();
|
let mut outlives = FxHashSet::default();
|
||||||
let mut dtorck_types = FxHashSet::default();
|
let mut dtorck_types = FxHashSet::default();
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ crate fn program_clauses_for_env<'tcx>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn environment<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Environment<'tcx> {
|
crate fn environment(tcx: TyCtxt<'_>, def_id: DefId) -> Environment<'_> {
|
||||||
use super::{Lower, IntoFromEnvGoal};
|
use super::{Lower, IntoFromEnvGoal};
|
||||||
use rustc::hir::{Node, TraitItemKind, ImplItemKind, ItemKind, ForeignItemKind};
|
use rustc::hir::{Node, TraitItemKind, ImplItemKind, ItemKind, ForeignItemKind};
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ impl<'tcx> IntoWellFormedGoal for DomainGoal<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn program_clauses_for<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Clauses<'tcx> {
|
crate fn program_clauses_for(tcx: TyCtxt<'_>, def_id: DefId) -> Clauses<'_> {
|
||||||
// FIXME(eddyb) this should only be using `def_kind`.
|
// FIXME(eddyb) this should only be using `def_kind`.
|
||||||
match tcx.def_key(def_id).disambiguated_data.data {
|
match tcx.def_key(def_id).disambiguated_data.data {
|
||||||
DefPathData::TypeNs(..) => match tcx.def_kind(def_id) {
|
DefPathData::TypeNs(..) => match tcx.def_kind(def_id) {
|
||||||
|
@ -181,7 +181,7 @@ crate fn program_clauses_for<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Clauses<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn program_clauses_for_trait<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Clauses<'tcx> {
|
fn program_clauses_for_trait(tcx: TyCtxt<'_>, def_id: DefId) -> Clauses<'_> {
|
||||||
// `trait Trait<P1..Pn> where WC { .. } // P0 == Self`
|
// `trait Trait<P1..Pn> where WC { .. } // P0 == Self`
|
||||||
|
|
||||||
// Rule Implemented-From-Env (see rustc guide)
|
// Rule Implemented-From-Env (see rustc guide)
|
||||||
|
@ -337,7 +337,7 @@ fn program_clauses_for_impl(tcx: TyCtxt<'tcx>, def_id: DefId) -> Clauses<'tcx> {
|
||||||
tcx.mk_clauses(iter::once(Clause::ForAll(ty::Binder::bind(clause))))
|
tcx.mk_clauses(iter::once(Clause::ForAll(ty::Binder::bind(clause))))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn program_clauses_for_type_def<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Clauses<'tcx> {
|
pub fn program_clauses_for_type_def(tcx: TyCtxt<'_>, def_id: DefId) -> Clauses<'_> {
|
||||||
// Rule WellFormed-Type
|
// Rule WellFormed-Type
|
||||||
//
|
//
|
||||||
// `struct Ty<P1..Pn> where WC1, ..., WCm`
|
// `struct Ty<P1..Pn> where WC1, ..., WCm`
|
||||||
|
@ -411,10 +411,10 @@ pub fn program_clauses_for_type_def<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> C
|
||||||
tcx.mk_clauses(iter::once(well_formed_clause).chain(from_env_clauses))
|
tcx.mk_clauses(iter::once(well_formed_clause).chain(from_env_clauses))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn program_clauses_for_associated_type_def<'tcx>(
|
pub fn program_clauses_for_associated_type_def(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
item_id: DefId,
|
item_id: DefId,
|
||||||
) -> Clauses<'tcx> {
|
) -> Clauses<'_> {
|
||||||
// Rule ProjectionEq-Placeholder
|
// Rule ProjectionEq-Placeholder
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
|
@ -549,10 +549,10 @@ pub fn program_clauses_for_associated_type_def<'tcx>(
|
||||||
tcx.mk_clauses(clauses)
|
tcx.mk_clauses(clauses)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn program_clauses_for_associated_type_value<'tcx>(
|
pub fn program_clauses_for_associated_type_value(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
item_id: DefId,
|
item_id: DefId,
|
||||||
) -> Clauses<'tcx> {
|
) -> Clauses<'_> {
|
||||||
// Rule Normalize-From-Impl (see rustc guide)
|
// Rule Normalize-From-Impl (see rustc guide)
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
|
@ -611,7 +611,7 @@ pub fn program_clauses_for_associated_type_value<'tcx>(
|
||||||
tcx.mk_clauses(iter::once(normalize_clause))
|
tcx.mk_clauses(iter::once(normalize_clause))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dump_program_clauses<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn dump_program_clauses(tcx: TyCtxt<'_>) {
|
||||||
if !tcx.features().rustc_attrs {
|
if !tcx.features().rustc_attrs {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -775,12 +775,12 @@ impl Ord for TraitInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves all traits in this crate and any dependent crates.
|
/// Retrieves all traits in this crate and any dependent crates.
|
||||||
pub fn all_traits<'tcx>(tcx: TyCtxt<'tcx>) -> Vec<TraitInfo> {
|
pub fn all_traits(tcx: TyCtxt<'_>) -> Vec<TraitInfo> {
|
||||||
tcx.all_traits(LOCAL_CRATE).iter().map(|&def_id| TraitInfo { def_id }).collect()
|
tcx.all_traits(LOCAL_CRATE).iter().map(|&def_id| TraitInfo { def_id }).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes all traits in this crate and any dependent crates.
|
/// Computes all traits in this crate and any dependent crates.
|
||||||
fn compute_all_traits<'tcx>(tcx: TyCtxt<'tcx>) -> Vec<DefId> {
|
fn compute_all_traits(tcx: TyCtxt<'_>) -> Vec<DefId> {
|
||||||
use hir::itemlikevisit;
|
use hir::itemlikevisit;
|
||||||
|
|
||||||
let mut traits = vec![];
|
let mut traits = vec![];
|
||||||
|
|
|
@ -13,7 +13,7 @@ use rustc::util::nodemap::DefIdSet;
|
||||||
|
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
|
|
||||||
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn check_crate(tcx: TyCtxt<'_>) {
|
||||||
let mut used_trait_imports = DefIdSet::default();
|
let mut used_trait_imports = DefIdSet::default();
|
||||||
for &body_id in tcx.hir().krate().bodies.keys() {
|
for &body_id in tcx.hir().krate().bodies.keys() {
|
||||||
let item_def_id = tcx.hir().body_owner_def_id(body_id);
|
let item_def_id = tcx.hir().body_owner_def_id(body_id);
|
||||||
|
@ -70,7 +70,7 @@ impl CheckVisitor<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx>) {
|
fn unused_crates_lint(tcx: TyCtxt<'_>) {
|
||||||
let lint = lint::builtin::UNUSED_EXTERN_CRATES;
|
let lint = lint::builtin::UNUSED_EXTERN_CRATES;
|
||||||
|
|
||||||
// Collect first the crates that are completely unused. These we
|
// Collect first the crates that are completely unused. These we
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct OnlySelfBounds(bool);
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Main entry point
|
// Main entry point
|
||||||
|
|
||||||
fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
|
fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
||||||
tcx.hir().visit_item_likes_in_module(
|
tcx.hir().visit_item_likes_in_module(
|
||||||
module_def_id,
|
module_def_id,
|
||||||
&mut CollectItemTypesVisitor { tcx }.as_deep_visitor()
|
&mut CollectItemTypesVisitor { tcx }.as_deep_visitor()
|
||||||
|
@ -253,10 +253,10 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn type_param_predicates<'tcx>(
|
fn type_param_predicates(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
(item_def_id, def_id): (DefId, DefId),
|
(item_def_id, def_id): (DefId, DefId),
|
||||||
) -> &'tcx ty::GenericPredicates<'tcx> {
|
) -> &ty::GenericPredicates<'_> {
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
|
|
||||||
// In the AST, bounds can derive from two places. Either
|
// In the AST, bounds can derive from two places. Either
|
||||||
|
@ -381,7 +381,7 @@ impl ItemCtxt<'tcx> {
|
||||||
/// parameter with ID `param_id`. We use this so as to avoid running
|
/// parameter with ID `param_id`. We use this so as to avoid running
|
||||||
/// `ast_ty_to_ty`, because we want to avoid triggering an all-out
|
/// `ast_ty_to_ty`, because we want to avoid triggering an all-out
|
||||||
/// conversion of the type to avoid inducing unnecessary cycles.
|
/// conversion of the type to avoid inducing unnecessary cycles.
|
||||||
fn is_param<'tcx>(tcx: TyCtxt<'tcx>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool {
|
fn is_param(tcx: TyCtxt<'_>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool {
|
||||||
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
|
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
|
||||||
match path.res {
|
match path.res {
|
||||||
Res::SelfTy(Some(def_id), None) | Res::Def(DefKind::TyParam, def_id) => {
|
Res::SelfTy(Some(def_id), None) | Res::Def(DefKind::TyParam, def_id) => {
|
||||||
|
@ -394,7 +394,7 @@ fn is_param<'tcx>(tcx: TyCtxt<'tcx>, ast_ty: &hir::Ty, param_id: hir::HirId) ->
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_item<'tcx>(tcx: TyCtxt<'tcx>, item_id: hir::HirId) {
|
fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
|
||||||
let it = tcx.hir().expect_item(item_id);
|
let it = tcx.hir().expect_item(item_id);
|
||||||
debug!("convert: item {} with id {}", it.ident, it.hir_id);
|
debug!("convert: item {} with id {}", it.ident, it.hir_id);
|
||||||
let def_id = tcx.hir().local_def_id_from_hir_id(item_id);
|
let def_id = tcx.hir().local_def_id_from_hir_id(item_id);
|
||||||
|
@ -476,7 +476,7 @@ fn convert_item<'tcx>(tcx: TyCtxt<'tcx>, item_id: hir::HirId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_trait_item<'tcx>(tcx: TyCtxt<'tcx>, trait_item_id: hir::HirId) {
|
fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::HirId) {
|
||||||
let trait_item = tcx.hir().expect_trait_item(trait_item_id);
|
let trait_item = tcx.hir().expect_trait_item(trait_item_id);
|
||||||
let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id);
|
let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id);
|
||||||
tcx.generics_of(def_id);
|
tcx.generics_of(def_id);
|
||||||
|
@ -497,7 +497,7 @@ fn convert_trait_item<'tcx>(tcx: TyCtxt<'tcx>, trait_item_id: hir::HirId) {
|
||||||
tcx.predicates_of(def_id);
|
tcx.predicates_of(def_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_impl_item<'tcx>(tcx: TyCtxt<'tcx>, impl_item_id: hir::HirId) {
|
fn convert_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::HirId) {
|
||||||
let def_id = tcx.hir().local_def_id_from_hir_id(impl_item_id);
|
let def_id = tcx.hir().local_def_id_from_hir_id(impl_item_id);
|
||||||
tcx.generics_of(def_id);
|
tcx.generics_of(def_id);
|
||||||
tcx.type_of(def_id);
|
tcx.type_of(def_id);
|
||||||
|
@ -507,7 +507,7 @@ fn convert_impl_item<'tcx>(tcx: TyCtxt<'tcx>, impl_item_id: hir::HirId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_variant_ctor<'tcx>(tcx: TyCtxt<'tcx>, ctor_id: hir::HirId) {
|
fn convert_variant_ctor(tcx: TyCtxt<'_>, ctor_id: hir::HirId) {
|
||||||
let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id);
|
let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id);
|
||||||
tcx.generics_of(def_id);
|
tcx.generics_of(def_id);
|
||||||
tcx.type_of(def_id);
|
tcx.type_of(def_id);
|
||||||
|
@ -562,8 +562,8 @@ fn convert_enum_variant_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, variants:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_variant<'tcx>(
|
fn convert_variant(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
variant_did: Option<DefId>,
|
variant_did: Option<DefId>,
|
||||||
ctor_did: Option<DefId>,
|
ctor_did: Option<DefId>,
|
||||||
ident: Ident,
|
ident: Ident,
|
||||||
|
@ -619,7 +619,7 @@ fn convert_variant<'tcx>(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn adt_def<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::AdtDef {
|
fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AdtDef {
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
|
|
||||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||||
|
@ -686,10 +686,10 @@ fn adt_def<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::AdtDef {
|
||||||
/// Ensures that the super-predicates of the trait with a `DefId`
|
/// Ensures that the super-predicates of the trait with a `DefId`
|
||||||
/// of `trait_def_id` are converted and stored. This also ensures that
|
/// of `trait_def_id` are converted and stored. This also ensures that
|
||||||
/// the transitive super-predicates are converted.
|
/// the transitive super-predicates are converted.
|
||||||
fn super_predicates_of<'tcx>(
|
fn super_predicates_of(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
trait_def_id: DefId,
|
trait_def_id: DefId,
|
||||||
) -> &'tcx ty::GenericPredicates<'tcx> {
|
) -> &ty::GenericPredicates<'_> {
|
||||||
debug!("super_predicates(trait_def_id={:?})", trait_def_id);
|
debug!("super_predicates(trait_def_id={:?})", trait_def_id);
|
||||||
let trait_hir_id = tcx.hir().as_local_hir_id(trait_def_id).unwrap();
|
let trait_hir_id = tcx.hir().as_local_hir_id(trait_def_id).unwrap();
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ fn super_predicates_of<'tcx>(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn trait_def<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::TraitDef {
|
fn trait_def(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::TraitDef {
|
||||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||||
let item = tcx.hir().expect_item(hir_id);
|
let item = tcx.hir().expect_item(hir_id);
|
||||||
|
|
||||||
|
@ -879,7 +879,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generics_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::Generics {
|
fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
|
|
||||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||||
|
@ -1122,7 +1122,7 @@ fn generics_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::Generics {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn report_assoc_ty_on_inherent_impl<'tcx>(tcx: TyCtxt<'tcx>, span: Span) {
|
fn report_assoc_ty_on_inherent_impl(tcx: TyCtxt<'_>, span: Span) {
|
||||||
span_err!(
|
span_err!(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
span,
|
span,
|
||||||
|
@ -1131,7 +1131,7 @@ fn report_assoc_ty_on_inherent_impl<'tcx>(tcx: TyCtxt<'tcx>, span: Span) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Ty<'tcx> {
|
fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||||
checked_type_of(tcx, def_id, true).unwrap()
|
checked_type_of(tcx, def_id, true).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1139,7 +1139,7 @@ fn type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Ty<'tcx> {
|
||||||
///
|
///
|
||||||
/// If you want to fail anyway, you can set the `fail` parameter to true, but in this case,
|
/// If you want to fail anyway, you can set the `fail` parameter to true, but in this case,
|
||||||
/// you'd better just call [`type_of`] directly.
|
/// you'd better just call [`type_of`] directly.
|
||||||
pub fn checked_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, fail: bool) -> Option<Ty<'tcx>> {
|
pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<'_>> {
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
|
|
||||||
let hir_id = match tcx.hir().as_local_hir_id(def_id) {
|
let hir_id = match tcx.hir().as_local_hir_id(def_id) {
|
||||||
|
@ -1464,7 +1464,7 @@ pub fn checked_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, fail: bool) -> Op
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_existential_constraints<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Ty<'tcx> {
|
fn find_existential_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||||
use rustc::hir::{ImplItem, Item, TraitItem};
|
use rustc::hir::{ImplItem, Item, TraitItem};
|
||||||
|
|
||||||
debug!("find_existential_constraints({:?})", def_id);
|
debug!("find_existential_constraints({:?})", def_id);
|
||||||
|
@ -1682,7 +1682,7 @@ fn find_existential_constraints<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Ty<'t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fn_sig<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> {
|
fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
use rustc::hir::Node::*;
|
use rustc::hir::Node::*;
|
||||||
|
|
||||||
|
@ -1758,7 +1758,7 @@ fn fn_sig<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn impl_trait_ref<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<ty::TraitRef<'tcx>> {
|
fn impl_trait_ref(tcx: TyCtxt<'_>, def_id: DefId) -> Option<ty::TraitRef<'_>> {
|
||||||
let icx = ItemCtxt::new(tcx, def_id);
|
let icx = ItemCtxt::new(tcx, def_id);
|
||||||
|
|
||||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||||
|
@ -1773,7 +1773,7 @@ fn impl_trait_ref<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<ty::TraitRef
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> hir::ImplPolarity {
|
fn impl_polarity(tcx: TyCtxt<'_>, def_id: DefId) -> hir::ImplPolarity {
|
||||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||||
match tcx.hir().expect_item(hir_id).node {
|
match tcx.hir().expect_item(hir_id).node {
|
||||||
hir::ItemKind::Impl(_, polarity, ..) => polarity,
|
hir::ItemKind::Impl(_, polarity, ..) => polarity,
|
||||||
|
@ -1804,10 +1804,10 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>(
|
||||||
/// Returns a list of type predicates for the definition with ID `def_id`, including inferred
|
/// Returns a list of type predicates for the definition with ID `def_id`, including inferred
|
||||||
/// lifetime constraints. This includes all predicates returned by `explicit_predicates_of`, plus
|
/// lifetime constraints. This includes all predicates returned by `explicit_predicates_of`, plus
|
||||||
/// inferred constraints concerning which regions outlive other regions.
|
/// inferred constraints concerning which regions outlive other regions.
|
||||||
fn predicates_defined_on<'tcx>(
|
fn predicates_defined_on(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> &'tcx ty::GenericPredicates<'tcx> {
|
) -> &ty::GenericPredicates<'_> {
|
||||||
debug!("predicates_defined_on({:?})", def_id);
|
debug!("predicates_defined_on({:?})", def_id);
|
||||||
let mut result = tcx.explicit_predicates_of(def_id);
|
let mut result = tcx.explicit_predicates_of(def_id);
|
||||||
debug!(
|
debug!(
|
||||||
|
@ -1834,7 +1834,7 @@ fn predicates_defined_on<'tcx>(
|
||||||
/// Returns a list of all type predicates (explicit and implicit) for the definition with
|
/// Returns a list of all type predicates (explicit and implicit) for the definition with
|
||||||
/// ID `def_id`. This includes all predicates returned by `predicates_defined_on`, plus
|
/// ID `def_id`. This includes all predicates returned by `predicates_defined_on`, plus
|
||||||
/// `Self: Trait` predicates for traits.
|
/// `Self: Trait` predicates for traits.
|
||||||
fn predicates_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::GenericPredicates<'tcx> {
|
fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::GenericPredicates<'_> {
|
||||||
let mut result = tcx.predicates_defined_on(def_id);
|
let mut result = tcx.predicates_defined_on(def_id);
|
||||||
|
|
||||||
if tcx.is_trait(def_id) {
|
if tcx.is_trait(def_id) {
|
||||||
|
@ -1861,10 +1861,10 @@ fn predicates_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::GenericPre
|
||||||
|
|
||||||
/// Returns a list of user-specified type predicates for the definition with ID `def_id`.
|
/// Returns a list of user-specified type predicates for the definition with ID `def_id`.
|
||||||
/// N.B., this does not include any implied/inferred constraints.
|
/// N.B., this does not include any implied/inferred constraints.
|
||||||
fn explicit_predicates_of<'tcx>(
|
fn explicit_predicates_of(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> &'tcx ty::GenericPredicates<'tcx> {
|
) -> &ty::GenericPredicates<'_> {
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
|
|
||||||
|
@ -2271,7 +2271,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
|
||||||
fty
|
fty
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
|
fn is_foreign_item(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||||
match tcx.hir().get_if_local(def_id) {
|
match tcx.hir().get_if_local(def_id) {
|
||||||
Some(Node::ForeignItem(..)) => true,
|
Some(Node::ForeignItem(..)) => true,
|
||||||
Some(_) => false,
|
Some(_) => false,
|
||||||
|
@ -2279,7 +2279,7 @@ fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn static_mutability<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<hir::Mutability> {
|
fn static_mutability(tcx: TyCtxt<'_>, def_id: DefId) -> Option<hir::Mutability> {
|
||||||
match tcx.hir().get_if_local(def_id) {
|
match tcx.hir().get_if_local(def_id) {
|
||||||
Some(Node::Item(&hir::Item {
|
Some(Node::Item(&hir::Item {
|
||||||
node: hir::ItemKind::Static(_, mutbl, _), ..
|
node: hir::ItemKind::Static(_, mutbl, _), ..
|
||||||
|
@ -2387,7 +2387,7 @@ fn from_target_feature(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn linkage_by_name<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, name: &str) -> Linkage {
|
fn linkage_by_name(tcx: TyCtxt<'_>, def_id: DefId, name: &str) -> Linkage {
|
||||||
use rustc::mir::mono::Linkage::*;
|
use rustc::mir::mono::Linkage::*;
|
||||||
|
|
||||||
// Use the names from src/llvm/docs/LangRef.rst here. Most types are only
|
// Use the names from src/llvm/docs/LangRef.rst here. Most types are only
|
||||||
|
@ -2422,7 +2422,7 @@ fn linkage_by_name<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, name: &str) -> Linkag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn codegen_fn_attrs<'tcx>(tcx: TyCtxt<'tcx>, id: DefId) -> CodegenFnAttrs {
|
fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
|
||||||
let attrs = tcx.get_attrs(id);
|
let attrs = tcx.get_attrs(id);
|
||||||
|
|
||||||
let mut codegen_fn_attrs = CodegenFnAttrs::new();
|
let mut codegen_fn_attrs = CodegenFnAttrs::new();
|
||||||
|
|
|
@ -49,7 +49,7 @@ use syntax_pos::Span;
|
||||||
/// impl<'a> Trait<Foo> for Bar { type X = &'a i32; }
|
/// impl<'a> Trait<Foo> for Bar { type X = &'a i32; }
|
||||||
/// // ^ 'a is unused and appears in assoc type, error
|
/// // ^ 'a is unused and appears in assoc type, error
|
||||||
/// ```
|
/// ```
|
||||||
pub fn impl_wf_check<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn impl_wf_check(tcx: TyCtxt<'_>) {
|
||||||
// We will tag this as part of the WF check -- logically, it is,
|
// We will tag this as part of the WF check -- logically, it is,
|
||||||
// but it's one that we must perform earlier than the rest of
|
// but it's one that we must perform earlier than the rest of
|
||||||
// WfCheck.
|
// WfCheck.
|
||||||
|
@ -58,7 +58,7 @@ pub fn impl_wf_check<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_mod_impl_wf<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
|
fn check_mod_impl_wf(tcx: TyCtxt<'_>, module_def_id: DefId) {
|
||||||
tcx.hir().visit_item_likes_in_module(
|
tcx.hir().visit_item_likes_in_module(
|
||||||
module_def_id,
|
module_def_id,
|
||||||
&mut ImplWfCheck { tcx }
|
&mut ImplWfCheck { tcx }
|
||||||
|
@ -92,8 +92,8 @@ impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> {
|
||||||
fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) { }
|
fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enforce_impl_params_are_constrained<'tcx>(
|
fn enforce_impl_params_are_constrained(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
impl_def_id: DefId,
|
impl_def_id: DefId,
|
||||||
impl_item_refs: &[hir::ImplItemRef],
|
impl_item_refs: &[hir::ImplItemRef],
|
||||||
) {
|
) {
|
||||||
|
@ -183,7 +183,7 @@ fn report_unused_parameter(tcx: TyCtxt<'_>, span: Span, kind: &str, name: &str)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enforce that we do not have two items in an impl with the same name.
|
/// Enforce that we do not have two items in an impl with the same name.
|
||||||
fn enforce_impl_items_are_distinct<'tcx>(tcx: TyCtxt<'tcx>, impl_item_refs: &[hir::ImplItemRef]) {
|
fn enforce_impl_items_are_distinct(tcx: TyCtxt<'_>, impl_item_refs: &[hir::ImplItemRef]) {
|
||||||
let mut seen_type_items = FxHashMap::default();
|
let mut seen_type_items = FxHashMap::default();
|
||||||
let mut seen_value_items = FxHashMap::default();
|
let mut seen_value_items = FxHashMap::default();
|
||||||
for impl_item_ref in impl_item_refs {
|
for impl_item_ref in impl_item_refs {
|
||||||
|
|
|
@ -161,7 +161,7 @@ fn require_same_types<'tcx>(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx>, main_def_id: DefId) {
|
fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
|
||||||
let main_id = tcx.hir().as_local_hir_id(main_def_id).unwrap();
|
let main_id = tcx.hir().as_local_hir_id(main_def_id).unwrap();
|
||||||
let main_span = tcx.def_span(main_def_id);
|
let main_span = tcx.def_span(main_def_id);
|
||||||
let main_t = tcx.type_of(main_def_id);
|
let main_t = tcx.type_of(main_def_id);
|
||||||
|
@ -226,7 +226,7 @@ fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx>, main_def_id: DefId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx>, start_def_id: DefId) {
|
fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
|
||||||
let start_id = tcx.hir().as_local_hir_id(start_def_id).unwrap();
|
let start_id = tcx.hir().as_local_hir_id(start_def_id).unwrap();
|
||||||
let start_span = tcx.def_span(start_def_id);
|
let start_span = tcx.def_span(start_def_id);
|
||||||
let start_t = tcx.type_of(start_def_id);
|
let start_t = tcx.type_of(start_def_id);
|
||||||
|
@ -283,7 +283,7 @@ fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx>, start_def_id: DefId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_for_entry_fn<'tcx>(tcx: TyCtxt<'tcx>) {
|
fn check_for_entry_fn(tcx: TyCtxt<'_>) {
|
||||||
match tcx.entry_fn(LOCAL_CRATE) {
|
match tcx.entry_fn(LOCAL_CRATE) {
|
||||||
Some((def_id, EntryFnType::Main)) => check_main_fn_ty(tcx, def_id),
|
Some((def_id, EntryFnType::Main)) => check_main_fn_ty(tcx, def_id),
|
||||||
Some((def_id, EntryFnType::Start)) => check_start_fn_ty(tcx, def_id),
|
Some((def_id, EntryFnType::Start)) => check_start_fn_ty(tcx, def_id),
|
||||||
|
@ -300,7 +300,7 @@ pub fn provide(providers: &mut Providers<'_>) {
|
||||||
impl_wf_check::provide(providers);
|
impl_wf_check::provide(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>) -> Result<(), ErrorReported> {
|
pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorReported> {
|
||||||
tcx.sess.profiler(|p| p.start_activity("type-check crate"));
|
tcx.sess.profiler(|p| p.start_activity("type-check crate"));
|
||||||
|
|
||||||
// this ensures that later parts of type checking can assume that items
|
// this ensures that later parts of type checking can assume that items
|
||||||
|
|
|
@ -20,10 +20,10 @@ pub fn provide(providers: &mut Providers<'_>) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inferred_outlives_of<'tcx>(
|
fn inferred_outlives_of(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
item_def_id: DefId,
|
item_def_id: DefId,
|
||||||
) -> &'tcx [ty::Predicate<'tcx>] {
|
) -> &[ty::Predicate<'_>] {
|
||||||
let id = tcx
|
let id = tcx
|
||||||
.hir()
|
.hir()
|
||||||
.as_local_hir_id(item_def_id)
|
.as_local_hir_id(item_def_id)
|
||||||
|
@ -70,10 +70,10 @@ fn inferred_outlives_of<'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inferred_outlives_crate<'tcx>(
|
fn inferred_outlives_crate(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
crate_num: CrateNum,
|
crate_num: CrateNum,
|
||||||
) -> &'tcx CratePredicatesMap<'tcx> {
|
) -> &CratePredicatesMap<'_> {
|
||||||
assert_eq!(crate_num, LOCAL_CRATE);
|
assert_eq!(crate_num, LOCAL_CRATE);
|
||||||
|
|
||||||
// Compute a map from each struct/enum/union S to the **explicit**
|
// Compute a map from each struct/enum/union S to the **explicit**
|
||||||
|
|
|
@ -3,7 +3,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||||
use rustc::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use syntax::symbol::sym;
|
use syntax::symbol::sym;
|
||||||
|
|
||||||
pub fn test_inferred_outlives<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn test_inferred_outlives(tcx: TyCtxt<'_>) {
|
||||||
tcx.hir()
|
tcx.hir()
|
||||||
.krate()
|
.krate()
|
||||||
.visit_all_item_likes(&mut OutlivesTest { tcx });
|
.visit_all_item_likes(&mut OutlivesTest { tcx });
|
||||||
|
|
|
@ -125,7 +125,7 @@ pub fn insert_outlives_predicate<'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_free_region<'tcx>(tcx: TyCtxt<'tcx>, region: Region<'_>) -> bool {
|
fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
|
||||||
// First, screen for regions that might appear in a type header.
|
// First, screen for regions that might appear in a type header.
|
||||||
match region {
|
match region {
|
||||||
// These correspond to `T: 'a` relationships:
|
// These correspond to `T: 'a` relationships:
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub fn provide(providers: &mut Providers<'_>) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn crate_variances<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> &'tcx CrateVariancesMap<'tcx> {
|
fn crate_variances(tcx: TyCtxt<'_>, crate_num: CrateNum) -> &CrateVariancesMap<'_> {
|
||||||
assert_eq!(crate_num, LOCAL_CRATE);
|
assert_eq!(crate_num, LOCAL_CRATE);
|
||||||
let mut arena = arena::TypedArena::default();
|
let mut arena = arena::TypedArena::default();
|
||||||
let terms_cx = terms::determine_parameters_to_be_inferred(tcx, &mut arena);
|
let terms_cx = terms::determine_parameters_to_be_inferred(tcx, &mut arena);
|
||||||
|
@ -42,7 +42,7 @@ fn crate_variances<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> &'tcx CrateV
|
||||||
tcx.arena.alloc(solve::solve_constraints(constraints_cx))
|
tcx.arena.alloc(solve::solve_constraints(constraints_cx))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn variances_of<'tcx>(tcx: TyCtxt<'tcx>, item_def_id: DefId) -> &'tcx [ty::Variance] {
|
fn variances_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[ty::Variance] {
|
||||||
let id = tcx.hir().as_local_hir_id(item_def_id).expect("expected local def-id");
|
let id = tcx.hir().as_local_hir_id(item_def_id).expect("expected local def-id");
|
||||||
let unsupported = || {
|
let unsupported = || {
|
||||||
// Variance not relevant.
|
// Variance not relevant.
|
||||||
|
|
|
@ -3,7 +3,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||||
use rustc::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use syntax::symbol::sym;
|
use syntax::symbol::sym;
|
||||||
|
|
||||||
pub fn test_variance<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub fn test_variance(tcx: TyCtxt<'_>) {
|
||||||
tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx });
|
tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::html::markdown::{ErrorCodes, IdMap, Markdown, MarkdownWithToc, find_t
|
||||||
use crate::test::{TestOptions, Collector};
|
use crate::test::{TestOptions, Collector};
|
||||||
|
|
||||||
/// Separate any lines at the start of the file that begin with `# ` or `%`.
|
/// Separate any lines at the start of the file that begin with `# ` or `%`.
|
||||||
fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
|
fn extract_leading_metadata(s: &str) -> (Vec<&str>, &str) {
|
||||||
let mut metadata = Vec::new();
|
let mut metadata = Vec::new();
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
|
|
||||||
|
|
|
@ -1031,7 +1031,7 @@ impl Json {
|
||||||
|
|
||||||
/// If the Json value is an Object, returns the value associated with the provided key.
|
/// If the Json value is an Object, returns the value associated with the provided key.
|
||||||
/// Otherwise, returns None.
|
/// Otherwise, returns None.
|
||||||
pub fn find<'a>(&'a self, key: &str) -> Option<&'a Json>{
|
pub fn find(&self, key: &str) -> Option<&Json> {
|
||||||
match *self {
|
match *self {
|
||||||
Json::Object(ref map) => map.get(key),
|
Json::Object(ref map) => map.get(key),
|
||||||
_ => None
|
_ => None
|
||||||
|
@ -1052,7 +1052,7 @@ impl Json {
|
||||||
/// If the Json value is an Object, performs a depth-first search until
|
/// If the Json value is an Object, performs a depth-first search until
|
||||||
/// a value associated with the provided key is found. If no value is found
|
/// a value associated with the provided key is found. If no value is found
|
||||||
/// or the Json value is not an Object, returns `None`.
|
/// or the Json value is not an Object, returns `None`.
|
||||||
pub fn search<'a>(&'a self, key: &str) -> Option<&'a Json> {
|
pub fn search(&self, key: &str) -> Option<&Json> {
|
||||||
match self {
|
match self {
|
||||||
&Json::Object(ref map) => {
|
&Json::Object(ref map) => {
|
||||||
match map.get(key) {
|
match map.get(key) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ fn parse_assert<'a>(
|
||||||
Ok(Assert { cond_expr, custom_message })
|
Ok(Assert { cond_expr, custom_message })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_custom_message<'a>(parser: &mut Parser<'a>) -> Option<TokenStream> {
|
fn parse_custom_message(parser: &mut Parser<'_>) -> Option<TokenStream> {
|
||||||
let ts = parser.parse_tokens();
|
let ts = parser.parse_tokens();
|
||||||
if !ts.is_empty() {
|
if !ts.is_empty() {
|
||||||
Some(ts)
|
Some(ts)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue