Commit graph

79 commits

Author SHA1 Message Date
Dylan DPC
bcdbe79f0c
Rollup merge of #76994 - yuk1ty:fix-small-typo, r=estebank
fix small typo in docs and comments

Fixed `the the` to `the`, as far as I found.
2020-09-23 14:54:07 +02:00
bors
c113030f6b Auto merge of #76906 - Nicholas-Baron:shorten_typeck_check, r=oli-obk
Split rustc_typeck::check into separate files

Contributing to #60302.
2020-09-22 08:11:07 +00:00
Nicholas-Baron
ccd218d04c Added back the '// ignore-file-length' with an explanation 2020-09-21 09:16:55 -07:00
Ralf Jung
982c4a9c25
Rollup merge of #76835 - matthiaskrgr:replace_prefix, r=lcnr
make replace_prefix only take &str as arguments

included the clippy::manual strip commit to not run into merge conflicts later.

r? @lcnr
2020-09-21 15:30:39 +02:00
yuk1ty
16047d46a1 fix typo in docs and comments 2020-09-21 12:14:28 +09:00
Nicholas-Baron
99e2e7075c Moved all functions prefixed with 'check' to a separate file 2020-09-20 19:00:31 -07:00
Nicholas-Baron
f896ddfc73 Moved the Expectation enum to its own file 2020-09-20 18:58:32 -07:00
Nicholas-Baron
428a8c6eae Moved the Diverges struct to its own file 2020-09-20 18:58:32 -07:00
Nicholas-Baron
b1e9379679 Formatted use statements for fewer lines 2020-09-20 18:58:32 -07:00
Nicholas-Baron
7995d5cda4 Moved Inherited struct to own file 2020-09-20 18:58:30 -07:00
Nicholas-Baron
45fdf97d11 Removed util.rs
Per suggestion of @oli-obk.
This file was rather short and joining it did not cause mod.rs to become
significantly bigger.
2020-09-20 18:56:09 -07:00
Nicholas-Baron
c8162c22eb Moved the FnCtxt struct to its own file 2020-09-20 18:56:01 -07:00
Nicholas-Baron
c190f66060 Moved GatherLocalsVisitor to its own file 2020-09-20 18:48:31 -07:00
Nicholas-Baron
3e770645aa Moved a struct only need by util into util 2020-09-20 18:48:31 -07:00
Nicholas-Baron
6fd80e35e0 Moved another struct and used pub(super) to be explicit 2020-09-20 18:48:31 -07:00
Nicholas-Baron
bfe5bc9cb9 Formatter moved one use statement 2020-09-20 18:48:31 -07:00
Nicholas-Baron
63dbfb3c30 Start of moving some functionality to separate files 2020-09-20 18:48:31 -07:00
bors
0f9f0b384a Auto merge of #76295 - mati865:remove-mmx, r=Amanieu,oli-obk
Remove MMX from Rust

Follow-up to https://github.com/rust-lang/stdarch/pull/890
This removes most of MMX from Rust (tests pass with small changes), keeping stable `is_x86_feature_detected!("mmx")` working.
2020-09-21 00:43:26 +00:00
Ralf Jung
fc58224b79
Rollup merge of #76940 - Aaron1011:fix/trait-on-tait, r=oli-obk
Don't allow implementing trait directly on type-alias-impl-trait

This is specifically disallowed by the RFC, but we never added a check
for it.

Fixes #76202
2020-09-20 15:52:09 +02:00
Ralf Jung
8405d50e12
Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr
use matches!() macro for simple if let conditions
2020-09-20 15:52:01 +02:00
Mateusz Mikuła
5de2c95e6e Remove MMX from Rust 2020-09-20 15:13:11 +02:00
bors
41507ed0d5 Auto merge of #76964 - RalfJung:rollup-ybn06fs, r=RalfJung
Rollup of 15 pull requests

Successful merges:

 - #76722 (Test and fix Send and Sync traits of BTreeMap artefacts)
 - #76766 (Extract some intrinsics out of rustc_codegen_llvm)
 - #76800 (Don't generate bootstrap usage unless it's needed)
 - #76809 (simplfy condition in ItemLowerer::with_trait_impl_ref())
 - #76815 (Fix wording in mir doc)
 - #76818 (Don't compile regex at every function call.)
 - #76821 (Remove redundant nightly features)
 - #76823 (black_box: silence unused_mut warning when building with cfg(miri))
 - #76825 (use `array_windows` instead of `windows` in the compiler)
 - #76827 (fix array_windows docs)
 - #76828 (use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip))
 - #76840 (Move to intra doc links in core/src/future)
 - #76845 (Use intra docs links in core::{ascii, option, str, pattern, hash::map})
 - #76853 (Use intra-doc links in library/core/src/task/wake.rs)
 - #76871 (support panic=abort in Miri)

Failed merges:

r? `@ghost`
2020-09-20 11:02:36 +00:00
Ralf Jung
bfa1904765
Rollup merge of #76828 - matthiaskrgr:clippy_manual_strip, r=lcnr
use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)
2020-09-20 12:08:29 +02:00
bors
5e449b9adf Auto merge of #74949 - oli-obk:validate_const_eval_raw, r=RalfJung
Validate constants during `const_eval_raw`

This PR implements the groundwork for https://github.com/rust-lang/rust/issues/72396

* constants are now validated during `const_eval_raw`
* to prevent cycle errors, we do not validate references to statics anymore beyond the fact that they are not dangling
* the `const_eval` query ICEs if used on `static` items
* as a side effect promoteds are now evaluated to `ConstValue::Scalar` again (since they are just a reference to the actual promoted allocation in most cases).
2020-09-20 08:58:32 +00:00
Aaron Hill
367efa86d5
Don't allow implementing trait directly on type-alias-impl-trait
This is specifically disallowed by the RFC, but we never added a check
for it.

Fixes #76202
2020-09-19 17:10:54 -04:00
Ralf Jung
5631b5d684
Rollup merge of #76749 - guswynn:hir_ranges, r=estebank
give *even better* suggestion when matching a const range

notice that the err already has "constant defined here"
so this is now *exceedingly clear*

extension to #76222

r? @estebank
2020-09-19 11:47:50 +02:00
Oliver Scherer
2d7ac728e4 Stop using the const_eval query for initializers of statics
As a side effect, we now represent most promoteds as `ConstValue::Scalar` again. This is useful because all implict promoteds are just references anyway and most explicit promoteds are numeric arguments to `asm!` or SIMD instructions.
2020-09-19 10:36:36 +02:00
Matthias Krüger
40dddd3305 use matches!() macro for simple if let conditions 2020-09-18 20:28:35 +02:00
Bastian Kauschke
82ebbd7d6b add test for let-bindings 2020-09-18 17:11:34 +02:00
Matthias Krüger
026922ad60 make replace_prefix only take &str as arguments
https://github.com/rust-lang/rust/pull/76828#issuecomment-694078200
2020-09-17 13:12:04 +02:00
Matthias Krüger
012974da7a use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip) 2020-09-17 10:13:16 +02:00
bors
95386b656e Auto merge of #76028 - aticu:improve_e0118, r=estebank,jyn514,GuillaumeGomez
Improve E0118

