]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRollup merge of #46119 - ritiek:master, r=arielb1
kennytm [Mon, 20 Nov 2017 19:14:45 +0000 (03:14 +0800)]
Rollup merge of #46119 - ritiek:master, r=arielb1

Fix typo in MIR "cannot move out of borrowed content"

I believe this all we need to change (#46018). Anyway, do let me know if there is anything else that needs to changed as well!

6 years agoRollup merge of #46107 - nyanzebra:develop, r=kennytm
kennytm [Mon, 20 Nov 2017 19:14:44 +0000 (03:14 +0800)]
Rollup merge of #46107 - nyanzebra:develop, r=kennytm

Fixes spelling error in COMPILER_TESTS.md

Fixes a small spelling mistake :P

6 years agoRollup merge of #46092 - sfackler:ppid, r=alexcrichton
kennytm [Mon, 20 Nov 2017 19:14:43 +0000 (03:14 +0800)]
Rollup merge of #46092 - sfackler:ppid, r=alexcrichton

Add process::parent_id

I have this as a Unix-only API since it seems like Windows doesn't have
a similar API.

r? @alexcrichton

6 years agoRollup merge of #46088 - vitiral:read_doc, r=steveklabnik
kennytm [Mon, 20 Nov 2017 19:14:42 +0000 (03:14 +0800)]
Rollup merge of #46088 - vitiral:read_doc, r=steveklabnik

add doc for doing `Read` from `&str`

This information can be found on [stackoverflow](https://stackoverflow.com/questions/32674905/pass-string-to-function-taking-read-trait) but I think it would be beneficial if it was documented in the `Read` trait itself.

I had an *extremely* hard time finding this information, and "mocking" a reader with a string is an EXTREMELY common thing (I believe).

6 years agoRollup merge of #46082 - Enet4:mutex_from, r=sfackler
kennytm [Mon, 20 Nov 2017 19:14:41 +0000 (03:14 +0800)]
Rollup merge of #46082 - Enet4:mutex_from, r=sfackler

impl From for Mutex and RwLock

I felt that these implementations were missing, because doing `x.into()` works for other smart containers (such as `RefCell`), and in general I would say that the conversion makes sense.

6 years agoFix typo in MRI "cannot move out of borrowed content"
Ritiek Malhotra [Mon, 20 Nov 2017 15:56:21 +0000 (21:26 +0530)]
Fix typo in MRI "cannot move out of borrowed content"

6 years agoAuto merge of #45645 - fhartwig:39550, r=QuietMisdreavus
bors [Mon, 20 Nov 2017 14:47:40 +0000 (14:47 +0000)]
Auto merge of #45645 - fhartwig:39550, r=QuietMisdreavus

Make rustdoc not include self-by-value methods from Deref target

Fixes #39550

6 years agoAuto merge of #45998 - ollie27:doc_book_css, r=steveklabnik
bors [Mon, 20 Nov 2017 12:10:14 +0000 (12:10 +0000)]
Auto merge of #45998 - ollie27:doc_book_css, r=steveklabnik

Fix broken CSS for book redirect pages

rust.css has to be next to the font files so we shouldn't copy it for
only the book redirect pages, instead just use the version that is
already there.

This also removes the duplicate code creating version_info.html.

Fixes: #45974
6 years agoAuto merge of #45905 - alexcrichton:add-wasm-target, r=aturon
bors [Mon, 20 Nov 2017 08:29:46 +0000 (08:29 +0000)]
Auto merge of #45905 - alexcrichton:add-wasm-target, r=aturon

std: Add a new wasm32-unknown-unknown target

This commit adds a new target to the compiler: wasm32-unknown-unknown. This target is a reimagining of what it looks like to generate WebAssembly code from Rust. Instead of using Emscripten which can bring with it a weighty runtime this instead is a target which uses only the LLVM backend for WebAssembly and a "custom linker" for now which will hopefully one day be direct calls to lld.

Notable features of this target include:

* There is zero runtime footprint. The target assumes nothing exists other than the wasm32 instruction set.
* There is zero toolchain footprint beyond adding the target. No custom linker is needed, rustc contains everything.
* Very small wasm modules can be generated directly from Rust code using this target.
* Most of the standard library is stubbed out to return an error, but anything related to allocation works (aka `HashMap`, `Vec`, etc).
* Naturally, any `#[no_std]` crate should be 100% compatible with this new target.

This target is currently somewhat janky due to how linking works. The "linking" is currently unconditional whole program LTO (aka LLVM is being used as a linker). Naturally that means compiling programs is pretty slow! Eventually though this target should have a linker.

This target is also intended to be quite experimental. I'm hoping that this can act as a catalyst for further experimentation in Rust with WebAssembly. Breaking changes are very likely to land to this target, so it's not recommended to rely on it in any critical capacity yet. We'll let you know when it's "production ready".

### Building yourself

First you'll need to configure the build of LLVM and enable this target

```
$ ./configure --target=wasm32-unknown-unknown --set llvm.experimental-targets=WebAssembly
```

Next you'll want to remove any previously compiled LLVM as it needs to be rebuilt with WebAssembly support. You can do that with:

```
$ rm -rf build
```

And then you're good to go! A `./x.py build` should give you a rustc with the appropriate libstd target.

### Test support

Currently testing-wise this target is looking pretty good but isn't complete. I've got almost the entire `run-pass` test suite working with this target (lots of tests ignored, but many passing as well). The `core` test suite is [still getting LLVM bugs fixed](https://reviews.llvm.org/D39866) to get that working and will take some time. Relatively simple programs all seem to work though!

In general I've only tested this with a local fork that makes use of LLVM 5 rather than our current LLVM 4 on master. The LLVM 4 WebAssembly backend AFAIK isn't broken per se but is likely missing bug fixes available on LLVM 5. I'm hoping though that we can decouple the LLVM 5 upgrade and adding this wasm target!

### But the modules generated are huge!

It's worth nothing that you may not immediately see the "smallest possible wasm module" for the input you feed to rustc. For various reasons it's very difficult to get rid of the final "bloat" in vanilla rustc (again, a real linker should fix all this). For now what you'll have to do is:

    cargo install --git https://github.com/alexcrichton/wasm-gc
    wasm-gc foo.wasm bar.wasm

And then `bar.wasm` should be the smallest we can get it!

---

In any case for now I'd love feedback on this, particularly on the various integration points if you've got better ideas of how to approach them!

6 years agoAuto merge of #45819 - Havvy:cell, r=aturon
bors [Mon, 20 Nov 2017 05:58:23 +0000 (05:58 +0000)]
Auto merge of #45819 - Havvy:cell, r=aturon

Add RefCell<T>::replace_with

I also moved the `Panic` sections to before examples in the other two functions also under this feature gate, and changed the variable names in `replace` to be more readable.

r? @rust-libs

6 years agostd: Add a new wasm32-unknown-unknown target
Alex Crichton [Mon, 23 Oct 2017 03:01:00 +0000 (20:01 -0700)]
std: Add a new wasm32-unknown-unknown target

This commit adds a new target to the compiler: wasm32-unknown-unknown. This
target is a reimagining of what it looks like to generate WebAssembly code from
Rust. Instead of using Emscripten which can bring with it a weighty runtime this
instead is a target which uses only the LLVM backend for WebAssembly and a
"custom linker" for now which will hopefully one day be direct calls to lld.

Notable features of this target include:

* There is zero runtime footprint. The target assumes nothing exists other than
  the wasm32 instruction set.
* There is zero toolchain footprint beyond adding the target. No custom linker
  is needed, rustc contains everything.
* Very small wasm modules can be generated directly from Rust code using this
  target.
* Most of the standard library is stubbed out to return an error, but anything
  related to allocation works (aka `HashMap`, `Vec`, etc).
* Naturally, any `#[no_std]` crate should be 100% compatible with this new
  target.

This target is currently somewhat janky due to how linking works. The "linking"
is currently unconditional whole program LTO (aka LLVM is being used as a
linker). Naturally that means compiling programs is pretty slow! Eventually
though this target should have a linker.

This target is also intended to be quite experimental. I'm hoping that this can
act as a catalyst for further experimentation in Rust with WebAssembly. Breaking
changes are very likely to land to this target, so it's not recommended to rely
on it in any critical capacity yet. We'll let you know when it's "production
ready".

---

Currently testing-wise this target is looking pretty good but isn't complete.
I've got almost the entire `run-pass` test suite working with this target (lots
of tests ignored, but many passing as well). The `core` test suite is still
getting LLVM bugs fixed to get that working and will take some time. Relatively
simple programs all seem to work though!

---

It's worth nothing that you may not immediately see the "smallest possible wasm
module" for the input you feed to rustc. For various reasons it's very difficult
to get rid of the final "bloat" in vanilla rustc (again, a real linker should
fix all this). For now what you'll have to do is:

    cargo install --git https://github.com/alexcrichton/wasm-gc
    wasm-gc foo.wasm bar.wasm

And then `bar.wasm` should be the smallest we can get it!

---

In any case for now I'd love feedback on this, particularly on the various
integration points if you've got better ideas of how to approach them!

6 years agoAuto merge of #46068 - wesleywiser:incr_duplicate_read_stats, r=michaelwoerister
bors [Mon, 20 Nov 2017 03:34:13 +0000 (03:34 +0000)]
Auto merge of #46068 - wesleywiser:incr_duplicate_read_stats, r=michaelwoerister

[incremental] Collect stats about duplicated edge reads from queries

Part of #45873

6 years agoFixes spelling error in COMPILER_TESTS.md
Robert T Baldwin [Mon, 20 Nov 2017 02:59:00 +0000 (18:59 -0800)]
Fixes spelling error in COMPILER_TESTS.md

6 years agoMake rustdoc not include self-by-value methods from Deref target
Florian Hartwig [Tue, 31 Oct 2017 01:01:23 +0000 (02:01 +0100)]
Make rustdoc not include self-by-value methods from Deref target

6 years agoAuto merge of #45225 - eddyb:trans-abi, r=arielb1
bors [Sun, 19 Nov 2017 22:12:22 +0000 (22:12 +0000)]
Auto merge of #45225 - eddyb:trans-abi, r=arielb1

Refactor type memory layouts and ABIs, to be more general and easier to optimize.

To combat combinatorial explosion, type layouts are now described through 3 orthogonal properties:
* `Variants` describes the plurality of sum types (where applicable)
  * `Single` is for one inhabited/active variant, including all C `struct`s and `union`s
  * `Tagged` has its variants discriminated by an integer tag, including C `enum`s
  * `NicheFilling` uses otherwise-invalid values ("niches") for all but one of its inhabited variants
* `FieldPlacement` describes the number and memory offsets of fields (if any)
  * `Union` has all its fields at offset `0`
  * `Array` has offsets that are a multiple of its `stride`; guarantees all fields have one type
  * `Arbitrary` records all the field offsets, which can be out-of-order
* `Abi` describes how values of the type should be passed around, including for FFI
  * `Uninhabited` corresponds to no values, associated with unreachable control-flow
  * `Scalar` is ABI-identical to its only integer/floating-point/pointer "scalar component"
  * `ScalarPair` has two "scalar components", but only applies to the Rust ABI
  * `Vector` is for SIMD vectors, typically `#[repr(simd)]` `struct`s in Rust
  * `Aggregate` has arbitrary contents, including all non-transparent C `struct`s and `union`s

Size optimizations implemented so far:
* ignoring uninhabited variants (i.e. containing uninhabited fields), e.g.:
  * `Option<!>` is 0 bytes
  * `Result<T, !>` has the same size as `T`
* using arbitrary niches, not just `0`, to represent a data-less variant, e.g.:
  * `Option<bool>`, `Option<Option<bool>>`, `Option<Ordering>` are all 1 byte
  * `Option<char>` is 4 bytes
* using a range of niches to represent *multiple* data-less variants, e.g.:
  * `enum E { A(bool), B, C, D }` is 1 byte

Code generation now takes advantage of `Scalar` and `ScalarPair` to, in more cases, pass around scalar components as immediates instead of indirectly, through pointers into temporary memory, while avoiding LLVM's "first-class aggregates", and there's more untapped potential here.

Closes #44426, fixes #5977, fixes #14540, fixes #43278.

6 years agoRevert "tests: Update run-make/issue-25581 to reflect how fat pointers are passed."
Eduard-Mihai Burtescu [Sun, 19 Nov 2017 21:38:48 +0000 (23:38 +0200)]
Revert "tests: Update run-make/issue-25581 to reflect how fat pointers are passed."

This reverts commit b12dcdef4fae5e3856e6911fd6cfbeedadcf3821.

6 years agoAdd process::parent_id
Steven Fackler [Sun, 19 Nov 2017 05:09:18 +0000 (21:09 -0800)]
Add process::parent_id

I have this as a Unix-only API since it seems like Windows doesn't have
a similar API.

6 years agorustc_trans: remove primitive_align optimization.
Eduard-Mihai Burtescu [Sun, 19 Nov 2017 18:28:52 +0000 (20:28 +0200)]
rustc_trans: remove primitive_align optimization.

6 years agoAuto merge of #45454 - Aaronepower:master, r=alexcrichton
bors [Sun, 19 Nov 2017 17:23:01 +0000 (17:23 +0000)]
Auto merge of #45454 - Aaronepower:master, r=alexcrichton

Updated Release notes for 1.22.0

[rendered](https://github.com/Aaronepower/rust/blob/master/RELEASES.md)

6 years agoRemove some trailing whitespace.
Michael Woerister [Sun, 19 Nov 2017 16:26:19 +0000 (17:26 +0100)]
Remove some trailing whitespace.

6 years agoFix tidy line-length issue.
Michael Woerister [Sun, 19 Nov 2017 16:12:04 +0000 (17:12 +0100)]
Fix tidy line-length issue.

6 years agorustc_trans: work around i686-pc-windows-msvc byval align LLVM bug.
Eduard-Mihai Burtescu [Sun, 19 Nov 2017 10:13:24 +0000 (12:13 +0200)]
rustc_trans: work around i686-pc-windows-msvc byval align LLVM bug.

6 years agoAuto merge of #46074 - scottmcm:unspecialize-nth, r=bluss
bors [Sun, 19 Nov 2017 12:20:14 +0000 (12:20 +0000)]
Auto merge of #46074 - scottmcm:unspecialize-nth, r=bluss

Undo the Sized specialization from Iterator::nth

I just added this as part of https://github.com/rust-lang/rust/pull/45595, but I'm now afraid there's a specialization issue with it, since I tried to add [another similar specialization](https://github.com/rust-lang/rust/compare/master...scottmcm:faster-iter-by-ref?expand=1#diff-1398f322bc563592215b583e9b0ba936R2390), and ended up getting really disturbing test failures like
```
thread 'iter::test_by_ref_folds' panicked at 'assertion failed: `(left == right)`
  left: `15`,
 right: `15`', src\libcore\../libcore/tests\iter.rs:1720:4
```

So since this wasn't the most critical part of the change and a new beta is branching within a week, I think putting this part back to what it was before is the best option.

6 years agocargotest: temporarily use eddyb/servo to include servo/servo#19285.
Eduard-Mihai Burtescu [Sun, 19 Nov 2017 09:48:12 +0000 (11:48 +0200)]
cargotest: temporarily use eddyb/servo to include servo/servo#19285.

6 years agoDon't glob-import overlapping variant names in test/codegen/match-optimizes-away.rs.
Eduard-Mihai Burtescu [Sat, 18 Nov 2017 13:41:07 +0000 (15:41 +0200)]
Don't glob-import overlapping variant names in test/codegen/match-optimizes-away.rs.

6 years agoAuto merge of #46064 - Keruspe:master, r=sfackler
bors [Sun, 19 Nov 2017 05:19:10 +0000 (05:19 +0000)]
Auto merge of #46064 - Keruspe:master, r=sfackler

update openssl{,-sys} to fix build with libressl 2.6.x

6 years agoAuto merge of #46048 - cramertj:update-libc-2, r=alexcrichton
bors [Sun, 19 Nov 2017 03:02:15 +0000 (03:02 +0000)]
Auto merge of #46048 - cramertj:update-libc-2, r=alexcrichton

Update libc to include Fuchsia changes

This is an update of libc to include the updated Fuchsia "open" flags added in https://github.com/rust-lang/libc/pull/849.

cc @smklein
r? @alexcrichton

6 years agorustc_trans: (hack) use preferred alignment for atomic loads/stores.
Eduard-Mihai Burtescu [Sun, 19 Nov 2017 01:56:37 +0000 (03:56 +0200)]
rustc_trans: (hack) use preferred alignment for atomic loads/stores.

6 years agorustc: rename CachedLayout to LayoutDetails.
Eduard-Mihai Burtescu [Sat, 28 Oct 2017 13:52:41 +0000 (16:52 +0300)]
rustc: rename CachedLayout to LayoutDetails.

6 years agorustc: extend the niche-filling enum optimization past 2 variants.
Eduard-Mihai Burtescu [Thu, 12 Oct 2017 00:55:49 +0000 (03:55 +0300)]
rustc: extend the niche-filling enum optimization past 2 variants.

6 years agorustc: use layout::Abi::ScalarPair for structs in more cases.
Eduard-Mihai Burtescu [Tue, 10 Oct 2017 20:38:07 +0000 (23:38 +0300)]
rustc: use layout::Abi::ScalarPair for structs in more cases.

6 years agorustc_trans: remove type_is_fat_ptr and its uses.
Eduard-Mihai Burtescu [Tue, 10 Oct 2017 19:04:13 +0000 (22:04 +0300)]
rustc_trans: remove type_is_fat_ptr and its uses.

6 years agorustc: don't special-case Box<T> as having a pointer layout.
Eduard-Mihai Burtescu [Tue, 10 Oct 2017 17:55:21 +0000 (20:55 +0300)]
rustc: don't special-case Box<T> as having a pointer layout.

6 years agorustc_trans: support scalar pairs directly in the Rust ABI.
Eduard-Mihai Burtescu [Tue, 10 Oct 2017 17:54:50 +0000 (20:54 +0300)]
rustc_trans: support scalar pairs directly in the Rust ABI.

6 years agorustc: unpack scalar pair newtype layout ABIs.
Eduard-Mihai Burtescu [Mon, 9 Oct 2017 16:56:41 +0000 (19:56 +0300)]
rustc: unpack scalar pair newtype layout ABIs.

6 years agorustc: unpack scalar newtype layout ABIs.
Eduard-Mihai Burtescu [Sun, 8 Oct 2017 23:31:06 +0000 (02:31 +0300)]
rustc: unpack scalar newtype layout ABIs.

6 years agorustc_trans: be more relaxed with non-lvalue consumes, especially ZSTs.
Eduard-Mihai Burtescu [Sun, 8 Oct 2017 21:38:10 +0000 (00:38 +0300)]
rustc_trans: be more relaxed with non-lvalue consumes, especially ZSTs.

6 years agorustc: place ZSTs first during struct field reordering.
Eduard-Mihai Burtescu [Sun, 8 Oct 2017 20:08:47 +0000 (23:08 +0300)]
rustc: place ZSTs first during struct field reordering.

6 years agorustc: encode scalar pairs in layout ABI.
Eduard-Mihai Burtescu [Fri, 6 Oct 2017 07:25:35 +0000 (10:25 +0300)]
rustc: encode scalar pairs in layout ABI.

6 years agorustc_trans: restrict "immediate pairs" to pairs of scalars.
Eduard-Mihai Burtescu [Thu, 5 Oct 2017 01:22:23 +0000 (04:22 +0300)]
rustc_trans: restrict "immediate pairs" to pairs of scalars.

6 years agorustc_trans: generate LLVM pointee types based on alignment.
Eduard-Mihai Burtescu [Wed, 4 Oct 2017 23:21:10 +0000 (02:21 +0300)]
rustc_trans: generate LLVM pointee types based on alignment.

6 years agorustc_trans: compute better align/dereferenceable attributes from pointees.
Eduard-Mihai Burtescu [Tue, 3 Oct 2017 07:45:07 +0000 (10:45 +0300)]
rustc_trans: compute better align/dereferenceable attributes from pointees.

6 years agorustc: optimize out uninhabited types and variants.
Eduard-Mihai Burtescu [Tue, 26 Sep 2017 18:34:10 +0000 (21:34 +0300)]
rustc: optimize out uninhabited types and variants.

6 years agorustc: track validity ranges for layout::Abi::Scalar values.
Eduard-Mihai Burtescu [Tue, 26 Sep 2017 11:41:06 +0000 (14:41 +0300)]
rustc: track validity ranges for layout::Abi::Scalar values.

6 years agorustc: remove redundant/unused fields from layout::Abi::Vector.
Eduard-Mihai Burtescu [Tue, 26 Sep 2017 04:27:48 +0000 (07:27 +0300)]
rustc: remove redundant/unused fields from layout::Abi::Vector.

6 years agorustc: generalize layout::Variants::NicheFilling to niches other than 0.
Eduard-Mihai Burtescu [Sun, 24 Sep 2017 09:12:26 +0000 (12:12 +0300)]
rustc: generalize layout::Variants::NicheFilling to niches other than 0.

6 years agorustc_trans: check for layout::I1 instead of TyBool.
Eduard-Mihai Burtescu [Sun, 24 Sep 2017 09:01:09 +0000 (12:01 +0300)]
rustc_trans: check for layout::I1 instead of TyBool.

6 years agorustc: make TyLayout::field(NonZero<*T>, 0) return &T.
Eduard-Mihai Burtescu [Sun, 24 Sep 2017 08:56:23 +0000 (11:56 +0300)]
rustc: make TyLayout::field(NonZero<*T>, 0) return &T.

6 years agorustc: support u128 discriminant ranges.
Eduard-Mihai Burtescu [Sat, 23 Sep 2017 12:04:37 +0000 (15:04 +0300)]
rustc: support u128 discriminant ranges.

6 years agorustc: collapse the remains of Layout into Variants (enums vs everything else).
Eduard-Mihai Burtescu [Fri, 22 Sep 2017 22:54:45 +0000 (01:54 +0300)]
rustc: collapse the remains of Layout into Variants (enums vs everything else).

6 years agorustc: move size, align & primitive_align from Abi::Aggregate to layout.
Eduard-Mihai Burtescu [Fri, 22 Sep 2017 19:44:40 +0000 (22:44 +0300)]
rustc: move size, align & primitive_align from Abi::Aggregate to layout.

6 years agorustc_trans: go through layouts uniformly for fat pointers and variants.
Eduard-Mihai Burtescu [Thu, 21 Sep 2017 17:40:50 +0000 (20:40 +0300)]
rustc_trans: go through layouts uniformly for fat pointers and variants.

6 years agorustc: collapse Layout::FatPointer into Layout::Univariant.
Eduard-Mihai Burtescu [Wed, 20 Sep 2017 22:56:20 +0000 (01:56 +0300)]
rustc: collapse Layout::FatPointer into Layout::Univariant.

6 years agorustc_trans: query LLVM types from a layout instead of a Ty.
Eduard-Mihai Burtescu [Wed, 20 Sep 2017 20:07:47 +0000 (23:07 +0300)]
rustc_trans: query LLVM types from a layout instead of a Ty.

6 years agorustc_trans: keep a layout instead of a type in {Lvalue,Operand}Ref.
Eduard-Mihai Burtescu [Wed, 20 Sep 2017 15:17:23 +0000 (18:17 +0300)]
rustc_trans: keep a layout instead of a type in {Lvalue,Operand}Ref.

6 years agorustc_trans: nest abi::ArgType's for fat pointers instead of eagerly flattening.
Eduard-Mihai Burtescu [Wed, 20 Sep 2017 02:16:06 +0000 (05:16 +0300)]
rustc_trans: nest abi::ArgType's for fat pointers instead of eagerly flattening.

6 years agorustc_trans: pass OperandRef arguments to trans_intrinsic_call.
Eduard-Mihai Burtescu [Tue, 19 Sep 2017 23:32:22 +0000 (02:32 +0300)]
rustc_trans: pass OperandRef arguments to trans_intrinsic_call.

6 years agorustc: do not pub use Layout::* in layout.
Eduard-Mihai Burtescu [Tue, 19 Sep 2017 21:29:34 +0000 (00:29 +0300)]
rustc: do not pub use Layout::* in layout.

6 years agorustc_trans: compute LLVM types from type layouts, not Rust types.
Eduard-Mihai Burtescu [Tue, 19 Sep 2017 20:43:55 +0000 (23:43 +0300)]
rustc_trans: compute LLVM types from type layouts, not Rust types.

6 years agorustc: split layout::FieldPlacement::Linear back into Union and Array.
Eduard-Mihai Burtescu [Tue, 19 Sep 2017 09:52:30 +0000 (12:52 +0300)]
rustc: split layout::FieldPlacement::Linear back into Union and Array.

6 years agorustc: move layout::Struct into FieldPlacement/Abi.
Eduard-Mihai Burtescu [Tue, 19 Sep 2017 09:38:20 +0000 (12:38 +0300)]
rustc: move layout::Struct into FieldPlacement/Abi.

6 years agorustc: hide details in Layout in favor of Abi or FieldPlacement.
Eduard-Mihai Burtescu [Sun, 17 Sep 2017 20:37:18 +0000 (23:37 +0300)]
rustc: hide details in Layout in favor of Abi or FieldPlacement.

6 years agorustc: store CachedLayout for each variant of enum Layout's instead of Struct.
Eduard-Mihai Burtescu [Sun, 17 Sep 2017 16:34:28 +0000 (19:34 +0300)]
rustc: store CachedLayout for each variant of enum Layout's instead of Struct.

6 years agorustc: move size/alignment from Layout into layout::Abi.
Eduard-Mihai Burtescu [Sun, 17 Sep 2017 01:42:22 +0000 (04:42 +0300)]
rustc: move size/alignment from Layout into layout::Abi.

6 years agorustc: make Layout::NullablePointer a lot more like Layout::General.
Eduard-Mihai Burtescu [Sat, 16 Sep 2017 23:25:20 +0000 (02:25 +0300)]
rustc: make Layout::NullablePointer a lot more like Layout::General.

6 years agorustc: collapse Layout::CEnum into Layout::General.
Eduard-Mihai Burtescu [Sat, 16 Sep 2017 20:12:39 +0000 (23:12 +0300)]
rustc: collapse Layout::CEnum into Layout::General.

6 years agorustc: give Layout::CEnum a discriminant field like Layout::General.
Eduard-Mihai Burtescu [Sat, 16 Sep 2017 13:40:29 +0000 (16:40 +0300)]
rustc: give Layout::CEnum a discriminant field like Layout::General.

6 years agorustc: move CEnum's signedness into Primitive::Int.
Eduard-Mihai Burtescu [Sat, 16 Sep 2017 13:39:53 +0000 (16:39 +0300)]
rustc: move CEnum's signedness into Primitive::Int.

6 years agorustc: use Primitive instead of Integer for CEnum and General discriminants.
Eduard-Mihai Burtescu [Sat, 16 Sep 2017 09:23:22 +0000 (12:23 +0300)]
rustc: use Primitive instead of Integer for CEnum and General discriminants.

6 years agorustc: do not track `non_zero` in Layout.
Eduard-Mihai Burtescu [Sat, 16 Sep 2017 07:44:27 +0000 (10:44 +0300)]
rustc: do not track `non_zero` in Layout.

6 years agorustc: collapse Layout::{Raw,StructWrapped}NullablePointer into one variant.
Eduard-Mihai Burtescu [Fri, 15 Sep 2017 19:42:23 +0000 (22:42 +0300)]
rustc: collapse Layout::{Raw,StructWrapped}NullablePointer into one variant.

6 years agorustc: introduce layout::Abi for reduced general ABI "passing style".
Eduard-Mihai Burtescu [Thu, 14 Sep 2017 19:50:18 +0000 (22:50 +0300)]
rustc: introduce layout::Abi for reduced general ABI "passing style".

6 years agorustc: represent the discriminant as a field for Layout::{Raw,StructWrapped}NullableP...
Eduard-Mihai Burtescu [Wed, 13 Sep 2017 21:02:53 +0000 (00:02 +0300)]
rustc: represent the discriminant as a field for Layout::{Raw,StructWrapped}NullablePointer.

6 years agorustc_trans: treat General enums like unions.
Eduard-Mihai Burtescu [Wed, 13 Sep 2017 20:18:40 +0000 (23:18 +0300)]
rustc_trans: treat General enums like unions.

6 years agorustc: pre-compute field placements out of Layout.
Eduard-Mihai Burtescu [Wed, 13 Sep 2017 11:35:04 +0000 (14:35 +0300)]
rustc: pre-compute field placements out of Layout.

6 years agorustc: remove Ty::layout and move everything to layout_of.
Eduard-Mihai Burtescu [Tue, 12 Sep 2017 23:19:11 +0000 (02:19 +0300)]
rustc: remove Ty::layout and move everything to layout_of.

6 years agorustc: re-complicate the TyLayout API and use better names.
Eduard-Mihai Burtescu [Tue, 12 Sep 2017 21:33:56 +0000 (00:33 +0300)]
rustc: re-complicate the TyLayout API and use better names.

6 years agorustc: remove source field path from Layout::StructWrappedNullablePointer.
Eduard-Mihai Burtescu [Mon, 11 Sep 2017 19:31:16 +0000 (22:31 +0300)]
rustc: remove source field path from Layout::StructWrappedNullablePointer.

6 years agorustc: use an offset instead of a field path in Layout::StructWrappedNullablePointer.
Eduard-Mihai Burtescu [Sun, 10 Sep 2017 20:53:57 +0000 (23:53 +0300)]
rustc: use an offset instead of a field path in Layout::StructWrappedNullablePointer.

6 years agorustc: remove useless 0 prefix from Layout::StructWrappedNullablePointer's discrfield.
Eduard-Mihai Burtescu [Sun, 10 Sep 2017 16:34:11 +0000 (19:34 +0300)]
rustc: remove useless 0 prefix from Layout::StructWrappedNullablePointer's discrfield.

6 years agorustc: do not inject discriminant fields into Layout::General's variants.
Eduard-Mihai Burtescu [Sun, 10 Sep 2017 14:15:29 +0000 (17:15 +0300)]
rustc: do not inject discriminant fields into Layout::General's variants.

6 years agorustc_trans: always insert alignment padding, even before the first field.
Eduard-Mihai Burtescu [Sun, 25 Jun 2017 09:42:55 +0000 (12:42 +0300)]
rustc_trans: always insert alignment padding, even before the first field.

6 years agorustc_trans: use *[T; 0] for slice data pointers instead of *T.
Eduard-Mihai Burtescu [Mon, 26 Jun 2017 15:33:50 +0000 (18:33 +0300)]
rustc_trans: use *[T; 0] for slice data pointers instead of *T.

6 years agorustc_trans: remove the in_memory_type_of distinction.
Eduard-Mihai Burtescu [Mon, 26 Jun 2017 11:57:50 +0000 (14:57 +0300)]
rustc_trans: remove the in_memory_type_of distinction.

6 years agorustc_trans: use more of the trans::mir and ty::layout APIs throughout.
Eduard-Mihai Burtescu [Sun, 25 Jun 2017 09:41:24 +0000 (12:41 +0300)]
rustc_trans: use more of the trans::mir and ty::layout APIs throughout.

6 years agorustc_trans: do not introspect LLVM aggregate field types.
Eduard-Mihai Burtescu [Sun, 18 Jun 2017 14:42:03 +0000 (17:42 +0300)]
rustc_trans: do not introspect LLVM aggregate field types.

6 years agorustc_trans: remove obsolete Type methods.
Eduard-Mihai Burtescu [Wed, 14 Jun 2017 09:27:43 +0000 (12:27 +0300)]
rustc_trans: remove obsolete Type methods.

6 years agorustc_trans: use a predictable layout for constant ADTs.
Eduard-Mihai Burtescu [Sun, 18 Jun 2017 13:59:51 +0000 (16:59 +0300)]
rustc_trans: use a predictable layout for constant ADTs.

6 years agorustc_trans: avoid working with sizes/offsets and alignments as integers.
Eduard-Mihai Burtescu [Thu, 1 Jun 2017 18:50:53 +0000 (21:50 +0300)]
rustc_trans: avoid working with sizes/offsets and alignments as integers.

6 years agoAdd doc for `Read`ing from `&str` and some related cleanup
Garrett Berg [Sat, 18 Nov 2017 23:10:14 +0000 (16:10 -0700)]
Add doc for `Read`ing from `&str` and some related cleanup

6 years agoimpl From<T> for RwLock<T>
Eduardo Pinho [Sat, 18 Nov 2017 21:05:06 +0000 (21:05 +0000)]
impl From<T> for RwLock<T>

6 years agoAuto merge of #46039 - oli-obk:test_suggestions, r=petrochenkov
bors [Sat, 18 Nov 2017 20:52:19 +0000 (20:52 +0000)]
Auto merge of #46039 - oli-obk:test_suggestions, r=petrochenkov

Remove left over dead code from suggestion diagnostic refactoring

More cleanups after #41876 and #45741

6 years agorustc_mir: always downcast enums, even if univariant.
Eduard-Mihai Burtescu [Sat, 18 Nov 2017 18:24:54 +0000 (20:24 +0200)]
rustc_mir: always downcast enums, even if univariant.

6 years agoAuto merge of #46032 - KiChjang:ignore-borrowck-statics, r=nikomatsakis
bors [Sat, 18 Nov 2017 17:30:26 +0000 (17:30 +0000)]
Auto merge of #46032 - KiChjang:ignore-borrowck-statics, r=nikomatsakis

Ignore borrowck for static lvalues and allow assignment to static muts

Fixes #45129.
Fixes #45641.

6 years agoimpl From<T> for Mutex<T>
Eduardo Pinho [Sat, 18 Nov 2017 16:49:04 +0000 (16:49 +0000)]
impl From<T> for Mutex<T>

6 years agoAuto merge of #46009 - kennytm:fix-38878-again, r=alexcrichton
bors [Sat, 18 Nov 2017 15:00:13 +0000 (15:00 +0000)]
Auto merge of #46009 - kennytm:fix-38878-again, r=alexcrichton

Fix #38878 again — restart linker when seeing SIGBUS in additional to SIGSEGV.

In https://github.com/rust-lang/rust/pull/45985#issuecomment-344586645 we see a linker crashed due to Bus Error (signal 10) on macOS. The error was not caught by #40422 since the PR only handles Segmentation Fault (signal 11). The crash log indicates the problem is the same as #38878, so we just amend #40422 to include SIGBUS as well.

(Additionally, modified how the crash logs are printed so that irrelevant logs are truly filtered out.)

6 years agoUndo the Sized specialization from Iterator::nth
Scott McMurray [Sat, 18 Nov 2017 11:45:51 +0000 (03:45 -0800)]
Undo the Sized specialization from Iterator::nth

6 years agoAuto merge of #46073 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sat, 18 Nov 2017 11:38:06 +0000 (11:38 +0000)]
Auto merge of #46073 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 4 pull requests

- Successful merges: #45767, #46044, #46066, #46071
- Failed merges:

6 years agoRollup merge of #46071 - LooMaclin:fix-46001, r=estebank
Guillaume Gomez [Sat, 18 Nov 2017 11:15:24 +0000 (12:15 +0100)]
Rollup merge of #46071 - LooMaclin:fix-46001, r=estebank

Remove return_ty from Mir

https://github.com/rust-lang/rust/issues/46001

6 years agoRollup merge of #46066 - GuillaumeGomez:primitive-search, r=QuietMisdreavus
Guillaume Gomez [Sat, 18 Nov 2017 11:15:23 +0000 (12:15 +0100)]
Rollup merge of #46066 - GuillaumeGomez:primitive-search, r=QuietMisdreavus

Fix primitive types not showing up

Fixes #46017.

r? @QuietMisdreavus