Commit graph

94272 commits

Author SHA1 Message Date
bors
dc7c4aa804 Auto merge of #61467 - Manishearth:clippyup, r=Manishearth
Update clippy

r? @ghost
2019-06-04 02:42:13 +00:00
Manish Goregaokar
8704947ad2 Update clippy 2019-06-03 16:00:38 -07:00
bors
e22b7a3eef Auto merge of #59148 - lcnr:unchecked_maths, r=eddyb
add support for unchecked math

add compiler support for
```rust
/// Returns the result of an unchecked addition, resulting in
/// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`.
pub fn unchecked_add<T>(x: T, y: T) -> T;

/// Returns the result of an unchecked substraction, resulting in
/// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`.
pub fn unchecked_sub<T>(x: T, y: T) -> T;

/// Returns the result of an unchecked multiplication, resulting in
/// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`.
pub fn unchecked_mul<T>(x: T, y: T) -> T;
```

cc https://github.com/rust-lang/rfcs/issues/2508
2019-06-03 22:05:55 +00:00
lcnr/Bastian Kauschke
d7e0834c5f add ui tests for unchecked math 2019-06-03 21:30:25 +02:00
bors
6ffb8f53ee Auto merge of #61100 - varkor:must_use-tuple-expr, r=cramertj
Apply #[must_use] lint to components of tuples

Fixes https://github.com/rust-lang/rust/issues/61061.
2019-06-03 19:12:17 +00:00
varkor
de2bf3a761 Add nested must_use variant 2019-06-03 18:50:32 +01:00
varkor
81fa794af9 Specify tuple element in lint message 2019-06-03 18:19:29 +01:00
varkor
058551c4fd Add function call to test 2019-06-03 18:19:29 +01:00
varkor
3c768ade4d Fix issue with recursively encountering uninhabited type 2019-06-03 18:19:29 +01:00
varkor
e121d9671a Use precise span for must_use tuple components 2019-06-03 18:19:29 +01:00
varkor
fd36b5fd52 Add test for #[must_use] in tuples 2019-06-03 18:19:29 +01:00
varkor
bbac81a0f1 Warn for #[must_use] in tuples 2019-06-03 18:19:29 +01:00
bors
61d286e9d0 Auto merge of #59033 - GuillaumeGomez:duplicated-bounds, r=Dylan-DPC
Fix duplicated bounds printing in rustdoc

Fixes #56331.

Once again, I couldn't find out how to reproduce it with a small code so no test... :-/

r? @QuietMisdreavus
2019-06-03 14:02:15 +00:00
bors
7096ff0ce1 Auto merge of #57214 - Zoxc:no-local-interners, r=eddyb
Store CtxtInterners for local values in AllArenas

r? @eddyb
2019-06-03 11:10:45 +00:00
lcnr/Bastian Kauschke
8a25fdb409 add codegen test for unchecked math 2019-06-03 13:00:44 +02:00
lcnr/Bastian Kauschke
4e7319cd3f add unchecked math intrinsics 2019-06-03 12:59:48 +02:00
lcnr/Bastian Kauschke
d6266a7666 add support for unchecked math 2019-06-03 12:59:17 +02:00
bors
da9ebc828c Auto merge of #61062 - mark-i-m:mono-mv, r=eddyb,oli-obk
Remove _all_ codegen dependencies on `rustc_mir` 🎉

~This code is pretty self-contained. It has no references to the rest of `rustc_mir`. Moving it to its own crate means that almost all of the references from `rustc_codegen_*` to `rustc_mir` are instead moved to `rustc_monomorphize`, which should help improve compile times for the compiler a bit...~

With the help of eddyb and oli-obk, all of the dependencies of `librustc_codegen_*` on `librustc_mir` have been removed:
- dependencies on `rustc_mir::monomorphize` were moved to `rustc::mir::mono`
- `rustc_mir::const_eval::const_field` is made into a query.
- `rustc_mir::interpret::type_name` is made into a query.

This should help reduce compile time when working on `rustc_mir` 🕐

cc #47849

r? @eddyb
2019-06-03 08:28:27 +00:00
bors
c57ed9d947 Auto merge of #61331 - estebank:fn-arg-parse-recovery, r=varkor
Recover gracefully from argument with missing type or param name
2019-06-03 05:40:53 +00:00
Mark Mansi
0f822d775f query-fy type_name 2019-06-02 23:20:36 -05:00
Mark Mansi
b7f5eab11c remove last dependency of codegen on rustc_mir 2019-06-02 23:04:17 -05:00
Mark Mansi
74919df3a9 query-ify const_field 2019-06-02 23:03:58 -05:00
Mark Mansi
c747f31ffc remove unneeded deps 2019-06-02 22:56:37 -05:00
Mark Mansi
b20d96f97f remove as_mono_item 2019-06-02 22:55:29 -05:00
Mark Mansi
e21d002bd2 move codegenunitext to rustc::mir::mono 2019-06-02 22:55:29 -05:00
Mark Mansi
621bf0da80 move monoitemext to inherent methods 2019-06-02 22:55:29 -05:00
Mark Mansi
f2b9b2d13b move DefPathBasedNames to ty::print::obsolete 2019-06-02 22:50:03 -05:00
Mark Mansi
3287ddf937 remove reexports of mir::mono::{MonoItem,CodegenUnit} 2019-06-02 22:50:03 -05:00
Mark Mansi
5940689553 move single-use function 2019-06-02 22:44:51 -05:00
Mark Mansi
58bd0ea732 deduplicate ty::Instance constructors 2019-06-02 22:44:51 -05:00
Mark Mansi
8af151b30a remove reexport of rustc::ty::Instance 2019-06-02 22:32:42 -05:00
bors
d59dcb261e Auto merge of #61361 - estebank:infer-type, r=varkor
Add more detail to type inference error

When encountering code where type inference fails, add more actionable
information:

```
fn main() {
    let foo = Vec::new();
}
```

```
error[E0282]: type annotations needed in `std::vec::Vec<T>`
  --> $DIR/vector-no-ann.rs:2:16
   |
