File tree 7 files changed +36
-13
lines changed
7 files changed +36
-13
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_
59
59
rustc_data_structures rustc_front rustc_platform_intrinsics \
60
60
rustc_plugin rustc_metadata rustc_passes
61
61
HOST_CRATES := syntax syntax_ext $(RUSTC_CRATES ) rustdoc fmt_macros
62
- TOOLS := compiletest rustdoc rustc rustbook error-index-generator
62
+ TOOLS := compiletest rustdoc rustc rustbook error_index_generator
63
63
64
64
DEPS_core :=
65
65
DEPS_alloc := core libc alloc_system
@@ -120,12 +120,12 @@ TOOL_DEPS_compiletest := test getopts
120
120
TOOL_DEPS_rustdoc := rustdoc
121
121
TOOL_DEPS_rustc := rustc_driver
122
122
TOOL_DEPS_rustbook := std rustdoc
123
- TOOL_DEPS_error-index-generator := rustdoc syntax serialize
123
+ TOOL_DEPS_error_index_generator := rustdoc syntax serialize
124
124
TOOL_SOURCE_compiletest := $(S ) src/compiletest/compiletest.rs
125
125
TOOL_SOURCE_rustdoc := $(S ) src/driver/driver.rs
126
126
TOOL_SOURCE_rustc := $(S ) src/driver/driver.rs
127
127
TOOL_SOURCE_rustbook := $(S ) src/rustbook/main.rs
128
- TOOL_SOURCE_error-index-generator := $(S ) src/error-index-generator /main.rs
128
+ TOOL_SOURCE_error_index_generator := $(S ) src/error_index_generator /main.rs
129
129
130
130
ONLY_RLIB_core := 1
131
131
ONLY_RLIB_libc := 1
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ PKG_FILES := \
52
52
doc \
53
53
driver \
54
54
etc \
55
- error-index-generator \
55
+ error_index_generator \
56
56
$(foreach crate,$(CRATES ) ,lib$(crate ) ) \
57
57
libcollectionstest \
58
58
libcoretest \
Original file line number Diff line number Diff line change @@ -59,8 +59,8 @@ RUSTBOOK_EXE = $(HBIN2_H_$(CFG_BUILD))/rustbook$(X_$(CFG_BUILD))
59
59
# ./configure
60
60
RUSTBOOK = $(RPATH_VAR2_T_$(CFG_BUILD ) _H_$(CFG_BUILD ) ) $(RUSTBOOK_EXE )
61
61
62
- # The error-index-generator executable...
63
- ERR_IDX_GEN_EXE = $(HBIN2_H_$(CFG_BUILD ) ) /error-index-generator $(X_$(CFG_BUILD ) )
62
+ # The error_index_generator executable...
63
+ ERR_IDX_GEN_EXE = $(HBIN2_H_$(CFG_BUILD ) ) /error_index_generator $(X_$(CFG_BUILD ) )
64
64
ERR_IDX_GEN = $(RPATH_VAR2_T_$(CFG_BUILD ) _H_$(CFG_BUILD ) ) $(ERR_IDX_GEN_EXE )
65
65
ERR_IDX_GEN_MD = $(RPATH_VAR2_T_$(CFG_BUILD ) _H_$(CFG_BUILD ) ) $(ERR_IDX_GEN_EXE ) markdown
66
66
@@ -221,9 +221,9 @@ error-index: doc/error-index.html
221
221
# Metadata used to generate the index is created as a side effect of
222
222
# the build so this depends on every crate being up to date.
223
223
doc/error-index.html : $(ERR_IDX_GEN_EXE ) $(CSREQ$(2 ) _T_$(CFG_BUILD ) _H_$(CFG_BUILD ) ) | doc/
224
- $(Q )$(call E, error-index-generator : $@ )
224
+ $(Q )$(call E, error_index_generator : $@ )
225
225
$(Q )$(ERR_IDX_GEN )
226
226
227
227
doc/error-index.md : $(ERR_IDX_GEN_EXE ) $(CSREQ$(2 ) _T_$(CFG_BUILD ) _H_$(CFG_BUILD ) ) | doc/
228
- $(Q )$(call E, error-index-generator : $@ )
228
+ $(Q )$(call E, error_index_generator : $@ )
229
229
$(Q )$(ERR_IDX_GEN_MD )
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ define PREPARE_MAN
82
82
83
83
endef
84
84
85
- PREPARE_TOOLS = $(filter-out compiletest rustbook error-index-generator , $(TOOLS ) )
85
+ PREPARE_TOOLS = $(filter-out compiletest rustbook error_index_generator , $(TOOLS ) )
86
86
87
87
88
88
# $(1) is tool
File renamed without changes.
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ use syntax::attr;
28
28
use syntax:: attr:: AttrMetaMethods ;
29
29
use syntax:: errors:: { ColorConfig , Handler } ;
30
30
use syntax:: parse;
31
+ use syntax:: parse:: lexer:: Reader ;
31
32
use syntax:: parse:: token:: InternedString ;
32
33
use syntax:: feature_gate:: UnstableFeatures ;
33
34
@@ -906,10 +907,19 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
906
907
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
907
908
pub fn parse_cfgspecs ( cfgspecs : Vec < String > ) -> ast:: CrateConfig {
908
909
cfgspecs. into_iter ( ) . map ( |s| {
909
- parse:: parse_meta_from_source_str ( "cfgspec" . to_string ( ) ,
910
- s. to_string ( ) ,
911
- Vec :: new ( ) ,
912
- & parse:: ParseSess :: new ( ) )
910
+ let sess = parse:: ParseSess :: new ( ) ;
911
+ let mut parser = parse:: new_parser_from_source_str ( & sess,
912
+ Vec :: new ( ) ,
913
+ "cfgspec" . to_string ( ) ,
914
+ s. to_string ( ) ) ;
915
+ let meta_item = panictry ! ( parser. parse_meta_item( ) ) ;
916
+
917
+ if !parser. reader . is_eof ( ) {
918
+ early_error ( ErrorOutputType :: default ( ) , & format ! ( "invalid --cfg argument: {}" ,
919
+ s) )
920
+ }
921
+
922
+ meta_item
913
923
} ) . collect :: < ast:: CrateConfig > ( )
914
924
}
915
925
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // compile-flags: --cfg a{b}
12
+ // error-pattern: invalid --cfg argument: a{b}
13
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments