Commit graph

74219 commits

Author SHA1 Message Date
Manish Goregaokar
6908fb762d
Rollup merge of #48014 - Manishearth:stealing-chickens-on-the-internet, r=nikomatsakis
Implement RFC 2052 (Epochs)

This adds -Zepochs and uses it for tyvar_behind_raw_pointer (#46906)

When we move this to --epoch=XXX, we'll need to gate the 2018 epoch on nightly, but not the 2015 one. I can make these changes here itself though it's kinda pointless given that the entire flag is nightly-only.

r? @nikomatsakis @aturon

cc #44581 (epoch tracking)
cc #46906 (tyvar_behind_raw_pointer)
2018-02-07 08:30:54 -08:00
Manish Goregaokar
da6dcbc21e
Rollup merge of #47944 - oberien:unboundediterator-trustedlen, r=bluss
Implement TrustedLen for Take<Repeat> and Take<RangeFrom>

This will allow optimization of simple `repeat(x).take(n).collect()` iterators, which are currently not vectorized and have capacity checks.

This will only support a few aggregates on `Repeat` and `RangeFrom`, which might be enough for simple cases, but doesn't optimize more complex ones. Namely, Cycle, StepBy, Filter, FilterMap, Peekable, SkipWhile, Skip, FlatMap, Fuse and Inspect are not marked `TrustedLen` when the inner iterator is infinite.

Previous discussion can be found in #47082

r? @alexcrichton
2018-02-07 08:30:53 -08:00
Manish Goregaokar
0ba871254e
Rollup merge of #47922 - zackmdavis:and_the_case_of_the_unused_field_pattern, r=estebank
correct unused field pattern suggestions

![unused_field_pattern_local](https://user-images.githubusercontent.com/1076988/35662336-7a69488a-06cc-11e8-9901-8d22b5cf924f.png)

r? @estebank
2018-02-07 08:30:52 -08:00
Manish Goregaokar
d2f7febe93
Rollup merge of #47883 - yurydelendik:wasm-map, r=alexcrichton
Export wasm source map when debug information is enabled

We use binaryen's linker to produce a wasm file (via s2wasm). The wasm writer has capabilities to export source maps. The pilot support for source maps is added to Firefox.

The produced source map contains references to the original file, that might require additional source map file processing to include / package original files with it.

/cc @alexcrichton
2018-02-07 08:30:51 -08:00
Manish Goregaokar
185f258801
Rollup merge of #47810 - GuillaumeGomez:fix-theme-but-position, r=QuietMisdreavus
Fix rendering issues on mobile

Fixes #47723

r? @QuietMisdreavus
2018-02-07 08:30:49 -08:00
Manish Goregaokar
d920f1fc3f
Rollup merge of #47631 - SimonSapin:nonnull, r=alexcrichton
Add some APIs to ptr::NonNull and fix `since` attributes

This is a follow-up to its stabilization in https://github.com/rust-lang/rust/pull/46952. Tracking issue: https://github.com/rust-lang/rust/issues/27730.

* These trait impls are insta-stable: `Hash`, `PartialEq`, `Eq`, `PartialOrd` and `Ord`.
* The new `cast<U>() -> NonNull<U>`  method is `#[unstable]`. It was proposed in https://github.com/rust-lang/rust/pull/46952#issuecomment-359220010.
2018-02-07 08:30:48 -08:00
Manish Goregaokar
aee22556a9
Rollup merge of #47613 - estebank:rustc_on_unimplemented, r=nikomatsakis
Add filtering options to `rustc_on_unimplemented`

- Add filtering options to `rustc_on_unimplemented` for local traits, filtering on `Self` and type arguments.
- Add a way to provide custom notes.
- Tweak binops text.
- Add filter to detect wether `Self` is local or belongs to another crate.
- Add filter to `Iterator` diagnostic for `&str`.

Partly addresses #44755 with a different syntax, as a first approach. Fixes #46216, fixes #37522, CC #34297, #46806.
2018-02-07 08:30:47 -08:00
bors
4f93357d3b Auto merge of #47607 - davidtwco:issue-45697, r=nikomatsakis
MIR-borrowck: augmented assignment causes duplicate errors

Fixes #45697. This PR resolves the error duplication. I attempted to replace the existing sets since there were quite a few but only managed to replace two of them.

r? @nikomatsakis
2018-02-07 02:20:23 +00:00
Manish Goregaokar
b8aa8cadd6 Add tests for -Zepoch using tyvar_raw_pointer 2018-02-06 11:46:42 -08:00
Manish Goregaokar
83a9f4980e Fill in long diagnostic 2018-02-06 11:46:42 -08:00
bors
bd98fe0c05 Auto merge of #48040 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

- Successful merges: #46962, #47986, #48012, #48013, #48026, #48031, #48036
- Failed merges:
2018-02-06 19:28:54 +00:00
kennytm
7f0e87a781
Rollup merge of #48036 - durka:proc-macro-doteq, r=alexcrichton
proc_macro: don't panic parsing ..= (fix #47950)
2018-02-07 03:23:30 +08:00
kennytm
d0e7da48fa
Rollup merge of #48031 - matthiaskrgr:exampleconfigtoml_typos, r=kennytm
config.toml.example: fix typos.

Most of them were found by codespell: https://github.com/lucasdemarchi/codespell
2018-02-07 03:23:29 +08:00
kennytm
ccdb320c68
Rollup merge of #48026 - Badel2:doc-assoc-const-object-safe, r=nikomatsakis
Document that associated constants prevent a trait from being made into an object

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

Add a short mention of associated constants to E0038
2018-02-07 03:23:28 +08:00
kennytm
3373f65682
Rollup merge of #48013 - onur:use-time-in-bootstrap-dist, r=alexcrichton
Use time crate in bootstrap dist instead of date

`bootstrap dist` command is trying to run *NIX specific `date` command to get current month and year. This command keep failing when it's called on a Windows command prompt. This patch is making it use time crate.

Closes: #47908
2018-02-07 03:23:26 +08:00
kennytm
4f184eb6a3
Rollup merge of #48012 - scottmcm:faster-rangeinclusive-fold, r=alexcrichton
Override try_[r]fold for RangeInclusive

Because the last item needs special handling, it seems that LLVM has trouble canonicalizing the loops in external iteration.  With the override, it becomes obvious that the start==end case exits the loop (as opposed to the one *after* that exiting the loop in external iteration).

Demo adapted from https://github.com/rust-lang/rust/issues/45222
```rust
#[no_mangle]
pub fn foo3r(n: u64) -> u64 {
    let mut count = 0;
    (0..n).for_each(|_| {
        (0 ..= n).rev().for_each(|j| {
            count += j;
        })
    });
    count
}
```

<details>
 <summary>Current nightly ASM, 100 lines (https://play.rust-lang.org/?gist=f5674c702c6e2045c3aab5d03763e5f6&version=nightly&mode=release)</summary>

```asm
foo3r:
	pushq	%rbx
.Lcfi0:
.Lcfi1:
	testq	%rdi, %rdi
	je	.LBB0_1
	testb	$1, %dil
	jne	.LBB0_4
	xorl	%eax, %eax
	xorl	%r8d, %r8d
	cmpq	$1, %rdi
	jne	.LBB0_11
	jmp	.LBB0_23
.LBB0_1:
	xorl	%eax, %eax
	popq	%rbx
	retq
.LBB0_4:
	xorl	%r8d, %r8d
	movq	$-1, %r9
	xorl	%eax, %eax
	movq	%rdi, %r11
	xorl	%r10d, %r10d
	jmp	.LBB0_5
.LBB0_8:
	addq	%r11, %rax
	movq	%rsi, %r11
	movq	%rdx, %r10
.LBB0_5:
	cmpq	%r11, %r10
	movl	$1, %ecx
	cmovbq	%r9, %rcx
	cmoveq	%r8, %rcx
	testq	%rcx, %rcx
	movl	$0, %esi
	movl	$1, %edx
	je	.LBB0_8
	cmpq	$-1, %rcx
	jne	.LBB0_9
	leaq	-1(%r11), %rsi
	movq	%r10, %rdx
	jmp	.LBB0_8
.LBB0_9:
	movl	$1, %r8d
	cmpq	$1, %rdi
	je	.LBB0_23
.LBB0_11:
	xorl	%r9d, %r9d
	movq	$-1, %r10
.LBB0_12:
	movq	%rdi, %rsi
	xorl	%r11d, %r11d
	jmp	.LBB0_13
.LBB0_16:
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rbx, %r11
.LBB0_13:
	cmpq	%rsi, %r11
	movl	$1, %edx
	cmovbq	%r10, %rdx
	cmoveq	%r9, %rdx
	testq	%rdx, %rdx
	movl	$0, %ecx
	movl	$1, %ebx
	je	.LBB0_16
	cmpq	$-1, %rdx
	jne	.LBB0_17
	leaq	-1(%rsi), %rcx
	movq	%r11, %rbx
	jmp	.LBB0_16
.LBB0_17:
	movq	%rdi, %rcx
	xorl	%r11d, %r11d
	jmp	.LBB0_18
.LBB0_21:
	addq	%rcx, %rax
	movq	%rsi, %rcx
	movq	%rbx, %r11
.LBB0_18:
	cmpq	%rcx, %r11
	movl	$1, %edx
	cmovbq	%r10, %rdx
	cmoveq	%r9, %rdx
	testq	%rdx, %rdx
	movl	$0, %esi
	movl	$1, %ebx
	je	.LBB0_21
	cmpq	$-1, %rdx
	jne	.LBB0_22
	leaq	-1(%rcx), %rsi
	movq	%r11, %rbx
	jmp	.LBB0_21
.LBB0_22:
	addq	$2, %r8
	cmpq	%rdi, %r8
	jne	.LBB0_12
.LBB0_23:
	popq	%rbx
	retq
.Lfunc_end0:
```
</details><br>

With this PR:
```asm
foo3r:
	test	rcx, rcx
	je	.LBB3_1
	lea	r8, [rcx - 1]
	lea	rdx, [rcx - 2]
	mov	rax, r8
	mul	rdx
	shld	rdx, rax, 63
	imul	r8, r8
	add	r8, rcx
	sub	r8, rdx
	imul	r8, rcx
	mov	rax, r8
	ret
.LBB3_1:
	xor	r8d, r8d
	mov	rax, r8
	ret
```
2018-02-07 03:23:25 +08:00
kennytm
a026e8a972
Rollup merge of #47986 - Gilnaa:libtest_relaxed, r=Mark-Simulacrum
libtest: Replace panics with error messages

This replaces explicit panics on failures in libtest with prints to stderr.
Where "failures" == CLI argument parsing and such

Before:
```
$ ./foo-stable --not-an-option
thread 'main' panicked at '"Unrecognized option: \'not-an-option\'"', libtest/lib.rs:251:27
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```

After:
```
$ ./foo-nightly --not-an-option
error: Unrecognized option: 'not-an-option'
```
2018-02-07 03:23:24 +08:00
kennytm
0a3e07dd72
Rollup merge of #46962 - clarcharr:os_raw_docs, r=QuietMisdreavus
Document std::os::raw.

This adds a brief explanation to each type and its definition according to C. This also helps clarify that the definitions of the types, as described by rustdoc, are not necessarily the same from platform to platform.
2018-02-07 03:23:23 +08:00
Badel2
498ef20a2a Trait objects cannot contain associated constants 2018-02-06 18:44:38 +01:00
David Wood
bb6e54d4bc
Added and updated tests to enable/disable overflow checks. 2018-02-06 17:37:49 +00:00
QuietMisdreavus
fefd5e9bbc fix docs link 2018-02-06 09:26:15 -06:00
Alex Burka
3cf73f40fb proc_macro: don't panic parsing ..= (fix #47950) 2018-02-06 14:43:01 +00:00
Matthias Krüger
8d8ba812d0 config.toml.example: fix typos.
Most of them were found by codespell: https://github.com/lucasdemarchi/codespell
2018-02-06 13:01:10 +01:00
bors
ca7d839088 Auto merge of #47203 - varkor:output-filename-conflicts-with-directory, r=estebank
Warn when rustc output conflicts with existing directories

When the compiled executable would conflict with a directory, display a
rustc error instead of a verbose and potentially-confusing linker
error. This is a usability improvement, and doesn’t actually change
behaviour with regards to compilation success. This addresses the
concern in #35887. Fixes #13098.
2018-02-06 09:51:03 +00:00
bors
b224fc84e3 Auto merge of #48017 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests

- Successful merges: #46030, #47496, #47543, #47704, #47753, #47807, #47948, #47959, #48003, #48007
- Failed merges:
2018-02-06 07:02:25 +00:00
Manish Goregaokar
d0ab8f03bb Convert tyvar_behind_raw_pointer to hard error for the 2018 epoch 2018-02-05 22:16:42 -05:00
Manish Goregaokar
2cff123416 Add -Zepoch 2018-02-05 22:16:42 -05:00
David Wood
5cd4b4fd95
Swapped order of left/right visits to ensure consistency in read/write pass ordering when -O is passed. 2018-02-05 22:31:56 +00:00
kennytm
0553dc81d3
Rollup merge of #48007 - nrc:rls-field-init, r=eddyb
save-analysis: avoid implicit unwrap

When looking up a field defintion, since the name might be incorrect in the field init shorthand case.

cc https://github.com/rust-lang-nursery/rls/issues/699

r? @eddyb
2018-02-06 02:13:55 +08:00
kennytm
e2f6e134c1
Rollup merge of #48003 - mbrubeck:docs, r=steveklabnik
Fix info about generic impls in AsMut docs

This text was copy-pasted from the `AsRef` docs to `AsMut`, but needed some additional adjustments for correctness.
2018-02-06 02:13:54 +08:00
kennytm
daecd15271
Rollup merge of #47959 - Manishearth:rustdoc-ice, r=Mark-Simulacrum
Fix rustdoc ICE on macros defined within functions

fixes #47639
2018-02-06 02:13:52 +08:00
kennytm
55aef3c9c7
Rollup merge of #47948 - pietroalbini:use-nested-groups-stabilize, r=petrochenkov
Stabilize use_nested_groups

As requested in #44494. Documentation PRs already sent.
2018-02-06 02:13:51 +08:00
kennytm
e8688b4a24
Rollup merge of #47807 - tbu-:pr_doc_constanttime_cstr, r=steveklabnik
Make wording around 0-cost casts more precise
2018-02-06 02:13:50 +08:00
kennytm
ddc4284b71
Rollup merge of #47753 - steveklabnik:update-book, r=alexcrichton
Update book

This PR does two things:

1. update the book to include https://github.com/rust-lang/book/pull/1088
2. update to mdbook 0.1

Both of these things are big changes, so I want to land them now, well before the next branch, so we can kick the tires.

------------------------------

Locally, I'm seeing some weirdness around the reference and this:

![image](https://user-images.githubusercontent.com/27786/35411917-8dcbb31a-01e8-11e8-8c30-0bd280d93b9d.png)

Putting this PR up so others can try and build and see if it reproduces for them.
2018-02-06 02:13:49 +08:00
kennytm
a405a08d72
Rollup merge of #47704 - dsprenkels:issue-44415, r=alexcrichton
Add a regression test for #44415

This PR adds a regression test for issue #44415.

Fixes #44415.
2018-02-06 02:13:48 +08:00
kennytm
9dab73773a
Rollup merge of #47543 - topecongiro:issue-42344, r=nikomatsakis
Disallow mutable borrow to non-mut statics

Closes #42344.
2018-02-06 02:13:46 +08:00
kennytm
cde119db8e
Rollup merge of #47496 - QuietMisdreavus:rls-doc-include, r=estebank
add documentation from doc(include) to analysis data

cc #44732

Currently save-analysis only loads docs from plain doc comments and doc attributes. Since `#[doc(include="filename.md")]` doesn't create a plain doc attribute when it loads the file, we need to be sure to pick up this info for the analysis data.
2018-02-06 02:13:45 +08:00
kennytm
eb5a4617a5
Rollup merge of #46030 - Zoxc:asm-volatile, r=nikomatsakis
Make inline assembly volatile if it has no outputs. Fixes #46026
2018-02-06 02:13:44 +08:00
bors
6c04c41034 Auto merge of #47881 - oli-obk:miri_clippy, r=Manishearth
Update clippy and miri submodule

r? @Manishearth

cc @kennytm I needed to touch the miri submodule's Cargo.toml to make sure that clippy gets the newest compiletest_rs. This will not fix miri, but since I touched the miri submodule, will this PR fail?

miri is unfixable until #46882 is merged
2018-02-05 15:05:43 +00:00
John Kåre Alsaker
a29d8545b5 Make inline assembly volatile if it has no outputs. Fixes #46026 2018-02-05 15:56:44 +01:00
Oliver Schneider
70717f20f5
Update clippy and miri submodule 2018-02-05 11:36:51 +01:00
Pietro Albini
01f0814a2a
Stabilize use_nested_groups 2018-02-05 10:23:40 +01:00
bors
b0a396bb0a Auto merge of #47920 - Aaron1011:nll-overflow, r=pnkfelix
Fix overflow when performing drop check calculations in NLL

Clearing out the infcx's region constraints after processing each type
ends up interacting badly with normalizing associated types. This commit
keeps all region constraints intact until the end of
TypeLivenessGenerator.add_drop_live_constraint, ensuring that normalized
types are able to re-use existing inference variables.

Fixes #47589
2018-02-05 09:17:00 +00:00
Onur Aslan
1461d12b3c Use time crate in bootstrap dist instead of date 2018-02-05 11:39:54 +03:00
Scott McMurray
1b1e887f4d Override try_[r]fold for RangeInclusive
Because the last item needs special handling, it seems that LLVM has trouble canonicalizing the loops in external iteration.  With the override, it becomes obvious that the start==end case exits the loop (as opposed to the one *after* that exiting the loop in external iteration).
2018-02-04 23:48:40 -08:00
bors
07ea260407 Auto merge of #47873 - Aaron1011:final-ref-coerce, r=nikomatsakis
Fix ref-to-ptr coercions not working with NLL in certain cases

Implicit coercions from references to pointers were lowered to slightly
different Mir than explicit casts (e.g. 'foo as *mut T'). This resulted
in certain uses of self-referential structs compiling correctly when an
explicit cast was used, but not when the implicit coercion was used.

To fix this, this commit adds an outer 'Use' expr when applying a
raw-ptr-borrow adjustment. This makes the lowered Mir for coercions
identical to that of explicit coercions, allowing the original code to
compile regardless of how the raw ptr cast occurs.

Fixes #47722
2018-02-05 04:32:06 +00:00
bors
dd29d3dd76 Auto merge of #47865 - Manishearth:cleanup-shim, r=nikomatsakis
Cleanup the shim code

 - We now write directly to `RETURN_PLACE` instead of creating intermediates
 - `tuple_like_shim` takes an iterator (used by #47867)
 - `tuple_like_shim` no longer relies on it being the first thing to create blocks, and uses relative block indexing in a cleaner way (necessary for #47867)
 - All the shim builders take `dest, src` arguments instead of hardcoding RETURN_PLACE

r? @eddyb
2018-02-05 01:45:46 +00:00
bors
e7e982ac03 Auto merge of #47998 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests

- Successful merges: #47862, #47877, #47896, #47912, #47947, #47958, #47978, #47996, #47999, #47892
- Failed merges:
2018-02-04 22:58:10 +00:00
Nick Cameron
3c72a848e9 save-analysis: avoid implicit unwrap
When looking up a field defintion, since the name might be incorrect in the field init shorthand case.

cc https://github.com/rust-lang-nursery/rls/issues/699
2018-02-05 11:00:56 +13:00
steveklabnik
983cc00b80 add exceptions for new deps 2018-02-04 15:47:36 -05:00