about summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2020-09-16Rollup merge of #75026 - JulianKnodt:array_windows, r=AmanieuTyler Mandry-6/+6
Add array_windows fn This mimicks the functionality added by array_chunks, and implements a const-generic form of `windows`. It makes egregious use of `unsafe`, but by necessity because the array must be re-interpreted as a slice of arrays, and unlike array_chunks this cannot be done by casting the original array once, since each time the index is advanced it needs to move one element, not `N`. I'm planning on adding more tests, but this should be good enough as a premise for the functionality. Notably: should there be more functions overwritten for the iterator implementation/in general? ~~I've marked the issue as #74985 as there is no corresponding exact issue for `array_windows`, but it's based of off `array_chunks`.~~ Edit: See Issue #75027 created by @lcnr for tracking issue ~~Do not merge until I add more tests, please.~~ r? @lcnr
2020-09-16Add array window fnkadmin-6/+6
Updated issue to #75027 Update to rm oob access And hopefully fix docs as well Fixed naming conflict in test Fix test which used 1-indexing Nth starts from 0, woops Fix a bunch of off by 1 errors See https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=757b311987e3fae1ca47122969acda5a Add even more off by 1 errors And also write `next` and `next_back` in terms of `nth` and `nth_back`. Run fmt Fix forgetting to change fn name in test add nth_back test & document unsafe Remove as_ref().unwrap() Documented occurrences of unsafe, noting what invariants are maintained
2020-09-15This commit introduces the following changes:Hameer Abbasi-5/+59
* Change error message for type param in a const expression when using min_const_generics * Change ParamInNonTrivialAnonConst to contain an extra bool used for distinguishing whether the passed-in symbol is a type or a value.
2020-09-14improve const infer errBastian Kauschke-7/+7
2020-09-14shrink const infer errorBastian Kauschke-4/+48
2020-09-13bless testsBastian Kauschke-4/+8
2020-09-13review, improve note spanBastian Kauschke-12/+6
2020-09-13allow concrete self types in constsBastian Kauschke-0/+90
2020-09-12Rollup merge of #76599 - hameerabbasi:const-generics-revs, r=lcnrRalf Jung-11/+53
Finish off revisions for const generics UI tests. This time it really does fix it. 😅 The only ones left are `min-and-full-same-time.rs`, which doesn't need it, and `array-impls/` which check the feature indirectly. Fixes #75279. r? @lcnr
2020-09-11Add revisions to const generic type-dependent UI tests.Hameer Abbasi-2/+3
2020-09-11Add revisions to const generic const_evaluatable_checked tests.Hameer Abbasi-9/+50
2020-09-11Auto merge of #75611 - JulianKnodt:cg_enum_err, r=lcnrbors-0/+138
Add help note when using type in place of const This adds a small help note when it might be possible that wrapping a parameter in braces might resolve the issue of having a type where a const was expected. Currently, I am displaying the `HirId`, and I'm not particularly sure where to get the currently displayed path(?). r? `@lcnr`
2020-09-10Rollup merge of #76559 - lcnr:const-evaluatable, r=oli-obkTyler Mandry-0/+59
add the `const_evaluatable_checked` feature Implements a rather small subset of https://github.com/rust-lang/compiler-team/issues/340 Unlike the MCP, this does not try to compare different constant, but instead only adds the constants found in where clauses to the predicates of a function. This PR adds the feature gate `const_evaluatable_checked`, without which nothing should change. r? @oli-obk @eddyb
2020-09-10fix tidy, small cleanupBastian Kauschke-0/+24
2020-09-10Add revisions to const generic UI tests.Hameer Abbasi-4/+25
2020-09-10Add revisions to const generic default UI tests.Hameer Abbasi-13/+64
2020-09-10Respond to review comments.Hameer Abbasi-74/+7
2020-09-10implement `const_evaluatable_checked` feature MVPBastian Kauschke-0/+35
2020-09-09Add revisions to const generic issue UI tests.Hameer Abbasi-149/+467
2020-09-09Rollup merge of #76401 - JulianKnodt:i68366, r=lcnrDylan DPC-0/+39
Add help note to unconstrained const parameter Resolves #68366, since it is currently intended behaviour. If demonstrating `T -> U` is injective, there should be an additional word that it is not **yet** supported. r? @lcnr
2020-09-07Add regression test and help notekadmin-0/+39
2020-09-07Rollup merge of #76293 - Amjad50:incompatible_features_error, r=lcnrDylan DPC-0/+20
Implementation of incompatible features error Proposal of a new error: Incompatible features This error should happen if two features which are not compatible are used together. For now the only incompatible features are `const_generics` and `min_const_generics` fixes #76280
2020-09-04Implementation of incompatible features errorAmjad Alsharafi-0/+20
If two features are defined as incompatible, using them together would result in an error
2020-09-03Add further tests and liberalize type checkingkadmin-17/+108
2020-09-03Update to use multipart suggestionkadmin-3/+4
Nice.
2020-09-03Initial commitkadmin-0/+46
2020-09-02pretty: trim paths of unique symbolsDan Aloni-34/+34
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-31Fix duplicate error messages in const_generics testsAmjad Alsharafi-64/+42
2020-08-26Fixed file formatting and made `tidy` happyAmjad Alsharafi-5/+8
2020-08-26Added more min_const_generics revisions to testsAmjad Alsharafi-157/+224
2020-08-26Added a lot of min_const_generics revisionsAmjad Alsharafi-236/+575
2020-08-18change const param ty warning messageBastian Kauschke-77/+57
2020-08-18run wfcheck in parralel again, add test for 74950Bastian Kauschke-11/+73
2020-08-18move const param structural match checks to wfcheckBastian Kauschke-311/+40
2020-08-13Auto merge of #75322 - JulianKnodt:revisions, r=lcnrbors-853/+1325
Add a bunch of const-generic revisions for `min_const_generics` This adds a bunch of revisions to `const-generic` tests which is part of #75279, but doesn't cover everything. r? @lcnr
2020-08-12Flip order of const & typekadmin-1/+1
2020-08-12Update stderr fileskadmin-960/+85
And also fix some comments as suggested by lcnr
2020-08-12Add missing tests in root const-gen dirkadmin-102/+1182
2020-08-12Add a bunch of revisionskadmin-38/+305
This adds a bunch of revisions to const-generic tests
2020-08-11Rollup merge of #75359 - lcnr:unused-delims-trim, r=oli-obkYuki Okushi-1/+1
unused_delims: trim expr improves rustfix output.
2020-08-10Auto merge of #74005 - estebank:type-ascription-redux, r=petrochenkovbors-4/+1
Clean up errors in typeck and resolve * Tweak ordering of suggestions * Do not suggest similarly named enclosing item * Point at item definition in foreign crates * Add missing primary label CC #34255.
2020-08-10Do not suggest similarly named enclosing itemEsteban Küber-4/+1
2020-08-10unused_delims: trim exprBastian Kauschke-1/+1
2020-08-10Convert `Eq` impl to check Ord::Equalkadmin-1/+1
2020-08-09Change Ord impl for ParamKindOrdkadmin-46/+47
Updated tests and error msgs Update stderr from test Update w/ lcnr comments Change some tests around, and also updated Ord implementation for ParamKindOrd Update w/ nits from lcnr
2020-08-09Test lifetimes after types after consts forbiddenkadmin-4/+41
Added more complex test and changed error message
2020-08-09Added +1 test for only works w/ feat const genkadmin-1/+54
Added this test to ensure that reordering the parameters only works with the feature const generics enabled. Fixed nits Also added another test to verify that intermixed lifetimes are forbidden
2020-08-08Rm restriction on ord of default types w/ constskadmin-37/+18
2020-08-08Auto merge of #74877 - lcnr:min_const_generics, r=oli-obkbors-58/+313
Implement the `min_const_generics` feature gate Implements both https://github.com/rust-lang/lang-team/issues/37 and https://github.com/rust-lang/compiler-team/issues/332. Adds the new feature gate `#![feature(min_const_generics)]`. This feature gate adds the following limitations to using const generics: - generic parameters must only be used in types if they are trivial. (either `N` or `{ N }`) - generic parameters must be either integers, `bool` or `char`. We do allow arbitrary expressions in associated consts though, meaning that the following is allowed, even if `<[u8; 0] as Foo>::ASSOC` is not const evaluatable. ```rust trait Foo { const ASSOC: usize; } impl<const N: usize> Foo for [u8; N] { const ASSOC: usize = 64 / N; } ``` r? @varkor cc @eddyb @withoutboats
2020-08-07test min_const_generics using revisionsBastian Kauschke-52/+154