Remove Ident::empty.
All uses have been removed. And it's nonsensical: an identifier by definition has at least one char. The commits adds an is-non-empty assertion to `Ident::new` to enforce this, and converts some `Ident` constructions to use `Ident::new`. Adding the assertion requires making `Ident::new` and `Ident::with_dummy_span` non-const, which is no great loss. The commit amends a couple of places that do path splitting to ensure no empty identifiers are created.
This commit is contained in:
@@ -549,7 +549,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
|
||||
source = module_path.pop().unwrap();
|
||||
if rename.is_none() {
|
||||
// Keep the span of `self`, but the name of `foo`
|
||||
ident = Ident { name: source.ident.name, span: self_span };
|
||||
ident = Ident::new(source.ident.name, self_span);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -597,7 +597,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
|
||||
if let Some(crate_name) = crate_name {
|
||||
// `crate_name` should not be interpreted as relative.
|
||||
module_path.push(Segment::from_ident_and_id(
|
||||
Ident { name: kw::PathRoot, span: source.ident.span },
|
||||
Ident::new(kw::PathRoot, source.ident.span),
|
||||
self.r.next_node_id(),
|
||||
));
|
||||
source.ident.name = crate_name;
|
||||
|
||||
Reference in New Issue
Block a user