use rustc::bug;
use rustc::session::Session;
use rustc::ty::{self, DefIdTree};
+use rustc_ast::ast::{self, Ident, Path};
+use rustc_ast::util::lev_distance::find_best_match_for_name;
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::{kw, Symbol};
use rustc_span::{BytePos, MultiSpan, Span};
-use syntax::ast::{self, Ident, Path};
-use syntax::util::lev_distance::find_best_match_for_name;
use crate::imports::{ImportDirective, ImportDirectiveSubclass, ImportResolver};
use crate::path_names_to_string;
E0401,
"can't use generic parameters from outer function",
);
- err.span_label(span, format!("use of generic parameter from outer function"));
+ err.span_label(span, "use of generic parameter from outer function".to_string());
let sm = self.session.source_map();
match outer_res {
} else if let Some(sp) = sm.generate_fn_name_span(span) {
err.span_label(
sp,
- format!("try adding a local generic parameter in this method instead"),
+ "try adding a local generic parameter in this method instead"
+ .to_string(),
);
} else {
err.help("try using a local generic parameter instead");
self.session,
span,
E0409,
- "variable `{}` is bound in inconsistent \
- ways within the same match arm",
+ "variable `{}` is bound inconsistently across alternatives separated by `|`",
variable_name
);
err.span_label(span, "bound in different ways");
// we want consistent results across executions, but candidates are produced
// by iterating through a hash map, so make sure they are ordered:
let mut path_strings: Vec<_> =
- candidates.into_iter().map(|c| path_names_to_string(&c.path)).collect();
+ candidates.iter().map(|c| path_names_to_string(&c.path)).collect();
path_strings.sort();
path_strings.dedup();