Merge pull request #3044 from orium/fix-too-many-modsep

Fix bug in import where two consecutive module separators were possible.
This commit is contained in:
Nick Cameron 2018-09-24 14:07:20 +12:00 committed by GitHub
commit ff4fe5db13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -324,11 +324,15 @@ impl UseTree {
&& a.prefix.to_string().len() > 2
&& a.prefix.to_string().starts_with("::");
let mut modsep = leading_modsep;
for p in &a.prefix.segments {
if let Some(use_segment) = UseSegment::from_path_segment(context, p, leading_modsep) {
if let Some(use_segment) = UseSegment::from_path_segment(context, p, modsep) {
result.path.push(use_segment);
modsep = false;
}
}
match a.kind {
UseTreeKind::Glob => {
result.path.push(UseSegment::Glob);

View file

@ -0,0 +1,5 @@
// rustfmt-edition: 2018
use ::std::vec::Vec;
fn main() {}