1
1
use std:: collections:: BTreeMap ;
2
- use std:: env;
3
2
4
3
use crate :: ast:: { self , Ident , Name } ;
5
4
use crate :: source_map;
@@ -12,8 +11,6 @@ use crate::tokenstream::{TokenTree};
12
11
use smallvec:: smallvec;
13
12
use syntax_pos:: Span ;
14
13
15
- use crate :: diagnostics:: metadata:: output_metadata;
16
-
17
14
pub use errors:: * ;
18
15
19
16
// Maximum width of any line in an extended error description (inclusive).
@@ -127,36 +124,13 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt<'_>,
127
124
token_tree : & [ TokenTree ] )
128
125
-> Box < dyn MacResult +' cx > {
129
126
assert_eq ! ( token_tree. len( ) , 3 ) ;
130
- let ( crate_name, ident) = match ( & token_tree[ 0 ] , & token_tree[ 2 ] ) {
131
- (
132
- // Crate name.
133
- & TokenTree :: Token ( Token { kind : token:: Ident ( crate_name, _) , .. } ) ,
134
- // DIAGNOSTICS ident.
135
- & TokenTree :: Token ( Token { kind : token:: Ident ( name, _) , span } )
136
- ) => ( crate_name, Ident :: new ( name, span) ) ,
127
+ let ident = match & token_tree[ 2 ] {
128
+ // DIAGNOSTICS ident.
129
+ & TokenTree :: Token ( Token { kind : token:: Ident ( name, _) , span } )
130
+ => Ident :: new ( name, span) ,
137
131
_ => unreachable ! ( )
138
132
} ;
139
133
140
- // Output error metadata to `tmp/extended-errors/<target arch>/<crate name>.json`
141
- if let Ok ( target_triple) = env:: var ( "CFG_COMPILER_HOST_TRIPLE" ) {
142
- ecx. parse_sess . registered_diagnostics . with_lock ( |diagnostics| {
143
- if let Err ( e) = output_metadata ( ecx,
144
- & target_triple,
145
- & crate_name. as_str ( ) ,
146
- diagnostics) {
147
- ecx. span_bug ( span, & format ! (
148
- "error writing metadata for triple `{}` and crate `{}`, error: {}, \
149
- cause: {:?}",
150
- target_triple, crate_name, e. description( ) , e. source( )
151
- ) ) ;
152
- }
153
- } ) ;
154
- } else {
155
- ecx. span_err ( span, & format ! (
156
- "failed to write metadata for crate `{}` because $CFG_COMPILER_HOST_TRIPLE is not set" ,
157
- crate_name) ) ;
158
- }
159
-
160
134
// Construct the output expression.
161
135
let ( count, expr) =
162
136
ecx. parse_sess . registered_diagnostics . with_lock ( |diagnostics| {
0 commit comments