- Changes the "base type" terminology to "nominal type" (according to the [reference](https://doc.rust-lang.org/stable/reference/items/implementations.html#inherent-implementations)).
- Suggests removing a reference, if one is present on the type.
- Clarify what is meant by a "nominal type".

closes #69392

This is my first not-entirely-trivial PR, so please let me know if I missed anything or if something could be improved. Though I probably won't be able to fix anything in the upcoming week.
2020-09-17 03:56:38 +00:00
Gus Wynn
230355f25f comments and factor to own method 2020-09-16 12:32:10 -07:00
Tyler Mandry
a6c4d30c7b
Rollup merge of #76756 - matthiaskrgr:cl123ppy, r=Dylan-DPC
fix a couple of stylistic clippy warnings

namely:

clippy::redundant_pattern_matching
clippy::redundant_pattern
clippy::search_is_some
clippy::filter_next
clippy::into_iter_on_ref
clippy::clone_on_copy
clippy::needless_return
2020-09-16 12:24:17 -07:00
Gus Wynn
1d93048324 give better suggestion when matching a const range 2020-09-16 10:13:11 -07:00
Dylan DPC
fa4cfeb597
Rollup merge of #75304 - Aaron1011:feature/diag-deref-move-out, r=estebank
Note when a a move/borrow error is caused by a deref coercion

Fixes #73268

When a deref coercion occurs, we may end up with a move error if the
base value has been partially moved out of. However, we do not indicate
anywhere that a deref coercion is occuring, resulting in an error
message with a confusing span.

This PR adds an explicit note to move errors when a deref coercion is
involved. We mention the name of the type that the deref-coercion
resolved to, as well as the `Deref::Target` associated type being used.
2020-09-16 01:30:32 +02:00
Matthias Krüger
73d4171ea6 fix a couple of stylistic clippy warnings
namely:

clippy::redundant_pattern_matching
clippy::redundant_pattern
clippy::search_is_some
clippy::filter_next
clippy::into_iter_on_ref
clippy::clone_on_copy
clippy::needless_return
2020-09-15 22:44:54 +02:00
bors
255ceeb5ff Auto merge of #76612 - estebank:pat-missing-fields-suggestion, r=davidtwco
Provide suggestion for missing fields in patterns
2020-09-15 00:17:13 +00:00
bors
9b4154193e Auto merge of #76541 - matthiaskrgr:unstable_sort, r=davidtwco
use sort_unstable to sort primitive types

It's not important to retain original order if we have &[1, 1, 2, 3] for example.

clippy::stable_sort_primitive
2020-09-14 21:43:17 +00:00
bors
41dc3942eb Auto merge of #75608 - estebank:suggest-boxed-match-exprs, r=lcnr,varkor
More structured suggestions for boxed trait objects instead of impl Trait on non-coerceable tail expressions

When encountering a `match` or `if` as a tail expression where the
different arms do not have the same type *and* the return type of that
`fn` is an `impl Trait`, check whether those arms can implement `Trait`
and if so, suggest using boxed trait objects.

Use structured suggestion for `impl T` to `Box<dyn T>`.

Fix https://github.com/rust-lang/rust/issues/69107
2020-09-14 19:57:57 +00:00
Esteban Küber
c6f2ddf1cb Fix rebase and add comments 2020-09-14 12:51:25 -07:00
Bastian Kauschke
c552717e9d review, improve note span 2020-09-13 22:53:51 +02:00
Bastian Kauschke
e5b82a56c5 allow concrete self types in consts 2020-09-13 22:53:51 +02:00
bors
7402a39447 Auto merge of #76244 - vandenheuvel:remove__paramenv__def_id, r=nikomatsakis
Removing the `def_id` field from hot `ParamEnv` to make it smaller

This PR addresses https://github.com/rust-lang/rust/issues/74865.
2020-09-13 16:28:22 +00:00
bors
dbb73f8f79 Auto merge of #73461 - calebzulawski:validate-attribute-placement, r=matthewjasper
Validate built-in attribute placement

Closes #54584, closes #47725, closes #54044.

I've changed silently ignoring some incorrectly placed attributes to errors.  I'm not sure what the policy is since this can theoretically break code (should they be warnings instead? does it warrant a crater run?).
2020-09-12 22:04:37 +00:00
Esteban Küber
dc53cfea7e Add test cases and address review comments 2020-09-11 17:05:18 -07:00
Esteban Küber
5d2a935e6c Make suggestion more complete 2020-09-11 17:05:18 -07:00
Esteban Küber
ff297fafbf Make suggestion have a more targetted underline 2020-09-11 17:05:18 -07:00
Esteban Küber
fd9133b9c3 Suggest boxed trait objects in tail match and if expressions
When encountering a `match` or `if` as a tail expression where the
different arms do not have the same type *and* the return type of that
`fn` is an `impl Trait`, check whether those arms can implement `Trait`
and if so, suggest using boxed trait objects.
2020-09-11 17:05:18 -07:00
Esteban Küber
c8ee33714b Use structured suggestion for impl T to Box<dyn T> 2020-09-11 17:05:18 -07:00