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