Skip to content

Commit 9651397

Browse files
committed
---
yaml --- r: 224795 b: refs/heads/tmp c: 58e35d7 h: refs/heads/master i: 224793: 33bcf3a 224791: 94710c1 v: v3
1 parent 2473c21 commit 9651397

File tree

5 files changed

+35
-18
lines changed

5 files changed

+35
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: 83dee3dfbb452a7558193f3ce171b3c60bf4a499
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: f9f9f509a09fadf96a85b0c4b68a13b9b8ef6dfb
28+
refs/heads/tmp: 58e35d7c2ab93637c6c549b03a04f900fb3499d2
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: e58601ab085591c71a27ae82137fc313222c2270
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/librustc_resolve/resolve_imports.rs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ impl ImportResolution {
184184
}
185185
}
186186

187+
struct ImportResolvingError {
188+
span: Span,
189+
path: String,
190+
help: String,
191+
}
187192

188193
struct ImportResolver<'a, 'b:'a, 'tcx:'b> {
189194
resolver: &'a mut Resolver<'b, 'tcx>
@@ -218,16 +223,16 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
218223
if self.resolver.unresolved_imports == prev_unresolved_imports {
219224
// resolving failed
220225
if errors.len() > 0 {
221-
for (span, path, help) in errors {
226+
for e in errors {
222227
resolve_error(self.resolver,
223-
span,
224-
ResolutionError::UnresolvedImport(Some((&*path, &*help))));
228+
e.span,
229+
ResolutionError::UnresolvedImport(Some((&e.path, &e.help))));
225230
}
226231
} else {
227-
// report unresolved imports only if no hard error was already reported
228-
// to avoid generating multiple errors on the same import
229-
// imports that are still undeterminate at this point are actually blocked
230-
// by errored imports, so there is no point reporting them
232+
// Report unresolved imports only if no hard error was already reported
233+
// to avoid generating multiple errors on the same import.
234+
// Imports that are still indeterminate at this point are actually blocked
235+
// by errored imports, so there is no point reporting them.
231236
self.resolver.report_unresolved_imports(module_root);
232237
}
233238
break;
@@ -241,7 +246,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
241246
/// Attempts to resolve imports for the given module and all of its
242247
/// submodules.
243248
fn resolve_imports_for_module_subtree(&mut self, module_: Rc<Module>)
244-
-> Vec<(Span, String, String)> {
249+
-> Vec<ImportResolvingError> {
245250
let mut errors = Vec::new();
246251
debug!("(resolving imports for module subtree) resolving {}",
247252
module_to_string(&*module_));
@@ -269,7 +274,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
269274
}
270275

271276
/// Attempts to resolve imports for the given module only.
272-
fn resolve_imports_for_module(&mut self, module: Rc<Module>) -> Vec<(Span, String, String)> {
277+
fn resolve_imports_for_module(&mut self, module: Rc<Module>) -> Vec<ImportResolvingError> {
273278
let mut errors = Vec::new();
274279

275280
if module.all_imports_resolved() {
@@ -292,12 +297,14 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
292297
Some((span, msg)) => (span, format!(". {}", msg)),
293298
None => (import_directive.span, String::new())
294299
};
295-
errors.push((span,
296-
import_path_to_string(
297-
&import_directive.module_path,
298-
import_directive.subclass
299-
),
300-
help))
300+
errors.push(ImportResolvingError {
301+
span: span,
302+
path: import_path_to_string(
303+
&import_directive.module_path,
304+
import_directive.subclass
305+
),
306+
help: help
307+
});
301308
}
302309
ResolveResult::Indeterminate => {}
303310
ResolveResult::Success(()) => {

branches/tmp/src/test/run-pass/import-glob-1.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,7 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(unused_imports, dead_code)]
11+
// This should resolve fine. Prior to fix, the last import
12+
// was being tried too early, and marked as unrsolved before
13+
// the glob import had a chance to be resolved.
1214

1315
mod bar {
1416
pub use self::middle::*;

branches/tmp/src/test/run-pass/issue-18083.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// These crossed imports should resolve fine, and not block on
12+
// each other and be reported as unresolved.
13+
1114
mod a {
1215
use b::{B};
1316
pub use self::inner::A;

branches/tmp/src/test/run-pass/issue-4865-1.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// This should resolve fine.
12+
// Prior to fix, the crossed imports between a and b
13+
// would block on the glob import, itself never being resolved
14+
// because these previous imports were not resolved.
15+
1116
pub mod a {
1217
use b::fn_b;
1318
use c::*;

0 commit comments

Comments
 (0)