Commit Graph

68034 Commits

Author SHA1 Message Date
Guillaume Gomez
8a25ec019e Rollup merge of #44103 - zackmdavis:cmp_op_must_use, r=arielb1
add comparison operators to must-use lint (under `fn_must_use` feature)

Although RFC 1940 is about annotating functions with `#[must_use]`, a
key part of the motivation was linting unused equality operators.

(See
https://github.com/rust-lang/rfcs/pull/1812#issuecomment-265695898—it
seems to have not been clear to discussants at the time that marking the
comparison methods as `must_use` would not give us the lints on
comparison operators, at least in (what the present author understood
as) the most straightforward implementation, as landed in #43728
(3645b062).)

To rectify the situation, we here lint unused comparison operators as
part of the unused-must-use lint (feature gated by the `fn_must_use`
feature flag, which now arguably becomes a slight (tolerable in the
opinion of the present author) misnomer).

This is in the matter of #43302.

cc @crumblingstatue
2017-09-24 14:01:49 +02:00
Ariel Ben-Yehuda
b6bce56ac7 sort the list of inference errors by span
this should produce more error stability
2017-09-24 13:45:19 +03:00
Ariel Ben-Yehuda
516534ffdf fix test 2017-09-24 13:15:18 +03:00
Ariel Ben-Yehuda
b408144dbe remove test code accidentally checked in 2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
9c4898eadd address review comments 2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
c72a979979 move unsafety checking to MIR
No functional changes intended.
2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
8c7500f9b6 add lint levels to VisibilityScope 2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
9d6b9d62ba typeck::check::coercion - roll back failed unsizing type vars
This wraps unsizing coercions within an additional level of
`commit_if_ok`, which rolls back type variables if the unsizing coercion
fails. This prevents a large amount of type-variables from accumulating
while type-checking a large function, e.g. shaving 2GB off one of the
4GB peaks in #36799.
2017-09-24 12:40:29 +03:00
Ariel Ben-Yehuda
e921b32be3 put empty generic lists behind a pointer
This reduces the size of hir::Expr from 128 to 88 bytes (!) and shaves
200MB out of #36799.
2017-09-24 12:34:21 +03:00
bors
6f9078745e Auto merge of #44786 - thombles:tk/i41314, r=petrochenkov
Improve diagnostics when attempting to match tuple enum variant with struct pattern

Adds an extra note as below to explain that a tuple pattern was probably intended.

```
error[E0026]: variant `X::Y` does not have a field named `data`
  --> src/main.rs:18:16
   |
18 |         X::Y { data } => println!("The data is {}", data)
   |                ^^^^ variant `X::Y` does not have field `data`

error[E0027]: pattern does not mention field `0`
  --> src/main.rs:18:9
   |
18 |         X::Y { data } => println!("The data is {}", data)
   |         ^^^^^^^^^^^^^ missing field `0`
   |
   = note: trying to match a tuple variant with a struct variant pattern
```

Fixes #41314.
2017-09-24 09:02:19 +00:00
Keith Yeung
ed59a868dd Add span labels for E0505 for MIR borrowck 2017-09-23 23:44:51 -07:00
bors
acb73dbe8b Auto merge of #44772 - michaelwoerister:new-graph, r=nikomatsakis
incr.comp.: Add new DepGraph implementation.

This commits does a few things:
1. It adds the new dep-graph implementation -- *in addition* to the old one. This way we can start testing the new implementation without switching all tests at once.
2. It persists the new dep-graph (which includes query result fingerprints) to the incr. comp. caching directory and also loads this data.
3. It removes support for loading fingerprints of metadata imported from other crates (except for when running autotests). This is not needed anymore with red/green. It could provide a performance advantage but that's yet to be determined. For now, as red/green is not fully implemented yet, the cross-crate incremental tests are disabled.

Note, this PR is based on top of soon-to-be-merged #44696 and only the last 4 commits are new:
```
- incr.comp.: Initial implemenation of append-only dep-graph. (c90147c)
- incr.comp.: Do some various cleanup. (8ce20c5)
- incr.comp.: Serialize and deserialize new DepGraph. (0e13c1a)
- incr.comp.: Remove support for loading metadata fingerprints. (270a134)
EDIT 2:
- incr.comp.: Make #[rustc_dirty/clean] test for fingerprint equality ... (d8f7ff9)
```
(EDIT: GH displays the commits in the wrong order for some reason)

Also note that this PR is expected to certainly result in performance regressions in the incr. comp. test cases, since we are adding quite a few things (a whole additional dep-graph, for example) without removing anything. End-to-end performance measurements will only make sense again after red/green is enabled and all the legacy tracking has been turned off.

EDIT 2: Pushed another commit that makes the `#[rustc_dirty]`/`#[rustc_clean]` based autotests compared query result fingerprints instead of testing `DepNode` existence.
2017-09-24 03:55:23 +00:00
bors
24831c7221 Auto merge of #44436 - MicroJoe:master, r=alexcrichton
Add Duration::from_micros

This fixes #44400 that explains why it could be useful for embedded designs timing.
2017-09-23 22:21:32 +00:00
bors
26015da014 Auto merge of #44765 - tamird:libc-shim, r=alexcrichton
Trim and document libc shim

(hopefully) easy part of #44515.

