Commit Graph

3085 Commits

Author SHA1 Message Date
Simon Sapin b2027ef17c Deprecate the std_unicode crate 2018-04-12 00:13:51 +02:00
bors 67712d7945 Auto merge of #49390 - Zoxc:sync-syntax, r=michaelwoerister
More thread-safety changes

r? @michaelwoerister
2018-04-10 09:00:27 +00:00
Zack M. Davis ba0dd8eb02 in which ! is suggested for erroneous identifier not
Impressing confused Python users with magical diagnostics is perhaps
worth this not-grossly-unreasonable (only 40ish lines) extra complexity
in the parser?

Thanks to Vadim Petrochenkov for guidance.

This resolves #46836.
2018-04-09 08:45:12 -07:00
Zack M. Davis 944c401736 don't suggest placing code in block if next token is open-brace
Thanks to the inestimably inimitable Esteban "Estebank" Küber for
pointing this out.

This is relevant to #46836.
2018-04-09 08:45:12 -07:00
Vadim Petrochenkov 3a30bad6de Use Ident instead of Name in MetaItem 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov bfaf4180ae Make lifetime nonterminals closer to identifier nonterminals 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov b3b5ef186c Remove more duplicated spans 2018-04-06 11:50:49 +03:00
Vadim Petrochenkov 62000c072e Rename ast::Variant_::name into ident + Fix rebase 2018-04-06 11:48:19 +03:00
Vadim Petrochenkov e2afefd80b Get rid of SpannedIdent 2018-04-06 11:48:19 +03:00
Vadim Petrochenkov 8719d1ed05 Rename PathSegment::identifier to ident 2018-04-06 11:46:26 +03:00
Vadim Petrochenkov baae274fb7 Use Span instead of SyntaxContext in Ident 2018-04-06 11:46:26 +03:00
Alex Crichton 46492ffabd Rollup merge of #49350 - abonander:macros-in-extern, r=petrochenkov
Expand macros in `extern {}` blocks

This permits macro and proc-macro and attribute invocations (the latter only with the `proc_macro` feature of course) in `extern {}` blocks, gated behind a new `macros_in_extern` feature.

A tracking issue is now open at #49476

closes #48747
2018-04-05 10:49:14 -05:00
Austin Bonander 5d74990ceb expand macro invocations in extern {} blocks 2018-04-03 13:16:11 -07:00
Aidan Hobson Sayers 9b5859aea1 Remove all unstable placement features
Closes #22181, #27779
2018-04-03 11:02:34 +02:00
bors 097efa9a99 Auto merge of #49124 - abonander:attr-macro-stmt-expr, r=abonander
Expand Attributes on Statements and Expressions

This enables attribute-macro expansion on statements and expressions while retaining the `stmt_expr_attributes` feature requirement for attributes on expressions.

closes #41475
cc #38356  @petrochenkov @jseyfried
r? @nrc
2018-04-02 10:38:28 +00:00
Austin Bonander 7c0124dd35 Expand attribute macros on statements and expressions.
Retains the `stmt_expr_attributes` feature requirement for attributes on expressions.

closes #41475
cc #38356
2018-04-02 01:56:12 -07:00
bors d2235f20b5 Auto merge of #49478 - Phlosioneer:fix-windows-file-not-found, r=petrochenkov
Fix escaped backslash in windows file not found message

When a module is declared, but no matching file exists, rustc gives
an error like `help: name the file either foo.rs or foo/mod.rs inside
the directory "src/bar"`. However, at on windows, the backslash was
double-escaped when naming the directory.

It did this because the string was printed in debug mode (`"{:?}"`) to
surround it with quotes. However, it should just be printed like any
other directory in an error message and surrounded by escaped quotes,
rather than relying on the debug print to add quotes (`"\"{}\""`).

I also checked the test suite to see if this output is being correctly tested. It's not - it only tests up to the word "directory". Presumably this is so that the test is not dependent on its exact position in the source tree. I don't know a better way to test this, unless the test suite supports regex?
2018-04-01 12:54:02 +00:00
Phlosioneer 19eedf98ff Fix escaped backslash in windows file not found message
When a module is declared, but no matching file exists, rustc gives
an error like 'help: name the file either foo.rs or foo/mod.rs inside
the directory "src/bar"'. However, at on windows, the backslash was
double-escaped when naming the directory.

It did this because the string was printed in debug mode ( "{:?}" ) to
surround it with quotes. However, it should just be printed like any
other directory in an error message and surrounded by escaped quotes,
rather than relying on the debug print to add quotes ( "\"{}\"" ).
2018-03-29 07:15:58 -04:00
John Kåre Alsaker c979189867 Make ParseSess thread-safe 2018-03-28 01:27:58 +02:00
John Kåre Alsaker 11ccc4cac6 Make LazyTokenStream thread-safe 2018-03-28 01:27:58 +02:00
kennytm 5eb4689d1f Rollup merge of #49395 - petrochenkov:obsolete, r=alexcrichton
libsyntax: Remove obsolete.rs

