diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-24 14:56:00 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-24 14:56:00 -0700 |
| commit | 91b633aa038008fdbee658a10182afdd794d2aa6 (patch) | |
| tree | 9aace54d26dfdc7e66a1ec1b273f00770b801ad3 /src/libsyntax/print/pprust.rs | |
| parent | 5ed8733ea39927d267f4e99c16d3fdca671d8315 (diff) | |
| parent | eb2f1d925ffdb79d45c7b74cef549e54533c3951 (diff) | |
| download | rust-91b633aa038008fdbee658a10182afdd794d2aa6.tar.gz rust-91b633aa038008fdbee658a10182afdd794d2aa6.zip | |
rollup merge of #23546: alexcrichton/hyphens
The compiler will now issue a warning for crates that have syntax of the form `extern crate "foo" as bar`, but it will still continue to accept this syntax. Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist in the transition period as well. This patch will land hopefully in tandem with a Cargo patch that will start translating all crate names to have underscores instead of hyphens. cc #23533
Diffstat (limited to 'src/libsyntax/print/pprust.rs')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 5941f044a07..2bc3fc1017a 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -821,8 +821,13 @@ impl<'a> State<'a> { ast::ItemExternCrate(ref optional_path) => { try!(self.head(&visibility_qualified(item.vis, "extern crate"))); - if let Some((ref p, style)) = *optional_path { - try!(self.print_string(p, style)); + if let Some(p) = *optional_path { + let val = token::get_name(p); + if val.contains("-") { + try!(self.print_string(&val, ast::CookedStr)); + } else { + try!(self.print_name(p)); + } try!(space(&mut self.s)); try!(word(&mut self.s, "as")); try!(space(&mut self.s)); |
