Commit Graph

205 Commits

Author SHA1 Message Date
varkor
0f0252260c Add regression test for #61522 2020-04-09 11:53:28 +01:00
varkor
61cc8925b2 Add regression test for #66596 2020-04-09 11:52:52 +01:00
Dylan DPC
8993358e77 Rollup merge of #70081 - lcnr:issue68387, r=varkor
add `unused_braces` lint

Add the lint `unused_braces` which is warn by default.

`unused_parens` is also extended and now checks anon consts.

closes #68387

r? @varkor
2020-04-01 00:27:20 +02:00
Bastian Kauschke
bcf35b1d80 add tests for unused_braces 2020-03-31 19:01:49 +02:00
Bastian Kauschke
698b20eeda update tests 2020-03-31 19:01:49 +02:00
Bastian Kauschke
50ab77384e infer arr len from pattern 2020-03-30 18:13:14 +02:00
bors
4911572b2d Auto merge of #70009 - estebank:sugg-bound, r=Centril
Tweak `suggest_constraining_type_param`

Some of the bound restriction structured suggestions were incorrect while others had subpar output.

The only issue left is a suggestion for an already present bound when dealing with `const`s that should be handled independently.

Fix #69983.
2020-03-29 22:50:59 +00:00
Esteban Küber
2c71894657 Tweak suggest_constraining_type_param
Some of the bound restriction structured suggestions were incorrect
while others had subpar output.
2020-03-29 13:13:17 -07:00
Dodo
61d419314f add a build-pass test for issue 62220 2020-03-29 18:27:54 +02:00
Mazdak Farrokhzad
c51fcb5f38 Rollup merge of #68692 - jyn514:vec-from-array, r=LukasKalbertodt
impl From<[T; N]> for Vec<T>

Closes https://github.com/rust-lang/rust/issues/67963
2020-03-29 11:50:10 +02:00
Vadim Petrochenkov
7332305305 Remove attribute #[structural_match] and any references to it 2020-03-24 22:58:15 +03:00
Mazdak Farrokhzad
d309058101 Rollup merge of #70284 - lcnr:issue70273-what-the-heck-git, r=eddyb
correctly handle const params in type_of

extends #70223, retry of #70276

fixes #70273

r? @eddyb cc @varkor
2020-03-24 07:13:40 +01:00
Mazdak Farrokhzad
7cdab7ff90 Rollup merge of #70283 - CDirkx:regression-test-70155, r=oli-obk
Add regression test for #70155.

With #70166 merged, `RangeInclusive` now derives `PartialEq` and `Eq`, implementing structural equality and as a side effect the range is now usable with const generics, closing #70155.

As per [#70166 (comment)](https://github.com/rust-lang/rust/pull/70166#issuecomment-601872201) a test is added to avoid a change to the private fields or the equality implementation of the range from subtly reverting #70155.
2020-03-24 00:49:50 +01:00
Mazdak Farrokhzad
a73ed5aad9 Rollup merge of #69981 - oli-obk:const_blocks, r=eddyb
Evaluate repeat expression lengths as late as possible

Fixes #68567

r? @varkor
2020-03-24 00:49:39 +01:00
CDirkx
9fdde0a000 Merge tests.
Merge tests to a single test file.
2020-03-23 19:27:13 +01:00
CDirkx
f080f944f1 Add const generics test for all range types.
In addition to the regression test of `RangeInclusive` for #70155, now all range types are checked for usability within const generics:

- `RangeFrom`
- `RangeFull`
- `RangeToInclusive`
- `RangeTo`
- `Range`

The test are moved from `test\ui\const-generics\issues\issue-70155` to `test\ui\const-generics\std\range` in anticipation of future similar tests for std types.
2020-03-23 19:16:12 +01:00
Oliver Scherer
799b15ed96 Evaluate repeat expression lengths as late as possible 2020-03-23 13:14:36 +01:00
Alex Tokarev
b35c30251f Reword unused variable warning 2020-03-23 12:14:45 +03:00
Mazdak Farrokhzad
092c821ef2 Rollup merge of #70249 - lcnr:issue70125, r=eddyb
handle ConstKind::Unresolved after monomorphizing

fixes #70125

r? @bjorn3
2020-03-23 04:26:13 +01:00
Bastian Kauschke
645fedd183 correctly handle const params in type_of 2020-03-22 22:29:54 +01:00
CDirkx
bd1df44057 Add regression test for #70155.
With #70166 merged, `RangeInclusive` now derives `PartialEq` and `Eq`, implementing structural equality and as a side effect the range is now usable with const generics, closing #70155.

A test is added to avoid a change to the private fields or the equality implementation of the range from subtly reverting #70155.
2020-03-22 22:04:05 +01:00
Dylan DPC
3c8f8b6304 Rollup merge of #70223 - lcnr:issue70167, r=eddyb
fix type of const params in associated types.

fixes #66906
fixes #70167

r? @eddyb
2020-03-22 15:48:34 +01:00
Bastian Kauschke
853377817d rename tests 2020-03-22 11:59:01 +01:00
Bastian Kauschke
0c5c3bbdab handle unevaluated consts after monomophize 2020-03-22 11:34:42 +01:00
Bastian Kauschke
a9c2378b7d fix type of const params in associated types. 2020-03-21 13:22:26 +01:00
Dylan DPC
266801d806 Rollup merge of #70032 - lcnr:issue69970, r=varkor
put type params in front of const params in generics_of

fixes #69970

r? @varkor
2020-03-21 13:06:40 +01:00
Bastian Kauschke
6cb584608c sort generic param order in generics_of 2020-03-19 20:20:09 +01:00
bors
dd67187965 Auto merge of #67133 - oli-obk:it_must_be_a_sign, r=eddyb
Deduplicate pretty printing of constants

r? @eddyb for the pretty printing logic
cc @RalfJung
2020-03-16 16:31:23 +00:00
Yuki Okushi
3609bac340 Add test for issue-67739 2020-03-13 16:06:08 +09:00
Yuki Okushi
a2c41e9cdc Add test for issue-62504 2020-03-13 16:06:08 +09:00
Oliver Scherer
6e73a14234 Remove fn special casing in const printing 2020-03-12 13:35:44 +01:00
Oliver Scherer
cc9ca640c2 Don't print literal type suffixes if print_ty is false 2020-03-11 09:10:49 +01:00
Oliver Scherer
fff2e0f806 Print function pointer type for function pointer const generics 2020-03-11 09:10:49 +01:00
Oliver Scherer
b837e71732 Reduce special casing in the const pretty printer 2020-03-11 09:10:49 +01:00
Oliver Scherer
e22ddfd80d Don't print leading zeros on hex dumps constants 2020-03-11 09:10:49 +01:00
Oliver Scherer
02dbb35b2b Deduplicate and clean up pretty printing logic 2020-03-11 09:10:48 +01:00
Joshua Nelson
ba46b61bbc bless UI tests 2020-03-10 23:44:46 +00:00
Joshua Nelson
e3d5eaf2bb add ui-tests 2020-03-10 23:44:46 +00:00
YI
906bb8d0e8 fix #62456 2020-03-10 09:30:24 +08:00
CAD97
b3777c952f Remove chalk integration 2020-03-02 18:11:53 -05:00
Matthew Jasper
ebc86b441d Fix use of has_infer_types
* Add a new method `has_infer_types_or_consts` that's used instead most
  of the time, since there's generally no reason to only consider types.
*  Remove use of `has_closure_types`, because closures are no longer
  implicitly linked to the `InferCtxt`.
2020-03-01 21:42:34 +00:00
varkor
bead79ebc6 Add note regarding argument ordering 2020-02-22 11:34:29 +00:00
varkor
e372ad4800 Expand the documentation for E0747 2020-02-22 11:34:29 +00:00
varkor
039045c49b Move generic arg / param validation to create_substs_for_generic_args 2020-02-22 00:28:18 +00:00
LeSeulArtichaut
2e07892c7d Do not emit note suggesting to implement trait to foreign type
Update tests

Extend to other operations

Refractor check in a separate function

Fix more tests
2020-02-17 15:21:36 +01:00
Mazdak Farrokhzad
3341c94006 ast_validation: tweak diagnostic output 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
e839b2ec84 Constness -> enum Const { Yes(Span), No }
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-13 10:39:23 +01:00
Dylan DPC
2a201336ed Rollup merge of #67642 - Mark-Simulacrum:relax-bounds, r=Amanieu
Relax bounds on HashMap/HashSet

These APIs changed from the old bound listed to the new bound (possibly empty):

K: Hash + Eq -> K
* new
* with_capacity

K: Eq + Hash, S: BuildHasher -> K, S
* with_hasher
* with_capacity_and_hasher
* hasher

K: Eq + Hash + Debug -> K: Debug
S: BuildHasher -> S
HashMap as Debug

K: Eq + Hash -> K
S: BuildHasher + Default -> S: Default
HashMap as Default

Resolves #44777.
2020-02-13 02:52:46 +01:00
bors
dc4242d905 Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPC
Make issue references consistent

Fixes https://github.com/rust-lang/rust/issues/62976

cc https://github.com/rust-lang/rust/pull/63008

r? @varkor because you reviewed the original pr
2020-02-11 02:00:27 +00:00
Matthias Prechtl
7b555178ae --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00