Remove SymbolStr
.
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
This commit is contained in:
parent
22f8bde876
commit
8cddcd39ba
34 changed files with 125 additions and 182 deletions
|
@ -1,4 +1,3 @@
|
|||
use std::cmp::Reverse;
|
||||
use std::ptr;
|
||||
|
||||
use rustc_ast::{self as ast, Path};
|
||||
|
@ -784,7 +783,7 @@ impl<'a> Resolver<'a> {
|
|||
});
|
||||
|
||||
// Make sure error reporting is deterministic.
|
||||
suggestions.sort_by_cached_key(|suggestion| suggestion.candidate.as_str());
|
||||
suggestions.sort_by(|a, b| a.candidate.as_str().partial_cmp(b.candidate.as_str()).unwrap());
|
||||
|
||||
match find_best_match_for_name(
|
||||
&suggestions.iter().map(|suggestion| suggestion.candidate).collect::<Vec<Symbol>>(),
|
||||
|
@ -1481,12 +1480,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
|||
return None;
|
||||
}
|
||||
|
||||
// Sort extern crate names in reverse order to get
|
||||
// Sort extern crate names in *reverse* order to get
|
||||
// 1) some consistent ordering for emitted diagnostics, and
|
||||
// 2) `std` suggestions before `core` suggestions.
|
||||
let mut extern_crate_names =
|
||||
self.r.extern_prelude.iter().map(|(ident, _)| ident.name).collect::<Vec<_>>();
|
||||
extern_crate_names.sort_by_key(|name| Reverse(name.as_str()));
|
||||
extern_crate_names.sort_by(|a, b| b.as_str().partial_cmp(a.as_str()).unwrap());
|
||||
|
||||
for name in extern_crate_names.into_iter() {
|
||||
// Replace first ident with a crate name and check if that is valid.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue