Commit Graph

93213 Commits

Author SHA1 Message Date
Matthew Jasper
36fd00e81c Allow late bound regions in existential types 2019-05-13 21:57:20 +01:00
bors
a9ec99f420 Auto merge of #60649 - Xanewok:save-analysis-assoc-const-ice, r=oli-obk
save-analysis: Fix ICE when processing associated constant

Closes #59134
Closes https://github.com/rust-lang/rls/issues/1449

Thanks @swgillespie for helping tracking this down and fixing it!

r? @eddyb
2019-05-13 10:57:59 +00:00
bors
69ef8fbe70 Auto merge of #60765 - matthewjasper:fix-more-escaping-rescopes, r=oli-obk
Fix more escaping ReScopes

Closes #58840
2019-05-13 08:13:01 +00:00
bors
fe5f42cdb8 Auto merge of #60630 - nnethercote:use-Symbol-more, r=petrochenkov
Use `Symbol` more

A `Symbol` can be equated with a string (e.g. `&str`). This involves a
TLS lookup to get the chars (and a Mutex lock in a parallel compiler)
and then a char-by-char comparison. This functionality is convenient but
avoids one of the main benefits of `Symbol`s, which is fast equality
comparisons.

This PR removes the `Symbol`/string equality operations, forcing a lot
of existing string occurrences to become `Symbol`s. Fortunately, these
are almost all static strings (many are attribute names) and we can add
static `Symbol`s as necessary, and very little extra interning occurs.
The benefits are (a) a slight speedup (possibly greater in a parallel
compiler), and (b) the code is a lot more principled about `Symbol` use.
The main downside is verbosity, particularly with more `use
syntax::symbol::symbols` items.

r? @Zoxc
2019-05-13 00:28:38 +00:00
Nicholas Nethercote
ea9fac5687 Return a Symbol from name_or_empty functions. 2019-05-13 09:31:32 +10:00
Nicholas Nethercote
999c1fc281 Remove the equality operation between Symbol and strings.
And also the equality between `Path` and strings, because `Path` is made
up of `Symbol`s.
2019-05-13 09:31:30 +10:00
Nicholas Nethercote
fb084a48e2 Pass a Symbol to check_name, emit_feature_err, and related functions. 2019-05-13 09:29:22 +10:00
Nicholas Nethercote
79602c87b5 Rename syntax::symbol::symbols as syntax::symbol::sym.
Because it's going to be used a lot.
2019-05-13 09:26:43 +10:00
Nicholas Nethercote
a8245f5a38 Add lots of static Symbols.
These will be used in the subsequent commits. Many of them are
attributes.

The commit also adds the ability to handle symbols that aren't
identifiers (e.g. "proc-macro").
2019-05-13 09:26:43 +10:00
bors
4443957f27 Auto merge of #60767 - Centril:rollup-4cbsb73, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #60694 (Fix HIR printing of existential type #60662)
 - #60750 (syntax: Remove some legacy nonterminal tokens)
 - #60751 (Assorted cleanup in parser & AST validation)
 - #60752 (Fix minor typos for ItemLocalId)

Failed merges:

r? @ghost
2019-05-12 20:28:19 +00:00
Mazdak Farrokhzad
b381e52c7c
Rollup merge of #60752 - shiatsumat:minor-typos-hir, r=wesleywiser
Fix minor typos for ItemLocalId

* added comma after 'that is'
* "can be implement" -> "can be implemented"
2019-05-12 21:14:11 +02:00
Mazdak Farrokhzad
c0aeaa1bfd
Rollup merge of #60751 - Centril:general-cleanup, r=petrochenkov
Assorted cleanup in parser & AST validation

r? @petrochenkov

Extracted out of a larger PR.
2019-05-12 21:14:10 +02:00
Mazdak Farrokhzad
d11b6be6b9
Rollup merge of #60750 - petrochenkov:noquotok2, r=Mark-Simulacrum
syntax: Remove some legacy nonterminal tokens

They were used by legacy quote macros removed in https://github.com/rust-lang/rust/pull/51285.
2019-05-12 21:14:08 +02:00
Mazdak Farrokhzad
8327517946
Rollup merge of #60694 - Pulkit07:issue60662, r=alexreg
Fix HIR printing of existential type #60662

