Commit Graph

205 Commits

Author SHA1 Message Date
ben
925e3042f6 Fix resolve_type_vars_with_obligations not resolving const inference
variables.
2019-10-20 09:16:52 +13:00
Guillaume Gomez
7d357fbffd update ui tests 2019-10-16 13:56:14 +02:00
Tyler Mandry
a14e35f382 Rollup merge of #65398 - estebank:capitalization-only, r=varkor
Bring attention to suggestions when the only difference is capitalization

CC #65386.
2019-10-14 17:52:41 -07:00
ben
eb68bbb2b0 Include const generic arguments in metadata. 2019-10-15 07:24:19 +13:00
Esteban Küber
4bb771615e Bring attention to suggestions when the only difference is capitalization 2019-10-13 21:48:39 -07:00
Tyler Mandry
728adc446c Rollup merge of #65191 - varkor:const-generics-test-cases, r=nikomatsakis
Add some regression tests

- Add a test for #62187.
- Clean up the directory structure in `src/test/ui/const-generics`
- Closes #64792.
- Closes #57399.
- Closes #57271.
2019-10-11 15:09:45 -07:00
ben
89cc0467a2 Pretty print raw pointers in consts as '{pointer}'. 2019-10-10 08:11:31 +13:00
ben
5986fe24bd Update ui tests 2019-10-09 06:58:39 +13:00
ben
9677cbe82e Refactor pretty print const to use a big match statement 2019-10-09 05:10:00 +13:00
ben
cf3b561cea Gate use of raw and function pointers in const generics behind
const_compare_raw_pointers.
2019-10-09 05:10:00 +13:00
ben
a59eb6d554 Pretty print function pointer const values. 2019-10-09 05:10:00 +13:00
ben
2afd277bc3 Fix calling function pointer const parameters. Also fixes inference of
function pointer const parameters.
2019-10-09 05:10:00 +13:00
varkor
5e65e2bec2 Add a regression test for issue 62187 2019-10-07 22:01:58 +01:00
varkor
70c14dd9dd Move const generic regression tests to their old folder 2019-10-07 21:55:35 +01:00
ben
74eac929c2 Test diagnostic output of type mismatches for types that have const
generics arguments.
2019-10-07 20:39:08 +13:00
ben
5880ce3968 Fix const arguments not displaying in types mismatch diagnostic. 2019-10-06 19:56:05 +13:00
Ben Boeckel
126bf3b1dd typo: fix typo in E0392
See #64931.
2019-10-03 09:22:29 -04:00
Mazdak Farrokhzad
17b1fd1a8f Rollup merge of #64931 - estebank:missing-param-ref, r=matthewjasper,Centril
Reword E0392 slightly

Make it clearer that a type or lifetime argument not being used can be
fixed by referencing it in a struct's fields, not just using `PhathomData`.

CC #53589.
2019-10-03 04:08:12 +02:00
Esteban Küber
a180294f8b review comment 2019-10-02 14:34:29 -07:00
Esteban Küber
5cbe6aa6ca Reword E0392 slightly
Make it clearer that a type or lifetime argument not being used can be
fixed by referencing it in a struct's fields, not just using `PhathomData`.
2019-09-30 13:35:26 -07:00
ben
54bad93030 Add a couple more test cases, including non-ascii strings. 2019-09-29 08:39:48 +13:00
ben
5cb0039cff Added test for mismatched slices, and byte slices. 2019-09-28 15:07:22 +12:00
ben
22b87a5515 Add support for relating slices in super_relate_consts. 2019-09-28 10:05:37 +12:00
Mazdak Farrokhzad
78d715fe14 Rollup merge of #64679 - skinny121:const-infer, r=varkor
Infer consts more consistently

Moved some duplicated logic in `TypeRelation` methods into `super_combined_consts`. Before some `TypeRelation`s like `Lub` wasn't using `replace_if_possible`, meaning some inference types were staying around longer than they should be.

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

r? @varkor
2019-09-23 00:36:40 +02:00
ben
3f2855e4a6 Infer consts consistently. Moved some logic into super_combined_consts,
also removed some duplicated logic from TypeRelation methods.
2019-09-22 17:24:09 +12:00
Esteban Küber
02e3fb89a7 When possible point at argument causing item obligation failure 2019-09-19 12:10:23 -07:00
bors
a5e3de3437 Auto merge of #64360 - varkor:foreign-items-diagnostic-const-generics, r=cramertj
Correct the polymorphic extern fn error for const parameters

