1 use core::unicode::property::Pattern_White_Space;
5 pub mod borrowck_errors;
6 pub mod elaborate_drops;
12 pub(crate) mod pretty;
14 pub mod collect_writes;
16 pub use self::alignment::is_disaligned;
17 pub use self::pretty::{dump_enabled, dump_mir, write_mir_pretty, PassWhere};
18 pub use self::graphviz::{graphviz_safe_def_name, write_mir_graphviz};
19 pub use self::graphviz::write_node_label as write_graphviz_node_label;
21 /// If possible, suggest replacing `ref` with `ref mut`.
22 pub fn suggest_ref_mut<'cx, 'gcx, 'tcx>(
23 tcx: TyCtxt<'cx, 'gcx, 'tcx>,
25 ) -> Option<(String)> {
26 let hi_src = tcx.sess.source_map().span_to_snippet(binding_span).unwrap();
27 if hi_src.starts_with("ref")
28 && hi_src["ref".len()..].starts_with(Pattern_White_Space)
30 let replacement = format!("ref mut{}", &hi_src["ref".len()..]);