Skip to content

Commit a1a58b0

Browse files
---
yaml --- r: 235458 b: refs/heads/stable c: cbf0b1b h: refs/heads/master v: v3
1 parent a67384e commit a1a58b0

File tree

3 files changed

+64
-43
lines changed

3 files changed

+64
-43
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 48ee57e656ea955fe634df7c7e9f37c27c65580a
32+
refs/heads/stable: cbf0b1b399e884cff01393e817738da48bab64fd
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc_resolve/lib.rs

Lines changed: 56 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ mod record_exports;
116116
mod build_reduced_graph;
117117
mod resolve_imports;
118118

119+
fn resolve_err_417<'a, 'tcx>(this: &Resolver<'a, 'tcx>, span: syntax::codemap::Span, formatted: &str) {
120+
resolve_err!(this, span, E0417, "{}", formatted);
121+
}
122+
123+
fn resolve_err_422<'a, 'tcx>(this: &Resolver<'a, 'tcx>, span: syntax::codemap::Span, formatted: &str) {
124+
resolve_err!(this, span, E0422, "{}", formatted);
125+
}
126+
127+
fn resolve_err_423<'a, 'tcx>(this: &Resolver<'a, 'tcx>, span: syntax::codemap::Span, formatted: &str) {
128+
resolve_err!(this, span, E0423, "{}", formatted);
129+
}
130+
131+
fn resolve_err_432<'a, 'tcx>(this: &Resolver<'a, 'tcx>, span: syntax::codemap::Span, formatted: &str) {
132+
resolve_err!(this, span, E0432, "{}", formatted);
133+
}
134+
135+
fn resolve_err_433<'a, 'tcx>(this: &Resolver<'a, 'tcx>, span: syntax::codemap::Span, formatted: &str) {
136+
resolve_err!(this, span, E0433, "{}", formatted);
137+
}
138+
119139
#[derive(Copy, Clone)]
120140
struct BindingInfo {
121141
span: Span,
@@ -1310,7 +1330,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
13101330
PathSearch,
13111331
true) {
13121332
Failed(Some((span, msg))) => {
1313-
resolve_err!(self, span, E0433, "failed to resolve. {}", msg);
1333+
resolve_err_433(self, span, &*format!("failed to resolve. {}", msg));
13141334
},
13151335
Failed(None) => (), // Continue up the search chain.
13161336
Indeterminate => {
@@ -1568,11 +1588,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
15681588
.span_to_snippet((*imports)[index].span)
15691589
.unwrap();
15701590
if sn.contains("::") {
1571-
resolve_err!(self, (*imports)[index].span, E0432,
1572-
"{}", "unresolved import");
1591+
resolve_err_432(self, (*imports)[index].span, "unresolved import");
15731592
} else {
1574-
resolve_err!(self, (*imports)[index].span, E0432,
1575-
"unresolved import (maybe you meant `{}::*`?)", sn);
1593+
resolve_err_432(self, (*imports)[index].span,
1594+
&*format!("unresolved import (maybe you meant `{}::*`?)",
1595+
sn)
1596+
);
15761597
}
15771598
}
15781599

@@ -2528,7 +2549,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
25282549
self.record_def(pattern.id, path_res);
25292550
}
25302551
DefStatic(..) => {
2531-
resolve_err!(self, path.span, E0417, "{}",
2552+
resolve_err_417(self, path.span,
25322553
"static variables cannot be \
25332554
referenced in a pattern, \
25342555
use a `const` instead");
@@ -2609,9 +2630,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
26092630
result => {
26102631
debug!("(resolving pattern) didn't find struct \
26112632
def: {:?}", result);
2612-
resolve_err!(self, path.span, E0422,
2613-
"`{}` does not name a structure",
2614-
path_names_to_string(path, 0));
2633+
resolve_err_422(self, path.span,
2634+
&*format!("`{}` does not name a structure",
2635+
path_names_to_string(path, 0)));
26152636
}
26162637
}
26172638
visit::walk_path(self, path);
@@ -2657,8 +2678,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
26572678
return FoundConst(def, LastMod(AllPublic));
26582679
}
26592680
DefStatic(..) => {
2660-
resolve_err!(self, span, E0417,
2661-
"{}",
2681+
resolve_err_417(self, span,
26622682
"static variables cannot be \
26632683
referenced in a pattern, \
26642684
use a `const` instead");
@@ -2678,9 +2698,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
26782698
Failed(err) => {
26792699
match err {
26802700
Some((span, msg)) => {
2681-
resolve_err!(self, span, E0433,
2682-
"failed to resolve: {}",
2683-
msg);
2701+
resolve_err_433(self, span,
2702+
&*format!("failed to resolve: {}",
2703+
msg));
26842704
}
26852705
None => ()
26862706
}
@@ -2909,9 +2929,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
29092929
}
29102930
};
29112931

2912-
resolve_err!(self, span, E0433,
2913-
"failed to resolve: {}",
2914-
msg);
2932+
resolve_err_433(self, span,
2933+
&*format!("failed to resolve: {}",
2934+
msg));
29152935
return None;
29162936
}
29172937
Indeterminate => panic!("indeterminate unexpected"),
@@ -2972,9 +2992,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
29722992

29732993
/*self.resolve_error(span, &format!("failed to resolve. {}",
29742994
msg));*/
2975-
resolve_err!(self, span, E0433,
2976-
"failed to resolve: {}",
2977-
msg);
2995+
resolve_err_433(self, span,
2996+
&*format!("failed to resolve: {}",
2997+
msg));
29782998
return None;
29792999
}
29803000

@@ -3070,9 +3090,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
30703090
failed to resolve {}", name);
30713091

30723092
if let Some((span, msg)) = err {
3073-
resolve_err!(self, span, E0433,
3074-
"failed to resolve: {}",
3075-
msg)
3093+
resolve_err_433(self, span,
3094+
&*format!("failed to resolve: {}",
3095+
msg))
30763096
}
30773097

30783098
return None;
@@ -3274,11 +3294,11 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
32743294
// Check if struct variant
32753295
if let DefVariant(_, _, true) = path_res.base_def {
32763296
let path_name = path_names_to_string(path, 0);
3277-
resolve_err!(self, expr.span, E0423,
3278-
"`{}` is a struct variant name, but \
3279-
this expression \
3280-
uses it like a function name",
3281-
path_name);
3297+
resolve_err_423(self, expr.span,
3298+
&*format!("`{}` is a struct variant name, but \
3299+
this expression \
3300+
uses it like a function name",
3301+
path_name));
32823302

32833303
let msg = format!("did you mean to write: \
32843304
`{} {{ /* fields */ }}`?",
@@ -3315,11 +3335,11 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
33153335
match type_res.map(|r| r.base_def) {
33163336
Some(DefTy(struct_id, _))
33173337
if self.structs.contains_key(&struct_id) => {
3318-
resolve_err!(self, expr.span, E0423,
3319-
"{}` is a structure name, but \
3320-
this expression \
3321-
uses it like a function name",
3322-
path_name);
3338+
resolve_err_423(self, expr.span,
3339+
&*format!("{}` is a structure name, but \
3340+
this expression \
3341+
uses it like a function name",
3342+
path_name));
33233343

33243344
let msg = format!("did you mean to write: \
33253345
`{} {{ /* fields */ }}`?",
@@ -3394,9 +3414,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
33943414
Some(definition) => self.record_def(expr.id, definition),
33953415
None => {
33963416
debug!("(resolving expression) didn't find struct def",);
3397-
resolve_err!(self, path.span, E0422,
3398-
"`{}` does not name a structure",
3399-
path_names_to_string(path, 0));
3417+
resolve_err_422(self, path.span,
3418+
&*format!("`{}` does not name a structure",
3419+
path_names_to_string(path, 0)));
34003420
}
34013421
}
34023422

branches/stable/src/librustc_resolve/resolve_imports.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,13 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
272272
Some((span, msg)) => (span, format!(". {}", msg)),
273273
None => (import_directive.span, String::new())
274274
};
275-
resolve_err!(self.resolver, span, E0432,
276-
"unresolved import `{}`{}",
277-
import_path_to_string(
278-
&import_directive.module_path,
279-
import_directive.subclass),
280-
help);
275+
::resolve_err_432(self.resolver, span,
276+
&*format!("unresolved import `{}`{}",
277+
import_path_to_string(
278+
&import_directive.module_path,
279+
import_directive.subclass),
280+
help)
281+
);
281282
}
282283
ResolveResult::Indeterminate => break, // Bail out. We'll come around next time.
283284
ResolveResult::Success(()) => () // Good. Continue.

0 commit comments

Comments
 (0)