Skip to content

Commit 43b3681

Browse files
committed
Fix a rebasing issue and addressed reviewer comment
1 parent ff009d1 commit 43b3681

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

Diff for: src/librustc/middle/cstore.rs

+20-12
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,28 @@ impl InlinedItem {
267267

268268
// FIXME: find a better place for this?
269269
pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
270-
let say = |s: &str| {
271-
match (sp, sess) {
272-
(_, None) => panic!("{}", s),
273-
(Some(sp), Some(sess)) => sess.span_fatal(sp, s),
274-
(None, Some(sess)) => sess.fatal(s),
270+
let mut err_count = 0;
271+
{
272+
let mut say = |s: &str| {
273+
match (sp, sess) {
274+
(_, None) => panic!("{}", s),
275+
(Some(sp), Some(sess)) => sess.span_err(sp, s),
276+
(None, Some(sess)) => sess.err(s),
277+
}
278+
err_count += 1;
279+
};
280+
if s.is_empty() {
281+
say("crate name must not be empty");
282+
}
283+
for c in s.chars() {
284+
if c.is_alphanumeric() { continue }
285+
if c == '_' { continue }
286+
say(&format!("invalid character `{}` in crate name: `{}`", c, s));
275287
}
276-
};
277-
if s.is_empty() {
278-
say("crate name must not be empty");
279288
}
280-
for c in s.chars() {
281-
if c.is_alphanumeric() { continue }
282-
if c == '_' { continue }
283-
say(&format!("invalid character `{}` in crate name: `{}`", c, s));
289+
290+
if err_count > 0 {
291+
sess.unwrap().abort_if_errors();
284292
}
285293
}
286294

Diff for: src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3038,7 +3038,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
30383038
record_used: bool)
30393039
-> Option<LocalDef> {
30403040
if identifier.name == special_idents::invalid.name {
3041-
return Some(LocalDef::from_def(DefErr));
3041+
return Some(LocalDef::from_def(Def::Err));
30423042
}
30433043

30443044
// First, check to see whether the name is a primitive type.

0 commit comments

Comments
 (0)