Commit Graph

92666 Commits

Author SHA1 Message Date
David Wood
44ddbc5565
Correct lowering order to avoid ICE after rebase.
This commit changes the order that arguments and bodies of async
functions are lowered so that when the body attempts to `lower_def` of a
upvar then the id has already been assigned by lowering the argument
first.
2019-04-21 16:46:32 +01:00
David Wood
9d7da824d6
Introduce ArgSource for diagnostics.
This commit introduces an `ArgSource` enum that is lowered into the HIR
so that diagnostics can correctly refer to the argument pattern's
original name rather than the generated pattern.
2019-04-21 16:46:32 +01:00
David Wood
92e72df2c1
Do not specify type in generated let bindings.
This avoids issues with `impl_trait_in_bindings` as the type from the
argument is normally used as the let binding, but `impl Trait` is
unstable in binding position.
2019-04-21 16:46:32 +01:00
David Wood
61346557ce
Enforce consistent drop order w/ async methods.
This commit extends the previous commit to apply to trait methods as
well as free functions.
2019-04-21 16:46:32 +01:00
David Wood
7c6dc7a254
Move async fn arguments into closure.
This commit takes advantage of `AsyncArgument` type that was added in a
previous commit to replace the arguments of the `async fn` in the HIR
and add statements to move the bindings from the new arguments to the
pattern from the old argument.

For example, the async function `foo` below:

    async fn foo((x, _y): (T, V)) {
        async move {
        }
    }

becomes:

    async fn foo(__arg0: (T, V)) {
        async move {
            let (x, _y) = __arg0;
        }
    }
2019-04-21 16:46:32 +01:00
David Wood
879abb1641
Add AsyncArgument to AST.
This commit adds an `AsyncArgument` struct to the AST that contains the
generated argument and statement that will be used in HIR lowering, name
resolution and def collection.
2019-04-21 16:46:32 +01:00
Igor Matuszewski
2dccaa77f8 Use sysroot libserialize in newtype_index test 2019-04-21 15:58:06 +02:00
bors
31a75a1728 Auto merge of #60124 - petrochenkov:stanomut, r=eddyb
Remove mutability from `Def::Static`

Querify `TyCtxt::is_static`.
Use `Mutability` instead of bool in foreign statics in AST/HIR.

cc https://github.com/rust-lang/rust/pull/60110
r? @eddyb
2019-04-21 13:40:22 +00:00
Vadim Petrochenkov
4eb94b4407 AST/HIR: Use Mutability instead of bool in foreign statics 2019-04-21 15:29:58 +03:00
Vadim Petrochenkov
53ffcd96b7 Remove mutability from Def::Static 2019-04-21 15:05:55 +03:00
Vadim Petrochenkov
6c187cc0c6 Change return type of TyCtxt::is_static to bool
Add `TyCtxt::is_mutable_static`
2019-04-21 14:41:51 +03:00
Vadim Petrochenkov
286a469a16 Introduce query static_mutability 2019-04-21 14:16:44 +03:00
Igor Matuszewski
4fb570dea7 Switch to serde-enabled rls-* and update RLS appropriately
This also bumps RLS version to 1.36.
The updated rls-* packages use serde but *not* serde_derive thanks to
manual proc macro expansion. This is a hack, since rustc cannot handle
crates.io proc macros (duplicated in tools) when cross-compiling, so
that's the best we can do in order to support serde_json in save-analysis.
2019-04-21 12:52:07 +02:00
Igor Matuszewski
25451967ee save-analysis: Use serde instead of libserialize to dump JSON data 2019-04-21 12:45:16 +02:00
bors
06a271a6eb Auto merge of #60119 - estebank:bad-recovery, r=davidtwco
Remove assumption from recovery code

Fix #60115.
2019-04-21 10:13:27 +00:00
Philipp Hansch
8e5555909c
Allow unused_extern_crates for rustc_libserialize 2019-04-21 10:52:12 +02:00
David Wood
41c6bb1096
Introduce LocalSource into the AST.
This will be used to keep track of the origin of a local in the AST. In
particular, it will be used by `async fn` lowering for the locals in
`let <pat>: <ty> = __arg0;` statements.
2019-04-21 09:48:11 +01:00
David Wood
8b57be1bb3
Add test for drop order in async functions.
This tests that async functions drop parameters in the same order as
regular functions.
2019-04-21 09:48:11 +01:00
bors
4d9c6cd722 Auto merge of #60132 - davidtwco:issue-60075, r=estebank
Fix fn front matter parsing ICE from invalid code.

Fixes #60075.

This PR fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.

r? @estebank (thanks for the minimized test case)
2019-04-21 07:20:14 +00:00
Manish Goregaokar
cdca41d684 Update Fira Sans to version 4.202
From https://github.com/mozilla/Fira
2019-04-20 20:50:33 -07:00
Manish Goregaokar
6bafc58ced Update Source Code Pro fonts to version 2.030
Pulled in from https://github.com/adobe-fonts/source-code-pro/
2019-04-20 20:50:33 -07:00
Manish Goregaokar
e14819ac03 Update Source Serif Pro fonts to version 2.010
Pulled in from https://github.com/adobe-fonts/source-serif-pro/

