Commit Graph

103410 Commits

Author SHA1 Message Date
Vadim Petrochenkov
32aa58c96b rustc_metadata: Privatize CrateMetadata::source 2019-11-28 20:59:56 +03:00
Vadim Petrochenkov
e2414852b1 rustc_metadata: Privatize CrateMetadata::extern_crate 2019-11-28 20:59:56 +03:00
Vadim Petrochenkov
37304cda63 rustc_metadata: Privatize CrateMetadata::dependencies 2019-11-28 20:59:56 +03:00
Vadim Petrochenkov
0525cf9d68 rustc_metadata: Cleanup generation of crate dependency lists 2019-11-28 20:58:46 +03:00
Ralf Jung
9e940f0277 update Miri 2019-11-28 18:40:05 +01:00
bors
bbb664a99c Auto merge of #66642 - ecstatic-morse:promotion-in-const, r=eddyb
Create promoted MIR fragments for `const` and `static`s

Resolves #65732.

The previous strategy of removing `Drop` and `StorageDead` for promoted locals only worked for rvalue lifetime extension and only if no `loop`s were present. This PR applies the approach currently used for `fn` and `const fn`s to `const` and `statics`.

This may have some performance impacts.

r? @eddyb
2019-11-28 17:30:24 +00:00
bors
f453d1127d Auto merge of #66603 - Nadrieril:fix-65413, r=varkor
Fix #65413

#65413 was due to an oversight in `pat_constructor` that didn't check if a particular const value was maybe a slice/array const.
2019-11-28 14:22:47 +00:00
Ohad Ravid
85a468b8cf Clarify {f32,f64}::EPSILON docs 2019-11-28 13:49:58 +01:00
bors
4752c05af4 Auto merge of #66246 - matthewjasper:simplify-mem-cat, r=pnkfelix
Simplify memory categorization

With AST borrowck gone, mem_categorization can be simplified, a lot.

* `cmt_` is now called `Place`. Most local variable names have been updated to reflect this, but the `cat_*` methods retain their names.
* `MemCategorizationContext` no longer needs a `ScopeTree` and always needs an `InferCtxt`.
* `Place` now uses a similar representation to `mir::Place` with a `Vec` of projections.
* `Upvar` places don't include the implicit environment and capture derefs. These are now handled by `regionck` when needed.
* Various types, methods and variants only used by AST borrowck have been removed.
* `ExprUseVisitor` now lives in `rustc_typeck::expr_use_visitor`.
* `MemCategorizationContext` and `Place` live in `rustc_typeck::mem_categorization`.
* `Place` is re-exported in `rustc_typeck::expr_use_visitor` so that Clippy can access it.

The loss of an error in `issue-4335.rs` is due to a change in capture inference in ill-formed programs. If any projection from a variable is moved from then we capture that variable by move, whether or not the place being moved from allows this.

Closes #66270
2019-11-28 10:36:56 +00:00
David Haig
6531ba882e Moved tests and fixed merge conflict 2019-11-28 08:24:19 +00:00
Ralf Jung
5d23518a12 const_prop: detect and avoid catching Miri errors that require allocation 2019-11-28 09:03:00 +01:00
David Haig
e88948a196 Fail fast if generator_kind is None 2019-11-28 07:46:34 +00:00
David Haig
ed66492a6a Block indent formatting 2019-11-28 07:46:33 +00:00
David Haig
65c399613c Fixed unit test 2019-11-28 07:46:33 +00:00
David Haig
63b36e7127 Reduced repetition by refactoring new body to constructor function 2019-11-28 07:46:33 +00:00
David Haig
eda2d416f6 Removed FIXME comment 2019-11-28 07:43:53 +00:00
David Haig
4b85ee2c05 Fixed tidy errors 2019-11-28 07:43:53 +00:00
David Haig
6ef625fb41 Remove duplication using single variant for error 2019-11-28 07:43:53 +00:00
David Haig
88821ed54d Fixed merge issue 2019-11-28 07:43:53 +00:00
David Haig
fb0972dadf Fixed merge issue 2019-11-28 07:43:53 +00:00
David Haig
ec41fda58b Squash 2019-11-28 07:43:53 +00:00
bors
2539b5f157 Auto merge of #66294 - davidhewitt:const_fn_memoization, r=oli-obk
Add memoization for const function evaluations

When a const function is being evaluated, as long as all its arguments are zero-sized-types (or it has no arguments) then we can trivially memoize the evaluation result using the existing query mechanism.

With thanks to @oli-obk for mentoring me through this at RustFest Barcelona.

r? @oli-obk
2019-11-28 07:06:40 +00:00
bors
96ad8e5fbc Auto merge of #65013 - petertodd:2019-maybeuninit-debug, r=sfackler
Implement Debug for MaybeUninit

Precedent: `UnsafeCell` implements `Debug` even though it can't actually display the value. I noticed this omission while writing the following:

```
#[derive(Debug)]
 pub struct SliceInitializer<'a, T> {
    marker: PhantomData<&'a mut T>,
    uninit: &'a mut [MaybeUninit<T>],
    written: usize,
}
```

...which currently unergonomically fails to compile.

`UnsafeCell` does require `T: Debug`. Because of things like the above I think it'd be better to leave that requirement off. In fact, I'd also suggest removing that requirement for `UnsafeCell` too, which again I noticed in some low-level real world code.
2019-11-28 03:41:29 +00:00
bors
42f93dedbe Auto merge of #66829 - Manishearth:clippyup, r=Manishearth
Update clippy

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

r? @ghost
2019-11-28 00:36:23 +00:00
Dylan DPC
77f2ac4a49
Update CONTRIBUTING.md 2019-11-28 01:26:45 +01:00
Dylan DPC
2a7dc5ec7f
Update CONTRIBUTING.md 2019-11-28 01:23:39 +01:00
Dylan MacKenzie
846be82277 Update test for mutably borrowed statics in a const
This checks `static mut` as well for E0017, and blesses tests now that
we emit an error for a mut deref.
2019-11-27 16:14:37 -08:00
Dylan MacKenzie
a70ac50ec4 Don't treat a reference to a static as a reborrow
They now look the same in the MIR after #66587.
2019-11-27 16:14:37 -08:00
Manish Goregaokar
9448e68480 Update clippy 2019-11-27 15:30:55 -08:00
Dylan MacKenzie
5b1e10b2f6 Remove test for unused error code
This error code is never emitted, and the contents of this test are
identical to that of `E0017.rs`.
2019-11-27 14:37:06 -08:00
Dylan MacKenzie
d2bdaa8deb Also test shared borrows of Cell for good errors 2019-11-27 14:37:06 -08:00
Dylan MacKenzie
dd32d911d6 Remove CheckOpResult 2019-11-27 14:37:06 -08:00
Ralf Jung
2869abacfa comment 2019-11-27 23:36:39 +01:00
Ralf Jung
3e7a5a4e0b handle diverging functions forwarding their return place 2019-11-27 23:33:49 +01:00
Mark Lodato
9b78191e08 Clarifies how to tag users for assigning PRs 2019-11-27 17:19:09 -05:00
bors
6b604a91b7 Auto merge of #66824 - tmandry:rollup-kk56bte, r=tmandry
Rollup of 17 pull requests

Successful merges:

 - #64325 (Stabilize nested self receivers in 1.41.0)
 - #66222 (Use `eq_opaque_type_and_type` when type-checking closure signatures)
 - #66305 (Add by-value arrays to `improper_ctypes` lint)
 - #66399 (rustc_metadata: simplify the interactions between Lazy and Table.)
 - #66534 (Allow global references via ForeignItem and Item for the same symbol name during LLVM codegen)
 - #66700 (Fix pointing at arg for fulfillment errors in function calls)
 - #66704 (Intra doc enum variant field)
 - #66718 (Refactor `parse_enum_item` to use `parse_delim_comma_seq`)
 - #66722 (Handle non_exhaustive in borrow checking)
 - #66744 (Fix shrink_to panic documentation)
 - #66761 (Use LLVMDisposePassManager instead of raw delete in rustllvm)
 - #66769 (Add core::{f32,f64}::consts::TAU.)
 - #66774 (Clean up error codes)
 - #66777 (Put back tidy check on error codes)
 - #66797 (Fixes small typo in array docs r? @steveklabnik)
 - #66798 (Fix spelling typos)
 - #66800 (Combine similar tests for const match)

Failed merges:

r? @ghost
2019-11-27 21:30:14 +00:00
Tyler Mandry
a40494bc50
Rollup merge of #66800 - jyn514:combine-const-match-tests, r=Dylan-DPC
Combine similar tests for const match

See https://github.com/rust-lang/rust/pull/66788#issuecomment-558799307 for context.
2019-11-27 15:28:54 -06:00
Tyler Mandry
999fd561ba
Rollup merge of #66798 - bwignall:typo, r=varkor
Fix spelling typos