This fixes https://github.com/rust-lang/rust/issues/60662
2019-05-12 21:14:07 +02:00
Matthew Jasper
9a4f0abd7a Don't allow any ReScope in impl trait types
This shouldn't be possible any more, but if it does happen, emit an
error rather than maybe panicking later when NLL finds a the ReScope.
Impl trait in bindings is sufficiently broken that I don't think this
breaks anything that works for it.
2019-05-12 18:51:40 +01:00
bors
1764b29725 Auto merge of #60679 - petrochenkov:lit2, r=matklad
Keep original literal tokens in AST

The original literal tokens (`token::Lit`) are kept in AST until lowering to HIR.

The tokens are kept together with their lowered "semantic" representation (`ast::LitKind`), so the size of `ast::Lit` is increased (this also increases the size of meta-item structs used for processing built-in attributes).
However, the size of `ast::Expr` stays the same.

The intent is to remove the "semantic" representation from AST eventually and keep literals as tokens until lowering to HIR (at least), and I'm going to work on that, but it would be good to land this sooner to unblock progress on the [lexer refactoring](https://github.com/rust-lang/rust/pull/59706).

Fixes a part of https://github.com/rust-lang/rust/issues/43081 (literal tokens that are passed to proc macros are always precise, including hexadecimal numbers, strings with their original escaping, etc)
Fixes a part of https://github.com/rust-lang/rust/issues/60495 (everything except for proc macro API doesn't need escaping anymore)
This also allows to eliminate a certain hack from the lexer (https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/pretty-printing.20comments/near/165005357).

cc @matklad
2019-05-12 17:44:06 +00:00
Matthew Jasper
1f5145e273 Treat generators the same as closure for escaping lifetimes 2019-05-12 17:52:33 +01:00
Matthew Jasper
664c8ed301 Always use the stronger outlives version for opaque types 2019-05-12 17:12:49 +01:00
bors
0df1e57991 Auto merge of #60244 - SimonSapin:dangling, r=oli-obk
const-stabilize NonNull::dangling and NonNull::cast
2019-05-12 14:32:11 +00:00
bors
efa3c27f0f Auto merge of #60474 - mati865:musl_toolchain, r=alexcrichton
Make tests compatible with musl host

As an alternative to passing explicit linker all over the place I could try linking `cc` to musl gcc since this bootstraps itself.

Assigning for discussion:
r? @alexcrichton
2019-05-12 09:19:28 +00:00
bors
16e356ebdf Auto merge of #60396 - cuviper:ordered-retain, r=scottmcm
Document the order of {Vec,VecDeque,String}::retain

It's natural for `retain` to work in order from beginning to end, but
this wasn't actually documented to be the case. If we actually promise
this, then the caller can do useful things like track the index of each
element being tested, as [discussed in the forum][1]. This is now
documented for `Vec`, `VecDeque`, and `String`.

[1]: https://users.rust-lang.org/t/vec-retain-by-index/27697

`HashMap` and `HashSet` also have `retain`, and the `hashbrown`
implementation does happen to use a plain `iter()` order too, but it's
not certain that this should always be the case for these types.

r? @scottmcm
2019-05-12 06:24:10 +00:00
Yusuke Matsushita
0fc2cfb66c
Fix minor typos for ItemLocalId
* added comma before 'that is'
* "can be implement" -> "can be implemented"
2019-05-12 09:52:38 +09:00
Mazdak Farrokhzad
4aa4a8f776 Minor cleanup in parse_assoc_expr_with. 2019-05-12 02:17:34 +02:00
Mazdak Farrokhzad
b680b66ddd parse_bottom_expr: extract common 'return' out. 2019-05-12 02:01:32 +02:00
Mazdak Farrokhzad
9b4a630baa syntax::parse::parser: convert unnecessary '&mut self's to '&self'. 2019-05-12 02:00:06 +02:00
Mazdak Farrokhzad
0535e42678 ast_validation: comments -> doc comments 2019-05-12 01:52:46 +02:00
Vadim Petrochenkov
14b353820f syntax: Remove some legacy nonterminal tokens 2019-05-12 02:01:56 +03:00
Pulkit Goyal
3b78a474f3 Fix HIR printing of existential type #60662
This fixes https://github.com/rust-lang/rust/issues/60662
2019-05-12 01:50:58 +03:00
bors
d28e948b92 Auto merge of #60748 - Centril:rollup-rr63jqo, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #60720 (Remove unnecessary unwraps)
 - #60727 (add comment to `Rc`/`Arc`'s `Eq` specialization)
 - #60733 (Cleanup the .await HIR lowering with .stmt(..).)
 - #60741 (Remove redundant "let mut" in write_graph_label)

Failed merges:

