Commit Graph

79477 Commits

Author SHA1 Message Date
Maerten
fadb86f25d
Fix when the help message is displayed
Only display the "remove this comma" suggestion when followed by an identifier
2018-06-22 11:38:38 +02:00
Lamb
6c962e3ec4
Issue #50974: Adding issue number in the test 2018-06-22 11:38:38 +02:00
Lamb
5c022af4a4
Issue #50974: Adding tests 2018-06-22 11:38:38 +02:00
Lamb
783815d219
Issue #50974: Change text of suggestion to be more direct 2018-06-22 11:38:38 +02:00
Lamb
7969b78222
Issue #50974: Suboptimal error in case of duplicate , in struct constructor 2018-06-22 11:38:38 +02:00
bors
7dae5c0e06 Auto merge of #51686 - nikomatsakis:issue-51415-borrowck-match-default-bindings-bug, r=eddyb
yet another "old borrowck" bug around match default bindings

We were getting the type of the parameter from its pattern, but that didn't include adjustments. I did a `ripgrep` around and this seemed to be the only affected case.

The reason this didn't show up as an ICE earlier is that mem-categorization is lenient with respect to weird discrepancies. I am going to add more delay-span-bug calls shortly around that (I'll push onto the PR).

This example is an ICE, but I presume that there is a way to make a soundness example out of this -- it basically ignores borrows occuring inside match-default-bindings in a closure, though only if the implicit deref is at the top-level. It happens though that this occurs frequently in iterators, which often give a `&T` parameter.

Fixes #51415
Fixes #49534

r? @eddyb
2018-06-22 06:36:11 +00:00
bors
4b17d31f11 Auto merge of #51463 - estebank:error-codes, r=nikomatsakis
Various changes to existing diagnostics

* [Add code to `invalid ABI` error, add span label, move list to help to make message shorter](23ae5af274):
```
error[E0697]: invalid ABI: found `路濫狼á́́`
  --> $DIR/unicode.rs:11:8
   |
LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI
   |        ^^^^^^^^^ invalid ABI
   |
   = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted
```
* [Add code to incorrect `pub` restriction error](e96fdea8a3)
* [Add message to `rustc_on_unimplemented` attributes in core to have them set a custom message _and_ label](2cc7e5ed30):
```
error[E0277]: `W` does not have a constant size known at compile-time
  --> $DIR/unsized-enum2.rs:33:8
   |
LL |     VA(W),
   |        ^ `W` does not have a constant size known at compile-time
   |
   = help: the trait `std::marker::Sized` is not implemented for `W`
   = help: consider adding a `where W: std::marker::Sized` bound
   = note: no field of an enum variant may have a dynamically sized type
```
```
error[E0277]: `Foo` cannot be sent between threads safely
  --> $DIR/E0277-2.rs:26:5
   |
LL |     is_send::<Foo>();
   |     ^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely
   |
   = help: the trait `std::marker::Send` is not implemented for `Foo`
```
```
error[E0277]: can't compare `{integer}` with `std::string::String`
  --> $DIR/binops.rs:16:7
   |
LL |     5 < String::new();
   |       ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String`
   |
   = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}`
```
```
error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>`
  --> $DIR/binops.rs:17:7
   |
LL |     6 == Ok(1);
   |       ^^ no implementation for `{integer} == std::result::Result<{integer}, _>`
   |
   = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}`
```
```
error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32`
  --> $DIR/type-check-defaults.rs:16:19
   |
LL | struct WellFormed<Z = Foo<i32, i32>>(Z);
   |                   ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
   |
   = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32`
note: required by `Foo`
  --> $DIR/type-check-defaults.rs:15:1
   |
LL | struct Foo<T, U: FromIterator<T>>(T, U);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
* [Add link to book for `Sized` errors](1244dc7c28):
```
error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time
  --> $DIR/const-unsized.rs:13:29
   |
LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync));
   |                             ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time
   |
   = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static`
   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
   = note: constant expressions must have a statically known size
```
* [Point to previous line for single expected token not found](48165168fb) (if the current token is in a different line)
2018-06-22 03:24:36 +00:00
bors
0b8d817404 Auto merge of #51433 - scalexm:finish-rules, r=nikomatsakis
[chalkify] Small refactoring and WF/FromEnv rules for types