Should be non-semantic.

Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos.
2019-11-27 15:28:53 -06:00
Tyler Mandry
d1cc4c3096
Rollup merge of #66797 - mlodato517:mlodato517-array-doc-typo, r=Dylan-DPC
Fixes small typo in array docs r? @steveklabnik

Fixes a small typo in the array documentation.

Also, wasn't sure which [message](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#pull-requests) to put this in, and will definitely update the commit message if it is supposed to be the PR description but for "safety" - r? @steveklabnik
2019-11-27 15:28:51 -06:00
Tyler Mandry
6a1fe67cac
Rollup merge of #66777 - GuillaumeGomez:tidy-err-codes, r=Mark-Simulacrum
Put back tidy check on error codes

I just realized that the tidy checks were not run anymore on the error code long explanations. This add it back.

cc @Dylan-DPC
r? @Mark-Simulacrum
2019-11-27 15:28:50 -06:00
Tyler Mandry
ae49770918
Rollup merge of #66774 - GuillaumeGomez:cleanup-err-codes-2, r=Dylan-DPC
Clean up error codes

r? @Dylan-DPC
2019-11-27 15:28:48 -06:00
Tyler Mandry
4c51d58de0
Rollup merge of #66769 - fusion-engineering-forks:tau-constant, r=dtolnay
Add core::{f32,f64}::consts::TAU.

### **`τ`**
2019-11-27 15:28:47 -06:00
Tyler Mandry
b05f14cc40
Rollup merge of #66761 - yuyoyuppe:rust_llvm_minor_fix, r=alexcrichton
Use LLVMDisposePassManager instead of raw delete in rustllvm

LLVM has a dedicated API call which wraps the destructor invocation for the PassManager.
Rust invokes it [otherwhere](d63b24ffcc/src/librustc_codegen_llvm/back/write.rs (L446-L447)), but not in the `LLVMRustWriteOutputFile`.

Since `LLVMDisposePassManager` might be extended to perform additional cleanup actions in the future, this change replaces raw destructor invocation with that API call.
2019-11-27 15:28:45 -06:00
Tyler Mandry
a3a8ee0636
Rollup merge of #66744 - chrisduerr:master, r=Dylan-DPC
Fix shrink_to panic documentation

While the potential for panicking is already documented for the
`Vec::shrink_to` method, it is not clearly labeled with the usual
`# Panics` heading.

r? @steveklabnik
2019-11-27 15:28:44 -06:00
Tyler Mandry
61b810511c
Rollup merge of #66722 - matthewjasper:non_exhaustive_borrowck, r=varkor
Handle non_exhaustive in borrow checking

Borrow check can tell whether a pattern is exhaustive or not, make sure that `non_exhaustive` prevents this.
2019-11-27 15:28:42 -06:00
Tyler Mandry
71f20b89ef
Rollup merge of #66718 - VirrageS:use_comma, r=Centril
Refactor `parse_enum_item` to use `parse_delim_comma_seq`

Followup after https://github.com/rust-lang/rust/pull/66641

Some errors got more verbose but I think they make sense with the help message.
2019-11-27 15:28:40 -06:00
Tyler Mandry
ddb616df90
Rollup merge of #66704 - GuillaumeGomez:intra-doc-enum-variant-field, r=kinnison
Intra doc enum variant field

Part of #43466.

Add intra-doc link support for this:

```rust
enum Foo {
    X {
        y: u8, // can be found with Foo::X::y
    }
}
```

r? @kinnison
2019-11-27 15:28:39 -06:00
Tyler Mandry
48b0fd2060
Rollup merge of #66700 - VirrageS:master, r=matthewjasper
Fix pointing at arg for fulfillment errors in function calls

Closes: https://github.com/rust-lang/rust/issues/66258
2019-11-27 15:28:37 -06:00
Tyler Mandry
8a7a9f2e80
Rollup merge of #66534 - immunant:multiple_global_decls, r=eddyb
Allow global references via ForeignItem and Item for the same symbol name during LLVM codegen

Combining CGUs can result in code that references a static variable through both
an Item and a ForeignItem with the same name. We don't care that the global was
already created by a ForeignItem reference when we see the Item reference, as
long as the LLVM types of the ForeignItem and Item match.

Fixes #66464
2019-11-27 15:28:36 -06:00
Tyler Mandry
5139b53836
Rollup merge of #66399 - eddyb:rmeta-table-cleanup, r=Mark-Simulacrum
rustc_metadata: simplify the interactions between Lazy and Table.

These are small post-#59953 cleanups (including undoing some contrivances from that PR).

r? @michaelwoerister
2019-11-27 15:28:34 -06:00