Commit Graph

64669 Commits

Author SHA1 Message Date
Esteban Küber
46a6af12aa Change < interpreted as generic arg start warning
```
warning: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
  --> $DIR/issue-22644.rs:16:33
   |
16 |     println!("{}", a as usize < b);
   |                               - ^ interpreted as generic argument
   |                               |
   |                               not interpreted as comparison
   |
help: if you want to compare the casted value then write:
   |     println!("{}", (a as usize) < b);
```
2017-06-12 10:22:08 -07:00
Esteban Küber
5fcfa08e98 Fix affected tests 2017-06-12 07:51:55 -07:00
Esteban Küber
3a7dbf48fe Suggest non-ambiguous comparison after cast
```
warning: `<` is interpreted as a start of generic arguments for `usize`, not comparison
  --> $DIR/issue-22644.rs:16:33
   |
16 |     println!("{}", a as usize < b);
   |                                 ^ expected one of `!`, `(`, `+`, `,`, `::`, or `>` here
   |
help: if you want to compare the casted value then write
   |     println!("{}", (a as usize) < b);
```
2017-06-11 23:47:26 -07:00
Esteban Küber
a6d32153a6 Learn to parse a as usize < b
Parsing `a as usize > b` always works, but `a as usize < b` was a
parsing error because the parser would think the `<` started a generic
type argument for `usize`. The parser now attempts to parse as before,
and if a DiagnosticError is returned, try to parse again as a type with
no generic arguments. If this fails, return the original
`DiagnosticError`.
2017-06-11 13:40:04 -07:00
bors
13eb0ec9f1 Auto merge of #42383 - estebank:candidate-newline, r=arielb1
Use multiline note for trait suggestion
2017-06-05 13:07:38 +00:00
bors
c94a9ac8ae Auto merge of #42426 - arthurprs:io_error, r=sfackler
Inline io::Error creation from ErrorKind

Faster and smaller code for mio and tokio (PRs on those to follow)
2017-06-04 23:35:21 +00:00
bors
0418fa9d38 Auto merge of #42362 - estebank:type, r=arielb1
Show trait method signature when impl differs

When the trait's span is available, it is already being used, add a
`note` for the cases where the span isn't available:

<pre>
error[E0053]: <b>method `fmt` has an incompatible type for trait</b>
  --> $DIR/trait_type.rs:17:4
   |
17 |    fn fmt(&self, x: &str) -> () { }
   |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
   |
   = note: expected type `<b>fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>`
              found type `<b>fn(&MyType, &str)</b>`

error[E0050]: <b>method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2</b>
  --> $DIR/trait_type.rs:21:11
   |
21 |    fn fmt(&self) -> () { }
   |           ^^^^^ expected 2 parameters, found 1
   |
   = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>`

error[E0186]: <b>method `fmt` has a `&self` declaration in the trait, but not in the impl</b>
  --> $DIR/trait_type.rs:25:4
   |
25 |    fn fmt() -> () { }
   |    ^^^^^^^^^^^^^^^^^^ expected `&self` in impl
   |
   = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>`

error[E0046]: <b>not all trait items implemented, missing: `fmt`</b>
  --> $DIR/trait_type.rs:28:1
   |
28 | impl std::fmt::Display for MyType4 {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation
   |
   = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>`
</code></pre>

Fix #28011.
2017-06-04 20:16:09 +00:00
Esteban Küber
397972f5b0 Separate suggestion in a help and a note 2017-06-04 12:56:57 -07:00
Esteban Küber
e324919ec5 Show trait method signature when impl differs
When the trait's span is available, it is already being used, add a
`note` for the cases where the span isn't available:

```
error[E0053]: method `fmt` has an incompatible type for trait
  --> $DIR/trait_type.rs:17:4
   |
17 |    fn fmt(&self, x: &str) -> () { }
   |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
   |
   = note: expected type `fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
              found type `fn(&MyType, &str)`

error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2
  --> $DIR/trait_type.rs:21:11
   |
21 |    fn fmt(&self) -> () { }
   |           ^^^^^ expected 2 parameters, found 1
   |
   = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`

error[E0186]: method `fmt` has a `&self` declaration in the trait, but not in the impl
  --> $DIR/trait_type.rs:25:4
   |
25 |    fn fmt() -> () { }
   |    ^^^^^^^^^^^^^^^^^^ expected `&self` in impl
   |
   = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`

error[E0046]: not all trait items implemented, missing: `fmt`
  --> $DIR/trait_type.rs:28:1
   |
28 | impl std::fmt::Display for MyType4 {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation
   |
   = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
```
2017-06-04 12:52:55 -07:00
bors
9a4e13f5c4 Auto merge of #42402 - citizen428:create-dump-mir-dir, r=Mark-Simulacrum
Create directory for dump-mir-dir automatically

Fixes #35543 r? @Mark-Simulacrum

@Mark-Simulacrum I know someone else said that they'll work on this, but it has been 3+ weeks and I had nothing to do and wanted to contribute a bit.

I now added the call to automatically create the directory as discussed, but was wondering how you feel about the suggestion to set a default directory, i.e. `target/mir`?
2017-06-04 17:51:46 +00:00
arthurprs
4bda94d0d8 inline io::Error creation from ErrorKind 2017-06-04 19:45:44 +02:00
bors
341f453448 Auto merge of #42418 - tomprince:try-deploy, r=Mark-Simulacrum
Upload linux-x86_64 artifacts on try branch.

This is an experiment to explore generating artifacts for testing with cargobmomb. See brson/cargobomb#64.
2017-06-04 15:35:37 +00:00
bors
0da9721ab4 Auto merge of #42406 - bjorn3:patch-1, r=eddyb
Some doc comments
2017-06-04 12:36:11 +00:00
Mark Simulacrum
d2ff798f3a Don't run travis tests on master.
This saves us builders for more helpful purposes.
2017-06-04 00:00:22 -06:00
bors
0b17b4c084 Auto merge of #42265 - Zoxc:for-sugar, r=eddyb
Change for-loop desugar to not borrow the iterator during the loop

This is enables the use of suspend points inside for-loops in movable generators. This is illegal in the current desugaring as `iter` is borrowed across the body.
2017-06-04 05:44:39 +00:00
bors
1b5a923001 Auto merge of #41968 - kennytm:fix-unreadable-json-test-output-36516, r=nikomatsakis
Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516.

<del>`ui-run` test is a combination of `ui` test and `run-pass` test. It is used to test lint output.</del>

Added support of `// run-pass` header to `ui` tests.

The compiler message of each test must match the corresponding `*.stderr` file like the traditional `ui` tests. Additionally, the compiled output must be executed successfully like the `run-pass` test.

12 `run-pass`/`run-pass-fulldeps` tests are moved to `ui`/`ui-fulldeps` plus the headers. After this move, no `run-pass`/`run-pass-fulldeps` tests should rely on the compiler's JSON message. This allows us to stop passing `--error-format json` in run-pass tests, thus fixing #36516.
2017-06-04 03:23:39 +00:00
Michael Kohl
82caf2132d Create directory for dump-mir-dir automatically
Fixes #35543
2017-06-04 10:08:42 +07:00
Tom Prince
abb50f2dfa Deploy linux-x86_64 artifacts on try branch. 2017-06-03 19:23:59 -06:00
bors
efee86d1a1 Auto merge of #42398 - redox-os:master, r=sfackler
Redox: Switch to repr(C) for syscall structs
2017-06-04 01:06:23 +00:00
bors
8f66fafebd Auto merge of #42391 - photoszzt:master, r=Manishearth
Better suggestion for unknown method

r? @Manishearth

fixes #42386
2017-06-03 22:49:11 +00:00
bors
6684d176c7 Auto merge of #42387 - GuillaumeGomez:error-codes-next, r=Susurrus
Add E0603 error code

Part of #42229.

cc @Susurrus
2017-06-03 20:31:11 +00:00
bors
0453cf520d Auto merge of #42369 - RalfJung:drop-glue, r=eddyb
array drop glue: avoid using out-of-bounds index lvalues

Avoid using out-of-bounds index lvalues. Miri doesn't like them, and they seem fishy in general.
Instead, use a pointer cast to compute the address of the beginning, and Offset to compute the end.

Cc @arielb1 @nagisa
2017-06-03 18:02:57 +00:00
bjorn3
18c46327ec Module doc comment for librustc/dep_graph/safe.rs 2017-06-03 18:04:37 +02:00
bjorn3
101a28f30b Make some comments docs in librustc/dep_graph/dep_node.rs 2017-06-03 17:59:07 +02:00
bors
a8dc246dc7 Auto merge of #42334 - est31:master, r=jseyfried
Extend the unused macro lint to macros 2.0

Extends the unused macro lint (added in PR #41907) to macros 2.0 (added in PR #40847).

r? @jseyfried
2017-06-03 15:40:34 +00:00
bors
4225019750 Auto merge of #42396 - venkatagiri:remove_lifetime_extn, r=arielb1
rustc: remove temporary lifetime extension by borrow hint

closes #39283.

Thanks to @nikomatsakis for mentoring on this one.

r? @arielb1
2017-06-03 13:17:20 +00:00
bors
2f2d7413ff Auto merge of #42332 - michaelwoerister:no-more-retracing, r=nikomatsakis
incr.comp.: Use DefPathHash-based DepNodes in the serialized DepGraph and remove obsolete DefIdDirectory

With this PR we don't store the dep-graph as a set of `DepNode<IndexIntoDefIdDirectory>` anymore but instead as a set of `DepNode<DefPathHash>`. Since a `DefPathHash` is a global identifier that is valid across compilation sessions, we don't need the `DefIdDirectory` anymore.

Since a `DepNode<DefPathHash>` is bigger than a `DepNode<IndexIntoDefIdDirectory>` and our on-disk encoding of the dep-graph is inefficient, this PR will probably increase the amount of space the dep-graph takes up on disk. I'm in the process of gathering some performance data.

The changes in here are a step towards implementing ICH-based `DepNodes` (#42294).

r? @nikomatsakis
2017-06-03 10:56:42 +00:00
bors
fbb9276780 Auto merge of #42331 - retep998:standard-relocation-coupon, r=alexcrichton
Improve reallocation in alloc_system on Windows

Fixes https://github.com/rust-lang/rust/issues/42025
2017-06-03 08:32:58 +00:00
bors
6165203c48 Auto merge of #42400 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests

- Successful merges: #42353, #42354, #42363, #42368, #42382
- Failed merges:
2017-06-03 06:13:05 +00:00
Corey Farwell
4683500036 Rollup merge of #42382 - alexcrichton:remove-rustflags, r=Mark-Simulacrum
rustbuild: Remove RUSTFLAGS logic in rustc shim

This was added in #38072 but I can't recall why and AFAIK Cargo already handles
this. This was discovered through #42146 where passing duplicate flags was
causing problems.
2017-06-03 01:00:55 -04:00
Corey Farwell
bef8fbd6db Rollup merge of #42368 - estebank:call-site, r=nikomatsakis
Use callsite's span for macro calls on suggestion

When suggesting an appropriate mutability for a macro call, use the call
span instead of the expanded macro's span.

```
error[E0308]: mismatched types
  --> $DIR/coerce-suggestions.rs:48:9
   |
48 |     s = format!("foo");
   |         ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String`
   |
   = note: expected type `&mut std::string::String`
              found type `std::string::String`
   = help: try with `&mut format!("foo")`
   = note: this error originates in a macro outside of the current crate
```
Fix #41858.
2017-06-03 01:00:54 -04:00
Corey Farwell
25bbbb3119 Rollup merge of #42363 - cuviper:no-fail-fast, r=alexcrichton
rustbuild: Add `./x.py test --no-fail-fast`

This option forwards to each `cargo test` invocation, and applies the
same logic across all test steps to keep going after failures.  At the
end, a brief summary line reports how many commands failed, if any.

Note that if a test program fails to even start at all, or if an
auxiliary build command related to testing fails, these are still left
to stop everything right away.

Fixes #40219.
2017-06-03 01:00:53 -04:00
Corey Farwell
57b87c2c4f Rollup merge of #42354 - Mark-Simulacrum:reduce-verbosity, r=alexcrichton
Reduce verbosity of build logs

This does two separate things.
 - Sets sccache logging to warn instead of info.
 - Makes tests when running for a given PR (not on auto branch) quiet. (cc @eddyb)

r? @alexcrichton
2017-06-03 01:00:52 -04:00
Corey Farwell
e63d3b7148 Rollup merge of #42353 - steveklabnik:update-books, r=GuillaumeGomez
Update various book repos for the next release.
2017-06-03 01:00:51 -04:00
bors
14526a3744 Auto merge of #41953 - Aaronepower:patch-1, r=brson
Updated releases notes for 1.18

This is my first time making the release notes so please give it an extra once over!
2017-06-03 03:57:13 +00:00
Jeremy Soller
f3286fd439 Switch to repr(C) for syscall structs 2017-06-02 20:57:46 -06:00
zzhu
f113f54bac Better suggestion for unknown method
Fixes #42386
2017-06-02 17:01:16 -07:00
Venkata Giri Reddy
ac8a1f5b6d rustc: remove temporary lifetime extension by borrow hint 2017-06-02 23:43:50 +00:00
bors
bb907adbbd Auto merge of #42381 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 10 pull requests

- Successful merges: #41981, #42225, #42310, #42319, #42335, #42343, #42355, #42360, #42370, #42372
- Failed merges:
2017-06-02 22:19:08 +00:00
Guillaume Gomez
6675bb3e73 Add E0603 error code 2017-06-02 21:40:22 +02:00
bors
107bd67ef7 Auto merge of #42189 - nikomatsakis:chalk-trait-env-param-env, r=eddyb
querify layout and move param env out of the infcx

The main goal of this PR is to move the parameter environment *out* of the inference context. This is because the inference environment will soon be changing over the course of inference --- for example, when we enter into a `for<'a> fn(...)` type, we will push a new environment with an increasing universe index, rather than skolemizing the `'a` references. Similarly, each obligation will soon be able to have a distinct parameter environment, and therefore the `Obligation` struct is extended to carry a `ParamEnv<'tcx>`. (I debated about putting it into the cause; seems plausible, but also weird.)

Along the way, I also reworked how layout works, moving the layout cache into a proper query along the lines of needs-drop and friends.

Finally, tweaks the inference context API. It seemed to be accumulating parameters at an alarming rate. The main way to e.g. make a subtype or equality relationship is to do the following:

    infcx.at(cause, param_env).sub(a, b)
    infcx.at(cause, param_env).eq(a, b)

In both cases, `a` is considered the "expected" type (this used to be specified by a boolean). I tried hard to preserve the existing notion of what was "expected", although in some cases I'm not convinced it was being set on purpose one way or the other. This is why in some cases you will see me do `sup(b, a)`, which is otherwise equivalent to `sub(a, b)`, but sets the "expected type" differently.

r? @eddyb
cc @arielb1
2017-06-02 19:23:14 +00:00
Mark Simulacrum
3447aa764a Quiet tests on PR tests 2017-06-02 12:04:00 -06:00
Mark Simulacrum
98dc118c72 Reduce sccache log level. 2017-06-02 11:44:54 -06:00
Esteban Küber
e935acfa5c Use multiline note for trait suggestion 2017-06-02 10:15:13 -07:00
Alex Crichton
225073eff8 rustbuild: Remove RUSTFLAGS logic in rustc shim
This was added in #38072 but I can't recall why and AFAIK Cargo already handles
this. This was discovered through #42146 where passing duplicate flags was
causing problems.
2017-06-02 09:57:20 -07:00
Josh Stone
617aea4c9b rustbuild: Add ./x.py test --no-fail-fast
This option forwards to each `cargo test` invocation, and applies the
same logic across all test steps to keep going after failures.  At the
end, a brief summary line reports how many commands failed, if any.

Note that if a test program fails to even start at all, or if an
auxiliary build command related to testing fails, these are still left
to stop everything right away.

Fixes #40219.
2017-06-02 09:27:44 -07:00
kennytm
3e6c83de1d
compiletest: Force directive to be first complete word in header comment.
Refactored some related code to take advantage of this change.
2017-06-02 23:28:22 +08:00
kennytm
38ef85696d
Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516.
The 'run-pass' header cause a 'ui' test to execute the result. It is used
to test the lint output, at the same time ensure those lints won't cause
the source code to become compile-fail.

12 run-pass/run-pass-fulldeps tests gained the header and are moved to
ui/ui-fulldeps. After this move, no run-pass/run-pass-fulldeps tests should
rely on the compiler's JSON message. This allows us to stop passing
`--error-format json` in run-pass tests, thus fixing #36516.
2017-06-02 23:28:22 +08:00
Mark Simulacrum
e05f1c1290 Rollup merge of #42372 - frewsxcv:frewsxcv/improve-receiver-docs, r=QuietMisdreavus
Rewrite a couple `Receiver` doc examples.

None
2017-06-02 09:10:49 -06:00
Mark Simulacrum
1a3d026094 Rollup merge of #42370 - mbrubeck:docs, r=frewsxcv
Add [[T]] -> [T] examples to SliceConcatExt docs

None
2017-06-02 09:10:48 -06:00