r? @nikomatsakis
2018-06-22 01:17:52 +00:00
bors
ec60dd81f9 Auto merge of #51690 - nikomatsakis:issue-51683-existential-fail, r=oli-obk
do not ICE when existing type info is incomplete

Apparently master is kinda ICE-y right now, but only for some people (sadly that set includes me).

I'm not crazy about this PR, because it seems to regress diagnostics a lot, but it *does* fix the problems. I think probably fixing the diagnostics should be done by doing a better job of suppressing errors?

Mitigates  #51683

r? @oli-obk
2018-06-21 23:08:32 +00:00
bors
662c70a59f Auto merge of #48149 - varkor:generics-generalisation, r=petrochenkov
The Great Generics Generalisation: HIR Edition

This is essentially a followup to https://github.com/rust-lang/rust/pull/45930, consolidating the use of separate lifetime and type vectors into single kinds vectors wherever possible. This is intended to provide more of the groundwork for const generics (https://github.com/rust-lang/rust/issues/44580).

r? @eddyb
cc @yodaldevoid
2018-06-21 20:58:51 +00:00
Niko Matsakis
e3fa2d5803 tolerate existential types whose concrete expansion is not known 2018-06-21 16:38:35 -04:00
Niko Matsakis
a2a019a28a do not introduce *false* results from lifetime resolution 2018-06-21 16:38:35 -04:00
Niko Matsakis
8289bf2994 use pat_ty_adjusted from expr_use_visitor to type of arguments 2018-06-21 14:32:52 -04:00
Niko Matsakis
81fedd58b4 rename pat_ty to pat_ty_adjusted for clarity 2018-06-21 14:32:34 -04:00
bors
f790780451 Auto merge of #51680 - Mark-Simulacrum:acc-revert, r=Mark-Simulacrum
Revert #51662

This reverts that PR because it was never intended to merge into the master branch.
2018-06-21 13:36:37 +00:00
Mark Simulacrum
43557fc8f9 Revert "Auto merge of #51662 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum"
This reverts commit fff1abadd7, reversing
changes made to 01172a7d13.
2018-06-21 06:53:26 -06:00
bors
e11c95dda1 Auto merge of #50336 - japaric:llvm-tools, r=Mark-Simulacrum
ship LLVM tools with the toolchain

this PR adds llvm-{nm,objcopy,objdump,size} to the rustc sysroot (right next to LLD)

this slightly increases the size of the rustc component. I measured these numbers on x86_64 Linux:

- rustc-1.27.0-dev-x86_64-unknown-linux-gnu.tar.gz 180M -> 193M (+7%)
- rustc-1.27.0-dev-x86_64-unknown-linux-gnu.tar.xz 129M -> 137M (+6%)

r? @alexcrichton
cc #49584
2018-06-21 11:28:14 +00:00
bors
95979dcfb2 Auto merge of #51601 - Emerentius:step_by_range_diet, r=sfackler
Specialize StepBy<Range(Inclusive)>

Part of #51557, related to #43064, #31155

As discussed in the above issues, `step_by` optimizes very badly on ranges which is related to
1. the special casing of the first `StepBy::next()` call
2. the need to do 2 additions of `n - 1` and `1` inside the range's `next()`

This PR eliminates both by overriding `next()` to always produce the current element and also step ahead by `n` elements in one go. The generated code is much better, even identical in the case of a `Range` with constant `start` and `end` where `start+step` can't overflow. Without constant bounds it's a bit longer than the manual loop. `RangeInclusive` doesn't optimize as nicely but is still much better than the original asm.
Unsigned integers optimize better than signed ones for some reason.

See the following two links for a comparison.

