File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -128,10 +128,14 @@ pub fn print_crate<'a>(cm: &'a SourceMap,
128128 let fake_attr = attr:: mk_attr_inner ( list) ;
129129 s. print_attribute ( & fake_attr) ;
130130
131- // #![no_std]
132- let no_std_meta = attr:: mk_word_item ( ast:: Ident :: with_dummy_span ( sym:: no_std) ) ;
133- let fake_attr = attr:: mk_attr_inner ( no_std_meta) ;
134- s. print_attribute ( & fake_attr) ;
131+ // Currently on Rust 2018 we don't have `extern crate std;` at the crate
132+ // root, so this is not needed, and actually breaks things.
133+ if sess. edition == syntax_pos:: edition:: Edition :: Edition2015 {
134+ // #![no_std]
135+ let no_std_meta = attr:: mk_word_item ( ast:: Ident :: with_dummy_span ( sym:: no_std) ) ;
136+ let fake_attr = attr:: mk_attr_inner ( no_std_meta) ;
137+ s. print_attribute ( & fake_attr) ;
138+ }
135139 }
136140
137141 s. print_mod ( & krate. module , & krate. attrs ) ;
You can’t perform that action at this time.
0 commit comments