Commit Graph

74471 Commits

Author SHA1 Message Date
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
fee39ba8bd Auto merge of #47957 - bobtwinkles:fix_mir_consts, r=nikomatsakis
[NLL] Improve DefiningTy::Const

Fixes #47590 by fixing the way DefiningTy represents constants. Previously, constants were represented using just the type of the variable. However, this will fail to capture early-bound regions as NLL inference vars, resulting in an ICE when we try to compute region VIDs a little bit later in the universal
region resolution process. (ref #47590)
2018-02-07 14:54:15 +00:00
Oliver Middleton
528d6b65b6 rustdoc: Hide -> () in cross crate inlined Fn* bounds 2018-02-07 13:14:37 +00:00
Ryan Cumming
daaa9a440c Fix ICE for mismatched args on target without span
Commit 7ed00caacc improved our error reporting by including the target
function in our error messages when there is an argument count mismatch.
A simple example from the UI tests is:

```
error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments
  --> $DIR/closure-arg-count.rs:32:53
   |
32 |     let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
   |                                                     ^^^ expected function that takes a single 2-tuple as argument
...
44 | fn foo() {}
   | -------- takes 0 arguments
```

However, this assumed the target span was always available. This does
not hold true if the target function is in `std` or another crate. A
simple example from #48046 is assigning `str::split` to a function type
with a different number of arguments.

Fix by removing all of the labels and suggestions related to the target
span when it's not found.

Fixes #48046
2018-02-07 18:34:45 +11:00
bobtwinkles
e99f8fcbc5 Update trait-associated-const test to new format 2018-02-07 00:46:36 -05:00
bobtwinkles
5de094e579 mir: Fix DefiningTy::Const
Fixes #47590 by fixing the way DefiningTy represents constants. Previously,
constants were represented using just the type of the variable. However, this
will fail to capture early-bound regions as NLL inference vars, resulting in an
ICE when we try to compute region VIDs a little bit later in the universal
region resolution process.
2018-02-06 23:42:05 -05: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
Shaun Steenkamp
dcdd2c42d3 38880 use search_mut function rather than search_hashed 2018-02-06 15:43:34 +00:00
Shaun Steenkamp
9bc59865f1 38880 don't compute hash when searching an empty HashMap
This addresses issue #38880
2018-02-06 15:43:34 +00:00
Ralf Jung
ac183f83df improve wording: bounds -> generic bounds 2018-02-06 16:28:25 +01: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
Zack M. Davis
b55e07ee50 correct E0619 span re method call receivers whose type must be known
Previously, when the type of a method receiver could not be determined,
the error message would, potentially confusingly, highlight the span of
the entire method call.

Resolves #36598, resolves #42234.
2018-02-05 18:09:51 -08: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
Ralf Jung
2aae22746e Warn about more ignored bounds on type aliases 2018-02-05 21:20:57 +01:00
bobtwinkles
eae1a35f55 mir: Add and fix tests for FalseUnwinds
Fix instructions on existing mir-opt tests after introducing false edges from
loops. Also, add a test for issue 46036: infinite loops.
2018-02-05 15:00:40 -05:00
bobtwinkles
ed6a2ebcd6 mir: Add false edge cleanup out of infinite loops
Fixes #46036
2018-02-05 15:00:40 -05:00
bobtwinkles
bdc37aa057 mir: Add TerminatorKind::FalseUnwind
Sometimes a simple goto misses the cleanup/unwind edges. Specifically, in the
case of infinite loops such as those introduced by a loop statement without any
other out edges. Analogous to TerminatorKind::FalseEdges; this new terminator
kind is used when we want borrowck to consider an unwind path, but real control
flow should never actually take it.
2018-02-05 15:00:40 -05:00
bobtwinkles
5ca88ae6ae Fix comment in ExprKind::LogicalOp
The comment previously implied that the true branch would result in the false
block. Fortunately the implementation is correct.
2018-02-05 15:00:40 -05:00
Alex Crichton
27a4e73ca5 rustc: Add #[rustc_args_required_const]
This commit adds a new unstable attribute to the compiler which requires that
arguments to a function are always provided as constants. The primary use case
for this is SIMD intrinsics where arguments are defined by vendors to be
constant and in LLVM they indeed must be constant as well.

For now this is mostly just a semantic guarantee in rustc that an argument is a
constant when invoked, phases like trans don't actually take advantage of it
yet. This means that we'll be able to use this in stdsimd but we won't be able
to remove the `constify_*` macros just yet. Hopefully soon though!
2018-02-05 10:58:13 -08: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
O01eg
7be8e2fbb3
Add build.tools option to manage installation of extended rust tools. 2018-02-05 20:10:05 +03:00
Ralf Jung
c83dd03062 Clarify 'trait bounds ignored' wording 2018-02-05 17:31:46 +01: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