[godbolt: specialization for ..](https://godbolt.org/g/haHLJr)
[godbolt: specialization for ..=](https://godbolt.org/g/ewyMu6)

`RangeFrom`, the only other range with an `Iterator` implementation can't be specialized like this without changing behaviour due to overflow. There is no way to save "finished-ness".

The approach can not be used in general, because it would produce side effects of the underlying iterator too early.

May obsolete #51435, haven't checked.
2018-06-21 08:55:13 +00:00
bors
fff1abadd7 Auto merge of #51662 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] Prepare 1.28.0 beta release

This feels likely to fail due to https://github.com/rust-lang/rust/issues/51650 but I want to see what CI says.
2018-06-21 04:02:57 +00:00
Mark Simulacrum
09a0bc7975 Fix error-chain warnings 2018-06-20 19:52:07 -06:00
Jorge Aparicio
9a96876d2d no -Bsymbolic for mac; no static-libstdc++ for windows 2018-06-20 17:48:04 -05:00
bors
01172a7d13 Auto merge of #50698 - Eijebong:tempfile, r=oli-obk
Replace tempdir by tempfile
2018-06-20 22:40:18 +00:00
Bastien Orivel
c863049225 Fix tidy 2018-06-20 19:28:27 +02:00
Bastien Orivel
9d5b13e74b Replace tempdir by tempfile in librustc
This removes the last dependency on tempdir.
2018-06-20 19:28:27 +02:00
Bastien Orivel
677eeaaa61 Replace tempdir by tempfile in librustc_trans 2018-06-20 19:28:27 +02:00
Bastien Orivel
ae9a27185e Replace tempdir by tempfile in librustdoc 2018-06-20 19:28:27 +02:00
Mark Simulacrum
842a9061ea [beta] Prepare 1.28.0 beta release 2018-06-20 07:48:06 -06:00
bors
637fd2e048 Auto merge of #51651 - spastorino:fix_var_name_in_e0502, r=nikomatsakis
Fix variable name in E0502 double borrow error

Closes #51268

r? @nikomatsakis
2018-06-20 12:46:15 +00:00
Santiago Pastorino
3d31e5ffa6
Fix variable name in E0502 double borrow error 2018-06-20 09:04:52 -03:00
varkor
daf7e359a1 Fix rebase issues with existential types 2018-06-20 12:34:39 +01:00
varkor
21136b8ab4 Rename ParenthesizedArgData to ParenthesisedArgs 2018-06-20 12:23:46 +01:00
varkor
95ce05c586 Simplify some counting 2018-06-20 12:23:46 +01:00
varkor
7a829273bf Rename ty_param_bound to generic_bound 2018-06-20 12:23:46 +01:00
varkor
4343c20819 Use ty::Generics instead of hir::Generics for various checks 2018-06-20 12:23:46 +01:00
varkor
dde942bb64 Fix additional comments 2018-06-20 12:23:46 +01:00
varkor
a65a9d77f3 Fix accidental quadratic loops 2018-06-20 12:23:46 +01:00
varkor
37204027b6 Rename ty_param_bound to trait_bound 2018-06-20 12:23:46 +01:00
varkor
95f1866a4d Make GenericBound explicit 2018-06-20 12:23:46 +01:00
varkor
c5f16e0e18 Rename ParamBound(s) to GenericBound(s) 2018-06-20 12:23:46 +01:00
varkor
991efa4284 Address various comments 2018-06-20 12:23:33 +01:00
varkor
91712bc665 Lift attrs into hir::GenericParam 2018-06-20 12:23:23 +01:00
varkor
7de6ed06a5 Rename TraitTyParamBound to ParamBound::Trait 2018-06-20 12:23:23 +01:00
varkor
8bc3a35576 Fix HasAttrs support for GenericParam 2018-06-20 12:23:23 +01:00
varkor
390aa5d421 Introduce ParamName and use it in place of LifetimeName 2018-06-20 12:23:23 +01:00
varkor
59feafd9d8 Fix NodeLifetime/NodeGenericParam confusion 2018-06-20 12:23:08 +01:00
varkor
831b5c02df Take advantage of the lifetime refactoring 2018-06-20 12:23:08 +01:00
varkor
6015edf9af Remove name from GenericParamKind::Lifetime 2018-06-20 12:23:08 +01:00
varkor
c4e8e71880 Lift name into GenericParam 2018-06-20 12:23:08 +01:00
varkor
32b2dacdf8 Handle lifetimes in NodeGenericParam also 2018-06-20 12:23:07 +01:00
varkor
80dbe58efc Use ParamBounds in WhereRegionPredicate 2018-06-20 12:23:07 +01:00