Skip to main content

Module non_local_def

Module non_local_def 

Source

Re-exportsΒ§

use rustc_attr_ir::find_attr; πŸ”’
use rustc_errors::MultiSpan; πŸ”’
use rustc_errors::msg; πŸ”’
use rustc_hir::def::DefKind; πŸ”’
use rustc_hir::def::Res; πŸ”’
use rustc_hir::intravisit; πŸ”’
use rustc_hir::intravisit::Visitor; πŸ”’
use rustc_hir::Body; πŸ”’
use rustc_hir::HirId; πŸ”’
use rustc_hir::Item; πŸ”’
use rustc_hir::ItemKind; πŸ”’
use rustc_hir::Node; πŸ”’
use rustc_hir::Path; πŸ”’
use rustc_hir::TyKind; πŸ”’
use rustc_lint_defs::declare_lint; πŸ”’
use rustc_lint_defs::impl_lint_pass; πŸ”’
use rustc_middle::ty::TyCtxt; πŸ”’
use rustc_span::def_id::DefId; πŸ”’
use rustc_span::def_id::LOCAL_CRATE; πŸ”’
use rustc_span::ExpnKind; πŸ”’
use rustc_span::Span; πŸ”’
use rustc_span::kw; πŸ”’
use crate::diagnostics::NonLocalDefinitionsCargoUpdateNote; πŸ”’
use crate::diagnostics::NonLocalDefinitionsDiag; πŸ”’
use crate::LateContext; πŸ”’
use crate::LateLintPass; πŸ”’
use crate::LintContext; πŸ”’

StructsΒ§

NonLocalDefinitions πŸ”’
PathCollector πŸ”’
Simple hir::Path collector

StaticsΒ§

NON_LOCAL_DEFINITIONS
The non_local_definitions lint checks for impl blocks and #[macro_export] macro inside bodies (functions, enum discriminant, …).

FunctionsΒ§

did_has_local_parent πŸ”’
Given a def id this checks if the parent def id (modulo modules) correspond to the def id of the parent impl definition (the direct one and the outermost one).
path_has_local_parent πŸ”’
Given a path, this checks if the if the parent resolution def id corresponds to the def id of the parent impl definition (the direct one and the outermost one).
path_name_to_string πŸ”’
Return a β€œerror message-able” ident for the last segment of the Path
path_span_without_args πŸ”’
Return for a given Path the span until the last args
peel_parent_while πŸ”’
Given a DefId checks if it satisfies f if it does check with it’s parent and continue until it doesn’t satisfies f and return the last DefId checked.