Skip to content

Commit f3df928

Browse files
garethgareth
authored andcommitted
---
yaml --- r: 41521 b: refs/heads/master c: b6aafe9 h: refs/heads/master i: 41519: 012ce3b v: v3
1 parent 2f3d66d commit f3df928

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6e7cf87101e79efb8eed683ab5261878b63c3070
2+
refs/heads/master: b6aafe928dbae9e610486105c2a3ec1d2fe2070e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/doc/tutorial-macros.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ macro_rules! early_return(
4343
_ => {}
4444
}
4545
);
46-
)
46+
);
4747
// ...
4848
early_return!(input_1 special_a);
4949
// ...
@@ -160,7 +160,7 @@ macro_rules! early_return(
160160
_ => {}
161161
}
162162
);
163-
)
163+
);
164164
// ...
165165
early_return!(input_1, [special_a|special_c|special_d]);
166166
// ...

trunk/src/librustc/middle/resolve.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,8 +2086,11 @@ impl Resolver {
20862086
match self.resolve_import_for_module(module_, import_directive) {
20872087
Failed => {
20882088
// We presumably emitted an error. Continue.
2089-
self.session.span_err(import_directive.span,
2090-
~"failed to resolve import");
2089+
let idents = import_directive.module_path.get();
2090+
let msg = fmt!("failed to resolve import: %s",
2091+
self.import_path_to_str(idents,
2092+
*import_directive.subclass));
2093+
self.session.span_err(import_directive.span, msg);
20912094
}
20922095
Indeterminate => {
20932096
// Bail out. We'll come around next time.
@@ -2117,6 +2120,26 @@ impl Resolver {
21172120
// XXX: Shouldn't copy here. We need string builder functionality.
21182121
return result;
21192122
}
2123+
2124+
fn import_directive_subclass_to_str(subclass: ImportDirectiveSubclass)
2125+
-> ~str {
2126+
match subclass {
2127+
SingleImport(_target, source, _ns) => self.session.str_of(source),
2128+
GlobImport => ~"*"
2129+
}
2130+
}
2131+
2132+
fn import_path_to_str(idents: ~[ident], subclass: ImportDirectiveSubclass)
2133+
-> ~str {
2134+
if idents.is_empty() {
2135+
self.import_directive_subclass_to_str(subclass)
2136+
} else {
2137+
fmt!("%s::%s",
2138+
self.idents_to_str(idents),
2139+
self.import_directive_subclass_to_str(subclass))
2140+
}
2141+
}
2142+
21202143
/**
21212144
* Attempts to resolve the given import. The return value indicates
21222145
* failure if we're certain the name does not exist, indeterminate if we

0 commit comments

Comments
 (0)