1194: Pr 1190 r=matklad a=matklad



Co-authored-by: Andrea Pretto <eulerdisk@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2019-04-22 13:19:47 +00:00
commit c416caeda2
7 changed files with 272 additions and 78 deletions

View file

@ -46,6 +46,19 @@ impl Name {
Name::new(idx.to_string().into())
}
// There's should be no way to extract a string out of `Name`: `Name` in the
// future, `Name` will include hygiene information, and you can't encode
// hygiene into a String.
//
// If you need to compare something with `Name`, compare `Name`s directly.
//
// If you need to render `Name` for the user, use the `Display` impl, but be
// aware that it strips hygiene info.
#[deprecated(note = "use to_string instead")]
pub fn as_smolstr(&self) -> &SmolStr {
&self.text
}
pub(crate) fn as_known_name(&self) -> Option<KnownName> {
let name = match self.text.as_str() {
"isize" => KnownName::Isize,

View file

@ -21,7 +21,7 @@ use crate::{
AsName, Module, HirFileId, Crate, Trait, Resolver, Ty,
expr::{BodySourceMap, scope::{ScopeId, ExprScopes}},
ids::LocationCtx,
expr, AstId
expr, AstId,
};
/// Locates the module by `FileId`. Picks topmost module in the file.