Commit Graph

78346 Commits

Author SHA1 Message Date
est31
128f2b5870 Test that label break value only works on actual blocks 2018-05-16 13:56:25 +02:00
est31
f8c2598dfc Add E0696 for continue pointing to a labeled block 2018-05-16 13:56:25 +02:00
est31
50f063c75b Extend error E0695 to unlabeled continue statements 2018-05-16 13:56:25 +02:00
est31
63ef53f21d Add E0695 for unlabeled breaks 2018-05-16 13:56:24 +02:00
est31
5665980ad8 Make the compiler support the label-break-value feature
No error checking or feature gating yet
2018-05-16 13:56:24 +02:00
est31
ebca9c6ab9 Add a file with test cases 2018-05-16 13:56:24 +02:00
est31
11f5893610 label-break-value: Parsing and AST/HIR changes 2018-05-16 13:56:24 +02:00
Eduard-Mihai Burtescu
22275f46b2 rustc_mir: focus const-checking logic on whether mutation is forbidden. 2018-05-16 14:19:47 +03:00
bors
2a3f5367a2 Auto merge of #50473 - petrochenkov:pmapi, r=alexcrichton
Review proc macro API 1.2

cc https://github.com/rust-lang/rust/issues/38356

Summary of applied changes:
- Documentation for proc macro API 1.2 is expanded.
- Renamed APIs: `Term` -> `Ident`, `TokenTree::Term` -> `TokenTree::Ident`, `Op` -> `Punct`, `TokenTree::Op` -> `TokenTree::Punct`, `Op::op` -> `Punct::as_char`.
- Removed APIs: `Ident::as_str`, use `Display` impl for `Ident` instead.
- New APIs (not stabilized in 1.2): `Ident::new_raw` for creating a raw identifier (I'm not sure `new_x` it's a very idiomatic name though).
- Runtime changes:
    - `Punct::new` now ensures that the input `char` is a valid punctuation character in Rust.
    - `Ident::new` ensures that the input `str` is a valid identifier in Rust.
    - Lifetimes in proc macros are now represented as two joint tokens - `Punct('\'', Spacing::Joint)` and `Ident("lifetime_name_without_quote")` similarly to multi-character operators.
- Stabilized APIs: None yet.

