Skip to content

Commit

Permalink
Fix 2018 edition expanded pretty printing
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Sep 5, 2019
1 parent beb2f5b commit 846df20
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/libsyntax/print/pprust.rs
Expand Up @@ -128,10 +128,14 @@ pub fn print_crate<'a>(cm: &'a SourceMap,
let fake_attr = attr::mk_attr_inner(list);
s.print_attribute(&fake_attr);

// #![no_std]
let no_std_meta = attr::mk_word_item(ast::Ident::with_dummy_span(sym::no_std));
let fake_attr = attr::mk_attr_inner(no_std_meta);
s.print_attribute(&fake_attr);
// Currently on Rust 2018 we don't have `extern crate std;` at the crate
// root, so this is not needed, and actually breaks things.
if sess.edition == syntax_pos::edition::Edition::Edition2015 {
// #![no_std]
let no_std_meta = attr::mk_word_item(ast::Ident::with_dummy_span(sym::no_std));
let fake_attr = attr::mk_attr_inner(no_std_meta);
s.print_attribute(&fake_attr);
}
}

s.print_mod(&krate.module, &krate.attrs);
Expand Down

0 comments on commit 846df20

Please sign in to comment.