r? @alexcrichton
2017-09-23 19:16:11 +00:00
Michael Woerister
89aec1eb0b incr.comp.: Remove out-dated unit test and unnecessary assertion. 2017-09-23 19:49:05 +02:00
Michael Woerister
45a03f153f incr.comp.: Make #[rustc_dirty/clean] test for fingerprint equality instead of DepNode existence. 2017-09-23 19:47:46 +02:00
Michael Woerister
2a50d127dd incr.comp.: Remove support for loading metadata fingerprints. 2017-09-23 19:47:37 +02:00
Michael Woerister
5974ec745e incr.comp.: Serialize and deserialize new DepGraph 2017-09-23 19:47:28 +02:00
Michael Woerister
a7428da415 incr.comp.: Do some various cleanup. 2017-09-23 19:47:20 +02:00
Michael Woerister
fecd92a7fe incr.comp.: Initial implemenation of append-only dep-graph. 2017-09-23 19:47:12 +02:00
Zack M. Davis
6734d39b49 update fn_must_use UI test to exercise nonprimitive comparisons 2017-09-23 10:11:39 -07:00
bjorn3
3c32c6aa8d Fix some tests with no llvm build 2017-09-23 18:15:58 +02:00
bjorn3
56c46707ed Fix error 2017-09-23 18:07:53 +02:00
bjorn3
18005203e1 Remove now unused dependency on flate2 from rustc_driver 2017-09-23 15:27:54 +02:00
bjorn3
95fb1d008f Remove leftover 2017-09-23 15:26:34 +02:00
bjorn3
70e5baeb71 Fix tidy errors 2017-09-23 15:23:40 +02:00
bors
a83c3e7771 Auto merge of #43870 - GuillaumeGomez:deref-suggestion, r=nikomatsakis
Add deref suggestion

Fixes #34562.
2017-09-23 13:13:15 +00:00
bjorn3
793c02db7f Remove build_diagnostic_array hack 2017-09-23 15:10:00 +02:00
bjorn3
43bfd4cd54 Fix some nits 2017-09-23 15:00:49 +02:00
bjorn3
e130ccc54e Fix for upstream changes 2017-09-23 14:46:15 +02:00
Guillaume Gomez
e30abfbfe7 Fix warning position in rustdoc code blocks 2017-09-23 14:06:35 +02:00
Niko Matsakis
21d4ba2ea6 add some comments 2017-09-23 13:16:21 +02:00
bjorn3
d703552325 Merge rustc_trans_trait into rustc_trans_utils 2017-09-23 13:00:28 +02:00
bjorn3
9eeaba18bd Move NoLlvmMetadataLoader to rustc_trans_traits 2017-09-23 13:00:25 +02:00
bjorn3
44c184382f Add TransCrate trait 2017-09-23 12:59:46 +02:00
bjorn3
89af6d5c8b [WIP] Less hacky way of supporting dylibs 2017-09-23 12:58:19 +02:00
bjorn3
d935a8d6af Fix rustc_trans_utils::find_exported_symbols
Fix denied warnings
2017-09-23 12:57:42 +02:00
bors
7f8aef94cd Auto merge of #44747 - Zoxc:gen-switch-unreachable, r=eddyb
Make the fallback of generator resumption be unreachable instead of using return
2017-09-23 10:56:14 +00:00
bjorn3
2c03c57bf5 Dont do no-trans for llvm enabled builds 2017-09-23 12:55:34 +02:00
bjorn3
d44a256157 Allow building stage 2 compiler libraries 2017-09-23 12:55:32 +02:00
bjorn3
cba53f0be5 Allow writing metadata without llvm 2017-09-23 12:54:53 +02:00
Thomas Karpiniec
def660cad5 UI unit test for note when matching tuple enum with struct pattern 2017-09-23 20:49:28 +10:00
Keith Yeung
1797a942b7 Add span label to E0381 for MIR borrowck 2017-09-23 03:11:05 -07:00
bors
a6a7dac5cf Auto merge of #44633 - petrochenkov:priv2, r=nikomatsakis
Record semantic types for all syntactic types in bodies

... and use recorded types in type privacy checking (types are recorded after inference, so there are no `_`s left).
Also use `hir_ty_to_ty` for types in signatures in type privacy checking.

This could also be potentially useful for save-analysis and diagnostics.

Fixes https://github.com/rust-lang/rust/pull/42125#issuecomment-305987755
r? @eddyb
2017-09-23 07:30:03 +00:00
Thomas Karpiniec
8a66362430 Diagnostic note when matching tuple enum with struct pattern 2017-09-23 16:04:03 +10:00
bors
85a5d3ffa4 Auto merge of #44784 - frewsxcv:rollup, r=frewsxcv
Rollup of 14 pull requests

- Successful merges: #44554, #44648, #44658, #44712, #44717, #44726, #44745, #44746, #44749, #44759, #44770, #44773, #44776, #44778
- Failed merges:
2017-09-23 05:10:53 +00:00
Corey Farwell
2aa42ef233 Rollup merge of #44778 - lucasem:master, r=estebank
std::sync::RwLock docs improvement

Addresses the `RwLock` part of #29377.
r? @steveklabnik

Added examples, links to types, and a small comparison between RwLock and Mutex.
2017-09-23 00:29:23 -04:00
Corey Farwell
bbd8ac59fa Rollup merge of #44776 - spastorino:add_forge, r=nikomatsakis
Link to Rust forge from CONTRIBUTING.md
2017-09-23 00:29:22 -04:00
Corey Farwell
e168896fdd Rollup merge of #44773 - GuillaumeGomez:arc-docs, r=@QuietMisdreavus
Add missing links for Arc

r? @rust-lang/docs
2017-09-23 00:29:21 -04:00
Corey Farwell
21c0dfce97 Rollup merge of #44770 - dtolnay:borrowed, r=sfackler
Less confusing placeholder when RefCell is exclusively borrowed

Based on ExpHP's comment in [*RefCell.borrow_mut get strange result*](https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994):

> it would perhaps be nicer if it didn't put something that could be misinterpreted as a valid string value

The previous Debug implementation would show:

    RefCell { value: "<borrowed>" }

The new one is:

    RefCell { value: <borrowed> }
2017-09-23 00:29:20 -04:00