File tree 9 files changed +35
-76
lines changed
9 files changed +35
-76
lines changed Original file line number Diff line number Diff line change @@ -2138,7 +2138,7 @@ dependencies = [
2138
2138
" rustc_allocator 0.0.0" ,
2139
2139
" rustc_data_structures 0.0.0" ,
2140
2140
" rustc_incremental 0.0.0" ,
2141
- " rustc_metadata_utils 0.0.0" ,
2141
+ " rustc_metadata 0.0.0" ,
2142
2142
" rustc_mir 0.0.0" ,
2143
2143
" rustc_target 0.0.0" ,
2144
2144
" serialize 0.0.0" ,
@@ -2284,23 +2284,13 @@ dependencies = [
2284
2284
" rustc 0.0.0" ,
2285
2285
" rustc_data_structures 0.0.0" ,
2286
2286
" rustc_errors 0.0.0" ,
2287
- " rustc_metadata_utils 0.0.0" ,
2288
2287
" rustc_target 0.0.0" ,
2289
2288
" serialize 0.0.0" ,
2290
2289
" syntax 0.0.0" ,
2291
2290
" syntax_ext 0.0.0" ,
2292
2291
" syntax_pos 0.0.0" ,
2293
2292
]
2294
2293
2295
- [[package ]]
2296
- name = " rustc_metadata_utils"
2297
- version = " 0.0.0"
2298
- dependencies = [
2299
- " rustc 0.0.0" ,
2300
- " syntax 0.0.0" ,
2301
- " syntax_pos 0.0.0" ,
2302
- ]
2303
-
2304
2294
[[package ]]
2305
2295
name = " rustc_mir"
2306
2296
version = " 0.0.0"
Original file line number Diff line number Diff line change @@ -20,6 +20,6 @@ rustc = { path = "../librustc" }
20
20
rustc_allocator = { path = " ../librustc_allocator" }
21
21
rustc_target = { path = " ../librustc_target" }
22
22
rustc_data_structures = { path = " ../librustc_data_structures" }
23
+ rustc_metadata = { path = " ../librustc_metadata" }
23
24
rustc_mir = { path = " ../librustc_mir" }
24
25
rustc_incremental = { path = " ../librustc_incremental" }
25
- rustc_metadata_utils = { path = " ../librustc_metadata_utils" }
Original file line number Diff line number Diff line change @@ -35,12 +35,12 @@ extern crate serialize;
35
35
extern crate rustc;
36
36
extern crate rustc_allocator;
37
37
extern crate rustc_target;
38
+ extern crate rustc_metadata;
38
39
extern crate rustc_mir;
39
40
extern crate rustc_incremental;
40
41
extern crate syntax;
41
42
extern crate syntax_pos;
42
43
#[ macro_use] extern crate rustc_data_structures;
43
- extern crate rustc_metadata_utils;
44
44
45
45
use std:: path:: PathBuf ;
46
46
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ use rustc::session::Session;
13
13
use std:: path:: { Path , PathBuf } ;
14
14
use syntax:: { ast, attr} ;
15
15
use syntax_pos:: Span ;
16
- use rustc_metadata_utils:: validate_crate_name;
17
16
18
17
pub fn out_filename ( sess : & Session ,
19
18
crate_type : config:: CrateType ,
@@ -52,7 +51,7 @@ pub fn find_crate_name(sess: Option<&Session>,
52
51
attrs : & [ ast:: Attribute ] ,
53
52
input : & Input ) -> String {
54
53
let validate = |s : String , span : Option < Span > | {
55
- validate_crate_name ( sess, & s, span) ;
54
+ :: rustc_metadata :: validate_crate_name ( sess, & s, span) ;
56
55
s
57
56
} ;
58
57
Original file line number Diff line number Diff line change @@ -20,4 +20,3 @@ serialize = { path = "../libserialize" }
20
20
syntax = { path = " ../libsyntax" }
21
21
syntax_ext = { path = " ../libsyntax_ext" }
22
22
syntax_pos = { path = " ../libsyntax_pos" }
23
- rustc_metadata_utils = { path = " ../librustc_metadata_utils" }
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ use rustc::util::common::record_time;
30
30
use rustc:: util:: nodemap:: FxHashSet ;
31
31
use rustc:: hir:: map:: Definitions ;
32
32
33
- use rustc_metadata_utils:: validate_crate_name;
34
-
35
33
use std:: ops:: Deref ;
36
34
use std:: path:: PathBuf ;
37
35
use std:: { cmp, fs} ;
@@ -1106,7 +1104,7 @@ impl<'a> CrateLoader<'a> {
1106
1104
item. ident, orig_name) ;
1107
1105
let orig_name = match orig_name {
1108
1106
Some ( orig_name) => {
1109
- validate_crate_name ( Some ( self . sess ) , & orig_name. as_str ( ) ,
1107
+ :: validate_crate_name ( Some ( self . sess ) , & orig_name. as_str ( ) ,
1110
1108
Some ( item. span ) ) ;
1111
1109
orig_name
1112
1110
}
Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ extern crate serialize as rustc_serialize; // used by deriving
38
38
extern crate rustc_errors as errors;
39
39
extern crate syntax_ext;
40
40
extern crate proc_macro;
41
- extern crate rustc_metadata_utils;
42
41
43
42
#[ macro_use]
44
43
extern crate rustc;
@@ -64,4 +63,34 @@ pub mod cstore;
64
63
pub mod dynamic_lib;
65
64
pub mod locator;
66
65
66
+ pub fn validate_crate_name (
67
+ sess : Option < & rustc:: session:: Session > ,
68
+ s : & str ,
69
+ sp : Option < syntax_pos:: Span >
70
+ ) {
71
+ let mut err_count = 0 ;
72
+ {
73
+ let mut say = |s : & str | {
74
+ match ( sp, sess) {
75
+ ( _, None ) => bug ! ( "{}" , s) ,
76
+ ( Some ( sp) , Some ( sess) ) => sess. span_err ( sp, s) ,
77
+ ( None , Some ( sess) ) => sess. err ( s) ,
78
+ }
79
+ err_count += 1 ;
80
+ } ;
81
+ if s. is_empty ( ) {
82
+ say ( "crate name must not be empty" ) ;
83
+ }
84
+ for c in s. chars ( ) {
85
+ if c. is_alphanumeric ( ) { continue }
86
+ if c == '_' { continue }
87
+ say ( & format ! ( "invalid character `{}` in crate name: `{}`" , c, s) ) ;
88
+ }
89
+ }
90
+
91
+ if err_count > 0 {
92
+ sess. unwrap ( ) . abort_if_errors ( ) ;
93
+ }
94
+ }
95
+
67
96
__build_diagnostic_array ! { librustc_metadata, DIAGNOSTICS }
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments