]>
Commit | Line | Data |
---|---|---|
9fa01778 | 1 | #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] |
92a42be0 | 2 | |
60c5eb7d | 3 | #![feature(bool_to_option)] |
c30ab7b3 | 4 | #![feature(box_patterns)] |
e74abb32 | 5 | #![feature(core_intrinsics)] |
416331ca | 6 | #![feature(crate_visibility_modifier)] |
532ac7d7 | 7 | #![feature(drain_filter)] |
dc9dc135 | 8 | #![feature(in_band_lifetimes)] |
ff7c6d11 | 9 | #![feature(libc)] |
0bf4aa26 | 10 | #![feature(nll)] |
c30ab7b3 | 11 | #![feature(proc_macro_internals)] |
8faf50e0 | 12 | #![feature(proc_macro_quote)] |
7cac9316 | 13 | #![feature(rustc_private)] |
416331ca XL |
14 | #![feature(slice_patterns)] |
15 | #![feature(specialization)] | |
e74abb32 | 16 | #![feature(stmt_expr_attributes)] |
7cac9316 | 17 | |
94b46f34 XL |
18 | #![recursion_limit="256"] |
19 | ||
ff7c6d11 | 20 | extern crate libc; |
c30ab7b3 | 21 | extern crate proc_macro; |
92a42be0 | 22 | |
54a0048b | 23 | #[macro_use] |
92a42be0 | 24 | extern crate rustc; |
0531ce1d | 25 | #[macro_use] |
c30ab7b3 | 26 | extern crate rustc_data_structures; |
92a42be0 | 27 | |
60c5eb7d | 28 | pub use rmeta::{provide, provide_extern}; |
92a42be0 | 29 | |
e74abb32 | 30 | mod dependency_format; |
0531ce1d | 31 | mod foreign_modules; |
e74abb32 XL |
32 | mod link_args; |
33 | mod native_libs; | |
60c5eb7d | 34 | mod rmeta; |
92a42be0 | 35 | |
92a42be0 | 36 | pub mod creader; |
ff7c6d11 | 37 | pub mod dynamic_lib; |
c30ab7b3 | 38 | pub mod locator; |
9e0c209e | 39 | |
a1dfa0c6 XL |
40 | pub fn validate_crate_name( |
41 | sess: Option<&rustc::session::Session>, | |
42 | s: &str, | |
43 | sp: Option<syntax_pos::Span> | |
44 | ) { | |
45 | let mut err_count = 0; | |
46 | { | |
47 | let mut say = |s: &str| { | |
48 | match (sp, sess) { | |
49 | (_, None) => bug!("{}", s), | |
50 | (Some(sp), Some(sess)) => sess.span_err(sp, s), | |
51 | (None, Some(sess)) => sess.err(s), | |
52 | } | |
53 | err_count += 1; | |
54 | }; | |
55 | if s.is_empty() { | |
56 | say("crate name must not be empty"); | |
57 | } | |
58 | for c in s.chars() { | |
59 | if c.is_alphanumeric() { continue } | |
60 | if c == '_' { continue } | |
61 | say(&format!("invalid character `{}` in crate name: `{}`", c, s)); | |
62 | } | |
63 | } | |
64 | ||
65 | if err_count > 0 { | |
66 | sess.unwrap().abort_if_errors(); | |
67 | } | |
68 | } |