r? @ghost
2019-05-11 22:13:10 +00:00
Mazdak Farrokhzad
f2dd97cc34
Rollup merge of #60741 - shiatsumat:patch-let-mut-write-graph-label, r=varkor
Remove redundant "let mut" in write_graph_label

Removed the redundant "let mut" in the write_graph_label function (it caused "let mut let mut" for non-user-defined local variables).
2019-05-11 23:41:41 +02:00
Mazdak Farrokhzad
5490cc1a41
Rollup merge of #60733 - Centril:cleanup-lowering-await, r=varkor
Cleanup the .await HIR lowering with .stmt(..).

r? @cramertj
2019-05-11 23:41:40 +02:00
Mazdak Farrokhzad
e19ad45107
Rollup merge of #60727 - chpio:master, r=sfackler
add comment to `Rc`/`Arc`'s `Eq` specialization

in addition to https://github.com/rust-lang/rust/pull/56550

https://github.com/rust-lang/rust/pull/42965#issuecomment-312702479
2019-05-11 23:41:38 +02:00
Mazdak Farrokhzad
5da009e23a
Rollup merge of #60720 - estebank:no-ice-thanks, r=zackmdavis
Remove unnecessary unwraps

Fix #60713.
2019-05-11 23:41:37 +02:00
bors
af98304b9a Auto merge of #60318 - jethrogb:jb/try-from-slice-to-infallible, r=sfackler
impl From<Infallible> for TryFromSliceError

I believe this was missed when TryFrom was stabilized. I think `TryFromSliceError` and `TryFromIntError` are the only two `TryFrom` error types that appear in `std`. I think trait implementations have to be insta-stable, but I'm not sure.
2019-05-11 19:13:12 +00:00
Yusuke Matsushita
a145b14b3e
Remove redundant "let mut" in write_graph_label
Removed the redundant "let mut" in the write_graph_label function (it caused "let mut let mut" for non-user-defined local variables).
2019-05-12 01:47:20 +09:00
bors
3103fb2f72 Auto merge of #60739 - Manishearth:clippyup, r=Manishearth
Update clippy

r? @ghost
2019-05-11 16:26:12 +00:00
Manish Goregaokar
d17713599c Update clippy 2019-05-11 09:02:12 -07:00
Vadim Petrochenkov
83ed781c01 Address comments + Fix tests 2019-05-11 17:06:55 +03:00
Mazdak Farrokhzad
362431b4d6 Cleanup the .await HIR lowering with .stmt(..). 2019-05-11 15:42:14 +02:00
Vadim Petrochenkov
3f064cae3d Move literal parsing code into a separate file
Remove some dead code
2019-05-11 16:03:16 +03:00
bors
5f1924c992 Auto merge of #60714 - varkor:existential-global-lift-ice, r=oli-obk
Fix ICE with un-feature-gated existential type

Fixes https://github.com/rust-lang/rust/issues/60371.

r? @oli-obk
2019-05-11 12:25:11 +00:00
Vadim Petrochenkov
8739668438 Simplify conversions between tokens and semantic literals 2019-05-11 14:24:21 +03:00
Vadim Petrochenkov
a5b3f33cb9 Eliminate comments::Literal 2019-05-11 14:24:21 +03:00
Vadim Petrochenkov
751ae5af1a Introduce hir::Lit not keeping the original token 2019-05-11 14:24:21 +03:00
Vadim Petrochenkov
f2834a403a Keep the original token in ast::Lit 2019-05-11 14:24:21 +03:00
Vadim Petrochenkov
28b125b83d Turn ast::Lit into a struct 2019-05-11 14:24:21 +03:00
bors
af39a1fd73 Auto merge of #60717 - varkor:impl-const-generic, r=matthewjasper
Fix a bug preventing const parameters from being used in const generic impls

Fixes https://github.com/rust-lang/rust/issues/60712.
2019-05-11 09:24:45 +00:00
Thomas Heck
740a8dabb4 add comment to Rc/Arc's Eq specialization 2019-05-11 11:03:28 +02:00
bors
b8e0d0a2aa Auto merge of #60700 - petrochenkov:preintern, r=nnethercote
syntax_pos: Optimize symbol interner pre-filling slightly

r? @nnethercote
2019-05-11 06:42:36 +00:00
bors
7519eaca9a Auto merge of #60721 - estebank:ice-ice-baby, r=varkor
Avoid ICE by using delay_span_bug

Fix #59406, fix #53498.
2019-05-11 03:56:11 +00:00