LL |     let foo = Vec::new();
   |         ---   ^^^^^^^^ cannot infer type for `T` in `std::vec::Vec<T>`
   |         |
   |         consider giving `foo` a type
```

Fix #25633.
2019-06-03 02:45:35 +00:00
bors
3a6bef0cbd Auto merge of #61008 - GuillaumeGomez:fix-rustdoc-code-highlighting, r=Manishearth
Fix lines highlighting in rustdoc source view

Fixes #60948.

This PR fixes how we handle the lines highlighting from the URL (so in "/doc/src/alloc/string.rs.html#285-283", the "285-283" part). We got a hard limit on 50000, for some unknown and lost reasons which was used in case only one line is selected.

r? @Manishearth
2019-06-03 00:02:34 +00:00
bors
607aadcb77 Auto merge of #61295 - RalfJung:miri, r=oli-obk
update miri

r? @oli-obk

Fixes https://github.com/rust-lang/rust/issues/60533
2019-06-02 21:15:35 +00:00
Ralf Jung
4dfed4a0ca update miri 2019-06-02 23:12:40 +02:00
bors
627486af15 Auto merge of #61278 - RalfJung:miri-tag-allocations, r=oli-obk
Miri: give machine the chance to tag all allocations

r? @oli-obk

The Miri side of this is at https://github.com/rust-lang/rust/pull/61278.
2019-06-02 17:25:58 +00:00
bors
d461555e44 Auto merge of #61460 - Centril:rollup-8txhjx4, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #61380 (Fix some issues with `unwrap_usize` instead of `assert_usize`)
 - #61423 (codegen: change `$6d$` to `$u6d$`)
 - #61438 (Point at individual type args on arg count mismatch)
 - #61441 (Tweak wording when encountering `fn` call in pattern)
 - #61451 (Fix missing semicolon in doc)
 - #61458 (Fix typo in AsRef doc)

Failed merges:

r? @ghost
2019-06-02 14:42:11 +00:00
Mazdak Farrokhzad
aaf264b999
Rollup merge of #61458 - fabric-and-ink:doc-typo, r=jonas-schievink
Fix typo in AsRef doc
2019-06-02 15:23:53 +02:00
Mazdak Farrokhzad
d70f2881fc
Rollup merge of #61451 - 0x1793d1:master, r=Centril
Fix missing semicolon in doc

A semicolon is missing in the examples of compile_error.
Macros that expand to items must be delimited with braces or followed by a semicolon.
2019-06-02 15:23:52 +02:00
Mazdak Farrokhzad
247e0a688d
Rollup merge of #61441 - estebank:fn-call-in-match, r=varkor
Tweak wording when encountering `fn` call in pattern

Fix #60642
2019-06-02 15:23:50 +02:00
Mazdak Farrokhzad
83b74f2aad
Rollup merge of #61438 - estebank:generics-span, r=varkor
Point at individual type args on arg count mismatch

- Point at individual type arguments on arg count mismatch
- Make generics always have a valid span, even when there are no args
- Explain that `impl Trait` introduces an implicit type argument

Fix #55991.
2019-06-02 15:23:49 +02:00
Mazdak Farrokhzad
5599985caa
Rollup merge of #61423 - davidtwco:correct-symbol-mangling, r=eddyb
codegen: change `$6d$` to `$u6d$`

This changes a mistake introduced in #61195 where the mangling
workaround used was incorrect, resolving [this comment](https://github.com/rust-lang/rust/pull/61195#discussion_r289597707) from @eddyb.

r? @eddyb
2019-06-02 15:23:47 +02:00
Mazdak Farrokhzad
c748c7b3fe
Rollup merge of #61380 - varkor:expected-usize-got-param, r=eddyb
Fix some issues with `unwrap_usize` instead of `assert_usize`

Fixes https://github.com/rust-lang/rust/issues/61337.
Fixes https://github.com/rust-lang/rust/issues/61341.
Fixes https://github.com/rust-lang/rust/issues/61422.

r? @eddyb
2019-06-02 15:23:46 +02:00
Fabian Drinck
9583398923 Fix typo in AsRef doc 2019-06-02 14:12:06 +02:00
bors
4c7bb8b0d9 Auto merge of #61276 - eddyb:kill-res-upvar, r=petrochenkov
rustc: remove Res::Upvar.

By keeping track of the current "`body_owner`" (the `DefId` of the current fn/closure/const/etc.) in several passes, `Res::Upvar` and `hir::Upvar` don't need to contain contextual information about the closure.

By leveraging [`indexmap`](https://docs.rs/indexmap), the list of upvars for a given closure can now also be queried, to check whether a local variable is a closure capture, and so `Res::Upvar` can be merged with `Res::Local`.

And finally, the `tcx.upvars(...)` query now collects upvars from HIR, without relying on `rustc_resolve`.

r? @petrochenkov cc @varkor @davidtwco
2019-06-02 11:46:13 +00:00
Ralf Jung
823ffaa834 update comments 2019-06-02 10:36:18 +02:00
Ralf Jung
2ba7e776b6 FIXME 2019-06-02 10:36:18 +02:00
Ralf Jung
222ed9f571 fix indentation 2019-06-02 10:36:18 +02:00
Ralf Jung
0f96dd51c5 turn comments into doc-comments 2019-06-02 10:36:18 +02:00
Ralf Jung
6dd9389008 fix comments 2019-06-02 10:36:18 +02:00