A bit of motivation for renaming (although it was already stated in the review comments):
- With my compiler frontend glasses on `Ident` is the single most appropriate name for this thing, *especially* if we are doing input validation on construction. `TokenTree::Ident` effectively wraps `token::Ident` or `ast::Ident + is_raw`, its meaning is "identifier" and it's already named `ident` in declarative macros.
- Regarding `Punct`, the motivation is that `Op` is actively misleading. The thing doesn't mean an operator, it's neither a subset of operators (there is non-operator punctuation in the language), nor superset (operators can be multicharacter while this thing is always a single character). So I named it `Punct` (first proposed in [the original RFC](https://github.com/rust-lang/rfcs/pull/1566), then [by @SimonSapin](https://github.com/rust-lang/rust/issues/38356#issuecomment-276676526)) , together with input validation it's now a subset of ASCII punctuation character category (`u8::is_ascii_punctuation`).
2018-05-16 11:18:05 +00:00
Eduard-Mihai Burtescu
4fec5ef81a rustc_mir: promote borrows' underlying temps, and project at runtime. 2018-05-16 14:11:02 +03:00
Eduard-Mihai Burtescu
d79dee0b62 rustc_mir: also promote interior borrows, not just whole temps. 2018-05-16 14:11:01 +03:00
Eduard-Mihai Burtescu
b9af400a46 rustc_mir: generate an extra temporary during borrowed rvalue promotion. 2018-05-16 14:11:01 +03:00
bors
448cc578a9 Auto merge of #48557 - matthewjasper:allow-trvial-bounds, r=nikomatsakis
Implement RFC 2056 trivial constraints in where clauses

This is an implementation of the new behaviour for #48214. Tests are mostly updated to show the effects of this. Feature gate hasn't been added yet.

Some things that are worth noting and are maybe not want we want

* `&mut T: Copy` doesn't allow as much as someone might expect because there is often an implicit reborrow.
* ~There isn't a check that a where clause is well-formed any more, so `where Vec<str>: Debug` is now allowed (without a `str: Sized` bound).~

r? @nikomatsakis
2018-05-16 09:03:38 +00:00
bors
3ec2058bfe Auto merge of #50795 - nrc:update, r=oli-obk
Update RLS and Rustfmt

Fixes RLS tests

r? @alexcrichton
2018-05-16 06:19:29 +00:00
SHA Miao
a2896bf814
fix a typo in signed-integer::from_str_radix()
just a small typo.
2018-05-16 14:18:53 +08:00
bors
75a00490c9 Auto merge of #50750 - est31:master, r=eddyb
Remove ScopeTarget and LoopIdResult

* Remove ScopeTarget in preparation of label-break-value (PR #50045)
* Replace LoopIdResult by Result which is possible now thanks to commit 8ac65af81f " Implement Encodable and Decodable for Result."

r? @eddyb
2018-05-16 04:00:33 +00:00
Nick Cameron
80bfca4ab2 Update RLS and Rustfmt 2018-05-16 15:59:55 +12:00
Shotaro Yamada
7eefe2b473 Fix rustdoc panic with impl Trait in type parameters 2018-05-16 11:03:02 +09:00
bors
3c31e17ddc Auto merge of #50541 - QuietMisdreavus:rustdoc-errors, r=GuillaumeGomez
rustdoc: replace most (e)println! statements with structured warnings/errors

Turns out, the rustc diagnostic handler doesn't need a whole lot of setup that we weren't already doing. For errors that occur outside a "dealing with source code" context, we can just use the format/color config we were already parsing and make up a `Handler` that we can emit structured warnings/errors from. So i did that. This will make it way easier to test things with `rustdoc-ui` tests, since those require the JSON error output. (In fact, this PR is a yak shave for a different one where i was trying to do just that. `>_>`)
2018-05-16 01:43:26 +00:00
bstrie
ab4735e2ea Null exclusions in grammar docs
The grammar documentation incorrectly says that comments, character literals,
and string literals may not include null.
2018-05-16 01:16:01 +00:00
bstrie
ce0b7cc529 Fix grammar documentation wrt Unicode identifiers
The grammar defines identifiers in terms of XID_start and XID_continue,
but this is referring to the unstable non_ascii_idents feature.
The documentation implies that non_ascii_idents is forthcoming, but this
is left over from pre-1.0 documentation; in reality, non_ascii_idents
has been without even an RFC for several years now, and will not be
stabilized anytime soon. Furthermore, according to the tracking issue at
https://github.com/rust-lang/rust/issues/28979 , it's highly
questionable whether or not this feature will use XID_start or
XID_continue even when or if non_ascii_idents is stabilized.
This commit fixes this by respecifying identifiers as the usual
[a-zA-Z_][a-zA-Z0-9_]*
2018-05-16 00:56:56 +00:00
Josh Stone
e8e5eb58c0 Ensure libraries built in stage0 have unique metadata
Issue #50786 shows a case with local rebuild where the libraries built
by stage0 had the same suffix as stage0's own, and were accidentally
loaded by that stage0 rustc when compiling `librustc_trans`.

Now we set `__CARGO_DEFAULT_LIB_METADATA` to "bootstrap" during stage0,
rather than the release channel like usual, so the library suffix will
always be completely distinct from the stage0 compiler.
2018-05-15 17:48:02 -07:00
varkor
a4224ebe8a Fix an ICE when casting a nonexistent const 2018-05-16 00:43:43 +01:00
Eric Huss
a90a963265 Fix run-make wasm tests
Fixes #50711
2018-05-15 16:39:21 -07:00
bors
e44fc6c52d Auto merge of #48523 - varkor:generics-ty-generalisations, r=nikomatsakis
The Great Generics Generalisation: Ty Edition

Part of the generic parameter refactoring effort, split off from https://github.com/rust-lang/rust/pull/48149. Contains the `ty`-relative refactoring.

r? @eddyb
2018-05-15 23:03:04 +00:00
Vadim Petrochenkov
dab8c0ab28 Fix stability annotations for already stable bits of proc macro API 1.1
Remove unnecessary proc-macro-related `feature`s
2018-05-16 00:09:15 +03:00
Vadim Petrochenkov
c106125431 Represent lifetimes as two joint tokens in proc macros 2018-05-15 23:54:08 +03:00
Matthew Jasper
be2900c33b Make is_global true for latebound regions 2018-05-15 21:48:35 +01:00
Vadim Petrochenkov
5b820a694c Address feedback, remove remaining review comments, add some more docs 2018-05-15 23:24:17 +03:00
Vadim Petrochenkov
780616ed74 proc_macro: Validate inputs to Punct::new and Ident::new 2018-05-15 23:24:16 +03:00
Vadim Petrochenkov
f116ab6e6e proc_macro: Properly support raw identifiers 2018-05-15 23:24:16 +03:00
Vadim Petrochenkov
47d4089e10 TokenTree: Op -> Punct, Term -> Ident 2018-05-15 23:24:16 +03:00
Vadim Petrochenkov
decc619a1f Extend documentation and add review comments 2018-05-15 23:24:16 +03:00
bors
f0fdaba04e Auto merge of #50767 - oli-obk:rls_clippy, r=kennytm
Don't inject clippy into the rls anymore

r? @kennytm

sorry about breaking nightlies.

The issue is that the `[patch.crates-io]` doesn't work if the versions differ. So every time we update clippy, we can only update it to the verison that rls is depending on.

I'm disabling the injection of clippy into rls for now. I'm not sure how to do this properly. We could

* add a version check, so rls only builds clippy if its dependency clippy is the same as the submodule clippy
* do something crazy like auto-patching the Cargo.toml of the rls tool repo to just use a path dependency on clippy
* build crates-io clippy instead of submodule clippy and gate clippy injection on that
    * that's somewhat automatic, and is essentially what is necessary right now, but done manually
* make clippy 0.1.* instead of 0.0.* and update patch versions for nightly updates and minor version updates for `clippy_lints` api changes.
    * not sure how semver-great this is
2018-05-15 20:18:13 +00:00
Guillaume Gomez
564511e58b add auto-impl for primitive type 2018-05-15 21:37:12 +02:00
Anthony Ramine
5701779b8e Reenable the MergeFunctions pass
The crash that happened in #23566 doesn't happen anymore with the LLVM mergefunc
pass enabled and it hugely reduces code size (for example it shaves off 10% of the
final Servo executable). This patch reenables it.
2018-05-15 21:10:40 +02:00
leonardo.yvens
0582d025e8 Rename ret_ty to declared_ret_ty 2018-05-15 15:42:41 -03:00
Clar Charr
8ab2d15f67 Add Option::xor method 2018-05-15 12:49:31 -04:00
Anthony Ramine
ba2b4b1eed Make mutable_noalias and arg_align_attributes be tracked 2018-05-15 18:03:10 +02:00
Alex Crichton
dff9ee1d74 rustc: Fix crate lint for single-item paths
This commit fixes recommending the `crate` prefix when migrating to 2018 for
paths that look like `use foo;` or `use {bar, baz}`

Closes #50660
2018-05-15 08:05:34 -07:00
Anthony Ramine
e6f61be4cd Update LLVM to 1abfd0e562cc8f7a9577d97ee92246699093b954
https://github.com/rust-lang/llvm/pull/111
https://github.com/rust-lang/llvm/pull/114
2018-05-15 16:51:06 +02:00
varkor
5be2bdb498 One must always remember to clean up after themselves 2018-05-15 14:52:53 +01:00
est31
4d328f786e Pattern match on Ok instead of Some of .ok() retval 2018-05-15 15:47:57 +02:00
est31
235e7c1b43 Remove LoopIdResult
It's redundant as Result already implements Encodable
as well as Decodable.
2018-05-15 15:47:32 +02:00
est31
3ef481a520 Remove hir::ScopeTarget
When we want to implement label-break-value,
we can't really decide whether to emit ScopeTarget::Loop or
ScopeTarget::Block in the code that is supposed to create it.
So we get rid of it and reconstruct the information when
needed.
2018-05-15 15:47:31 +02:00
varkor
5ea91ac531 Collapse Substs::identity_for_item in collect 2018-05-15 14:22:25 +01:00
varkor
39a68e9069 Clean up dropck_outlives PhantomData handling 2018-05-15 14:22:25 +01:00
varkor
0a9371ab77 Add mk_param_from_def 2018-05-15 14:22:25 +01:00
varkor
e9c28b2564 Use Kind instead of UnpackedKind in Substs methods 2018-05-15 14:22:25 +01:00
varkor
3ae2468261 Clean up shared subst code 2018-05-15 14:22:11 +01:00