See https://bugzilla.mozilla.org/show_bug.cgi?id=1545317
2019-04-20 20:50:33 -07:00
bors
9224be5fa3 Auto merge of #60116 - RalfJung:miri-exit, r=oli-obk
add Miri error variant for process exit

This is to support https://github.com/rust-lang/miri/pull/702

r? @oli-obk
2019-04-21 02:38:15 +00:00
bors
c3a7194354 Auto merge of #60088 - varkor:async_await-method-feature-gate, r=cramertj
Feature gate async methods

Fixes https://github.com/rust-lang/rust/issues/60069.
2019-04-20 23:44:02 +00:00
varkor
ee496057a5 Update error message in test 2019-04-20 22:32:47 +01:00
varkor
98c71c36d6 Check async in trait methods 2019-04-20 22:03:39 +01:00
varkor
93c4b1f491 Fix additional variadic typos 2019-04-20 22:03:39 +01:00
varkor
fb2af77763 Fix typo in variadic C function warning 2019-04-20 22:03:39 +01:00
varkor
c93c7e4e7c Add test for async fn methods feature gating 2019-04-20 22:03:39 +01:00
varkor
47a558ed7c Feature gate async fn methods 2019-04-20 22:03:39 +01:00
varkor
4bbd29f206 Refactor some existing methods 2019-04-20 22:03:39 +01:00
varkor
c0ad4b0a96 Add a header method to FnKind 2019-04-20 22:03:39 +01:00
bors
33fe1131ca Auto merge of #59826 - llogiq:multi-dbg, r=SimonSapin
allow multiple args to `dbg!(..)`

This closes #59763
2019-04-20 20:55:29 +00:00
bors
4530c528ba Auto merge of #59700 - matklad:simplify, r=eddyb
Simplify doc comment lexing

is_doc_comment function checks the first four chars, but this is
redundant, `doc_comment` local var has the same info.
2019-04-20 17:59:15 +00:00
Philipp Hansch
c9ae68812f
Deny rust_2018_idioms in libcore tests 2019-04-20 18:44:29 +02:00
Ralf Jung
79b91b7cdd improve docs 2019-04-20 18:38:39 +02:00
bors
72bc62047f Auto merge of #59987 - saleemjaffer:refactor_adjust_castkinds, r=oli-obk
Refactor Adjust and CastKind

fixes rust-lang#59588
2019-04-20 15:06:15 +00:00
Philipp Hansch
110a73d6c6
Deny rust_2018_idioms in liballoc tests 2019-04-20 16:05:25 +02:00
bors
0d1732212f Auto merge of #59564 - bjorn3:move_link_to_cg_ssa, r=eddyb
Move back::link and debuginfo::type_names to cg ssa

r? @eddyb
2019-04-20 12:18:49 +00:00
Philipp Hansch
d5d1ee86bb
Deny rust_2018_idioms globally 2019-04-20 13:45:46 +02:00
bjorn3
3af60e09a1 Tidy 2019-04-20 13:21:40 +02:00
bjorn3
d4e7b083ce Move cg_llvm/debuginfo/type_names.rs to cg_ssa 2019-04-20 13:21:40 +02:00
bjorn3
dd4566f511 Remove cg_llvm/back/link.rs 2019-04-20 13:21:40 +02:00
bjorn3
93a3b414e3 Move almost all of cg_llvm/back/link.rs to cg_ssa 2019-04-20 13:21:40 +02:00
bjorn3
de4ee55dc7 Remove get_reloc_model and target_cpu dependency from most of link.rs 2019-04-20 13:21:40 +02:00
bjorn3
d8bce01a04 Make link functions generic over archive builder 2019-04-20 13:21:40 +02:00
bjorn3
892c88b32f Move some filename constants to cg_ssa 2019-04-20 13:21:40 +02:00
bjorn3
8a8837967f Move some function from cg_llvm/back/link.rs to cg_ssa/back/link.rs 2019-04-20 13:21:40 +02:00
David Wood
60c6ed9664
Fix fn front matter parsing ICE from invalid code.
This commit fixes an "unreachable code" ICE that results from parsing
invalid code where the compiler is expecting the next trait item
declaration in the middle of the previous trait item due to extra
closing braces.
2019-04-20 11:36:04 +01:00
bors
647a951b08 Auto merge of #60128 - jimblandy:futures-doc-fix, r=withoutboats
Doc fixes for core::future::Future.

Fixed outdated reference to `waker` argument; now futures are passed a
`Context`, from which one can obtain a `waker`.

Cleaned up explanation of what happens when you call `poll` on a completed
future. It doesn't make sense to say that `poll` implementations can't cause
memory unsafety; no safe function is ever allowed to cause memory unsafety, so
why mention it here? It seems like the intent is to say that the `Future` trait
doesn't say what the consequences of excess polls will be, and they might be
bad; but that the usual constraints that Rust imposes on any non-`unsafe`
function still apply. It's also oddly specific to say 'memory corruption'
instead of just 'undefined behavior'; UB is a bit jargony, so the text should
provide examples.
2019-04-20 09:30:51 +00:00