]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_mir/src/dataflow/mod.rs
Rollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=steveklabnik
[rust.git] / compiler / rustc_mir / src / dataflow / mod.rs
1 use rustc_ast::{self as ast, MetaItem};
2 use rustc_middle::ty;
3 use rustc_session::Session;
4 use rustc_span::symbol::{sym, Symbol};
5
6 pub(crate) use self::drop_flag_effects::*;
7 pub use self::framework::{
8     fmt, lattice, visit_results, Analysis, AnalysisDomain, Backward, BorrowckFlowState,
9     BorrowckResults, Engine, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results,
10     ResultsCursor, ResultsRefCursor, ResultsVisitor,
11 };
12
13 use self::move_paths::MoveData;
14
15 pub mod drop_flag_effects;
16 mod framework;
17 pub mod impls;
18 pub mod move_paths;
19
20 pub(crate) mod indexes {
21     pub(crate) use super::{
22         impls::borrows::BorrowIndex,
23         move_paths::{InitIndex, MoveOutIndex, MovePathIndex},
24     };
25 }
26
27 pub struct MoveDataParamEnv<'tcx> {
28     pub(crate) move_data: MoveData<'tcx>,
29     pub(crate) param_env: ty::ParamEnv<'tcx>,
30 }
31
32 pub(crate) fn has_rustc_mir_with(
33     sess: &Session,
34     attrs: &[ast::Attribute],
35     name: Symbol,
36 ) -> Option<MetaItem> {
37     for attr in attrs {
38         if sess.check_name(attr, sym::rustc_mir) {
39             let items = attr.meta_item_list();
40             for item in items.iter().flat_map(|l| l.iter()) {
41                 match item.meta_item() {
42                     Some(mi) if mi.has_name(name) => return Some(mi.clone()),
43                     _ => continue,
44                 }
45             }
46         }
47     }
48     None
49 }