This little piece of infra is obsolete (ha-ha) and is unlikely to be used in the future, even if new obsolete syntax appears.
2018-03-27 10:47:51 +02:00
Vadim Petrochenkov 604bbee84c libsyntax: Remove obsolete.rs 2018-03-27 00:45:28 +03:00
Vadim Petrochenkov a637dd00c8 Fix pretty-printing for raw identifiers 2018-03-27 00:07:16 +03:00
Hidehito Yabuuchi 3bfed9e43f Better diagnostics for '..' pattern fragment not in the last position 2018-03-24 07:54:20 +09:00
Alex Crichton 82bb41bdab Merge branch 'master' of https://github.com/Lymia/rust into rollup 2018-03-23 10:16:40 -07:00
Lymia Aluysia bfb94ac5f4 Clean up raw identifier handling when recovering tokens from AST. 2018-03-22 10:34:51 -05:00
kennytm 8d3f3f0cac Rollup merge of #49117 - nivkner:fixme_fixup3, r=estebank
address some FIXME whose associated issues were marked as closed

part of #44366
2018-03-22 22:43:37 +08:00
bors 75af15ee6c Auto merge of #49190 - kennytm:rollup, r=kennytm
Rollup of 17 pull requests

- Successful merges: #46518, #48810, #48834, #48902, #49004, #49092, #49096, #49099, #49104, #49125, #49139, #49152, #49157, #49161, #49166, #49176, #49184
- Failed merges:
2018-03-20 10:18:34 +00:00
Vadim Petrochenkov 7c90189e13 Stabilize slice patterns without ..
Merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`
2018-03-20 02:27:40 +03:00
kennytm 73846dca7b Rollup merge of #49104 - csmoe:semicolon_error, r=petrochenkov
improve error message of inner attribute syntax

Fixes #49040
2018-03-20 07:15:23 +08:00
Lymia Aluysia 5c3d6320de Return a is_raw parameter from Token::ident rather than having separate methods. 2018-03-18 12:16:02 -05:00
Lymia Aluysia d2e7953d13 Move raw_identifiers check to the lexer. 2018-03-18 11:21:38 -05:00
Lymia Aluysia 7d5c29b9ea Feature gate raw identifiers. 2018-03-18 10:07:19 -05:00
Lymia Aluysia fad1648e0f Initial implementation of RFC 2151, Raw Identifiers 2018-03-18 10:07:19 -05:00
bors 5e3ecdce4e Auto merge of #48917 - petrochenkov:import, r=oli-obk
syntax: Make imports in AST closer to the source and cleanup their parsing

This is a continuation of https://github.com/rust-lang/rust/pull/45846 in some sense.
2018-03-18 01:50:52 +00:00
Vadim Petrochenkov 636357b09a Cleanup import parsing
Fix spans of root segments
2018-03-17 22:12:21 +03:00
Vadim Petrochenkov f88162654d Rename Span::empty to Span::shrink_to_lo, add Span::shrink_to_hi 2018-03-17 22:12:21 +03:00
Vadim Petrochenkov e5fb13897d AST: Keep distinction between path and ::path in imports and visibilities
Add the root segment for name resolution purposes only
2018-03-17 22:12:21 +03:00
Vadim Petrochenkov b057c554ab AST: Make renames in imports closer to the source
Fix `unused_import_braces` lint false positive on `use prefix::{self as rename}`
2018-03-17 22:12:21 +03:00
Vadim Petrochenkov c6c6cf9515 AST/HIR: Clarify what the optional name in extern crate items mean 2018-03-17 22:12:21 +03:00
Vadim Petrochenkov 5d06c890fe syntax: Make _ an identifier 2018-03-17 22:08:07 +03:00
Niv Kaminer c8be5c3174 remove FIXME(#8372) since for-loops wont support borrowing iterators 2018-03-17 20:25:23 +02:00
csmoe 9f5a356c1d improve attribute trailing semicolon error 2018-03-17 21:23:41 +08:00
bors c3fd5d0dde Auto merge of #48904 - Zoxc:code-and-file-maps, r=michaelwoerister
Make CodeMap and FileMap thread-safe

r? @michaelwoerister
2018-03-17 08:54:22 +00:00
bors 36b6687318 Auto merge of #49051 - kennytm:rollup, r=kennytm
Rollup of 17 pull requests

- Successful merges: #48706, #48875, #48892, #48922, #48957, #48959, #48961, #48965, #49007, #49024, #49042, #49050, #48853, #48990, #49037, #49049, #48972
- Failed merges:
2018-03-16 00:09:14 +00:00
kennytm e1d19df9a5 Rollup merge of #48922 - petrochenkov:asunder, r=nikomatsakis
Implement import renaming with `_` (RFC 2166)

cc https://github.com/rust-lang/rust/issues/48216
2018-03-16 01:49:42 +08:00
kennytm 6399d16cfd Disallow &a..=b and box a..=b in pattern.
They are disallowed because they have different precedence than
expressions. I assume parenthesis in pattern will be soon stabilized and
thus write that as suggestion directly.
2018-03-15 16:58:03 +08:00
John Kåre Alsaker 65b4990253 Use a single Lock for CodeMap.stable_id_to_filemap and CodeMap.files 2018-03-15 00:43:03 +01:00
John Kåre Alsaker cbdf4ec03e Remove syntax and syntax_pos thread locals 2018-03-14 11:56:01 +01:00
Vadim Petrochenkov 12ac032c72 Implement import renaming with _ (RFC 2166) 2018-03-14 12:32:53 +03:00