Before, any polymorphism on extern functions was assumed to be type polymorphism.
2019-09-12 21:20:06 +00:00
varkor
ef62e05062 Make wording less confusing 2019-09-11 00:29:35 +01:00
varkor
14e6947fa4 Correct the polymorphic extern fn error for const parameters 2019-09-10 22:30:46 +01:00
bors
824383d4ab Auto merge of #64237 - estebank:tweak-method-not-found, r=Centril
Give method not found a primary span label
2019-09-09 08:39:59 +00:00
Esteban Küber
5799fb419c Give method not found a primary span label 2019-09-08 18:27:02 -07:00
Mark Rousskov
6fdbece55f Update test stderr with results of enabling unused lints 2019-09-08 11:32:28 -04:00
Eduard-Mihai Burtescu
96fc98904f test: add test for #61432. 2019-08-19 19:33:49 +03:00
Jake Goulding
32324d22c3 Add implementations for converting boxed slices into boxed arrays
This mirrors the implementations of reference slices into arrays.
2019-08-05 10:26:53 -04:00
Mazdak Farrokhzad
24a178e397 --bless tests due to INCOMPLETE_FEATURES being a lint. 2019-07-30 10:43:32 +02:00
Mazdak Farrokhzad
bfdfa85e73 Add tests for Vec(Deque) array PartialEq impls. 2019-07-28 06:46:41 +02:00
bors
a3369981de Auto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddyb
rustc/rustc_mir: Implement RFC 2203.

This PR implements RFC 2203, allowing constants in array repeat
expressions. Part of #49147.

r? @eddyb
2019-07-18 20:41:40 +00:00
Samy Kacimi
41e71b0c93 normalize use of backticks in compiler messages for libsyntax/feature_gate
https://github.com/rust-lang/rust/issues/60532
2019-07-09 14:13:28 +02:00
David Wood
485a80255b rustc/rustc_mir: Implement RFC 2203.
This commit implements RFC 2203, allowing constants in array repeat
expressions.

Firstly, the check that the array repeat expression implements `Copy` is
removed and re-implemented in `rustc_mir::borrow_check::nll::type_check`
by emitting an error when the MIR contains a `Operand::Move` and the
type does not implement `Copy`.

Next, the `qualify_consts` pass is modified to construct a
`Candidate::Repeat` when it would be correct to promote a array repeat
expression.

Finally, the `promote_consts` pass is modified to promote the candidates
previously identified.
2019-07-07 19:51:09 +01:00
Scott McMurray
d6a9793722 Use const generics for array impls, restricted to 0..=32
- uses a never-stable core::array::LengthAtMost32 to bound the impls
- includes a custom error message to avoid mentioning LengthAtMost32 too often
- doesn't use macros for the slice implementations to avoid #62433
2019-07-07 11:31:38 -07:00
Mark Rousskov
007d87f171 Permit use of mem::uninitialized via allow(deprecated) 2019-07-04 21:01:35 -04:00
Yuki Okushi
c004451a20 Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
David Wood
bc36aabf5f typeck: Fix ICE for blocks in repeat expr count.
This commit extends the work in #61698 to get the `DefId` of const
parameters from block that resolve to a const parameter (as well as
const parameters directly, as it was previously).
2019-06-13 23:34:38 +01:00
Mazdak Farrokhzad
bd57c187fb Rollup merge of #61698 - davidtwco:ice-const-generic-length, r=varkor
typeck: Fix const generic in repeat param ICE.

Fixes #61336. Turns out this wasn't related to #49147 after all.

r? @varkor
2019-06-11 17:14:04 +02:00
David Wood
9ed4674269 typeck: Fix const generic in repeat param ICE.
This commit fixes an ICE that occured when a const generic was used in
a repeat expression. This was due to the code expecting the length of
the repeat expression to be const evaluatable to a constant, but a const
generic parameter is not (however, it can be made into a constant).
2019-06-10 16:58:47 +01:00
varkor
7bb0a16ad7 Add test for deriving Debug for const generics 2019-06-07 10:18:19 +01:00
varkor
647b4a4deb Add test for const generics struct constructor 2019-06-07 10:18:19 +01:00
Mazdak Farrokhzad
1563514196 Rollup merge of #61409 - varkor:condition-trait-param-ice, r=oli-obk
Fix an ICE with a const argument in a trait

This goes some way towards fixing https://github.com/rust-lang/rust/issues/61383 (the reduced test case is fixed).
2019-06-04 04:48:08 +02:00
varkor
2b27c6235b Allow true and false in const generic arguments 2019-06-03 09:59:45 +01: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