about summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2021-05-13Auto merge of #85041 - mibac138:suggest-generics, r=estebankbors-2/+20
Suggest adding a type parameter for impls Add a new suggestion upon encountering an unknown type in a `impl` that suggests adding a new type parameter. This diagnostic suggests to add a new type parameter even though it may be a const parameter, however after adding the parameter and running rustc again a follow up error steers the user to change the type parameter to a const parameter. ```rust struct X<const C: ()>(); impl X<C> {} ``` suggests ``` error[E0412]: cannot find type `C` in this scope --> bar.rs:2:8 | 1 | struct X<const C: ()>(); | ------------------------ similarly named struct `X` defined here 2 | impl X<C> {} | ^ | help: a struct with a similar name exists | 2 | impl X<X> {} | ^ help: you might be missing a type parameter | 2 | impl<C> X<C> {} | ^^^ ``` After adding a type parameter the code now becomes ```rust struct X<const C: ()>(); impl<C> X<C> {} ``` and the error now fully steers the user towards the correct code ``` error[E0747]: type provided when a constant was expected --> bar.rs:2:11 | 2 | impl<C> X<C> {} | ^ | help: consider changing this type parameter to be a `const` generic | 2 | impl<const C: ()> X<C> {} | ^^^^^^^^^^^ ``` r? `@estebank` Somewhat related #84946
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-7/+7
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-05-11improve diagnosts for GATsb-naber-31/+31
2021-05-07Fix impl type parameter suggestion involving constsmibac138-2/+2
2021-05-05Suggest adding a type parameter for implsmibac138-2/+20
2021-05-04Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakisbors-10/+13
Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021 This addresses https://github.com/rust-lang/rust/pull/81244 by updating two lints to errors in the Rust 2021 edition. r? `@estebank`
2021-05-03Rollup merge of #84784 - JulianKnodt:suggest_const, r=lcnrDylan DPC-0/+24
Add help message to suggest const for unused type param r? `@lcnr`
2021-05-01Add help message for unused type paramkadmin-0/+24
2021-05-01Auto merge of #84410 - BoxyUwU:blue, r=varkorbors-0/+39
Fix generic arg mismatch errors being ignored with explicit late bound lifetimes Fixes #83466 r? `@varkor`
2021-05-01test: *sneezes*Ellen-0/+39
2021-04-27Rename a test for consistencyYuki Okushi-0/+0
2021-04-27Add a regression test for issue-84408Yuki Okushi-0/+38
2021-04-21supply substs to anon consts in defaultslcnr-49/+37
2021-04-21improve wf check for const param defaultslcnr-5/+54
2021-04-21loosen ordering restricts for `const_generics_defaults`lcnr-76/+132
2021-04-21fix name resolution for param defaultslcnr-13/+84
2021-04-16Fix testsRyan Levick-10/+13
2021-04-12Fix typo in error messageCamelid-3/+6
Also tweaked the message a bit by - removing the hyphen, because in my opinion the hyphen makes the message a bit harder to read, especially combined with the backticks; - adding the word "be", because I think it's a bit clearer that way.
2021-04-06Remove trailing `:` from E0119 messageEsteban Küber-1/+1
2021-04-02Auto merge of #83790 - Dylan-DPC:rollup-p6ep8jo, r=Dylan-DPCbors-11/+11
Rollup of 7 pull requests Successful merges: - #83065 (Rework `std::sys::windows::alloc`) - #83478 (rustdoc: Add unstable option to only emit shared/crate-specific files) - #83629 (Fix double-drop in `Vec::from_iter(vec.into_iter())` specialization when items drop during panic) - #83673 (give full path of constraint in suggest_constraining_type_param) - #83755 (Simplify coverage tests) - #83757 (2229: Support migration via rustfix) - #83771 (Fix stack overflow detection on FreeBSD 11.1+) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-03-31Add 32bit.stderr files.Hameer Abbasi-0/+72
2021-03-31Rename stderr->64bit.stderr where needed.Hameer Abbasi-8/+9
2021-03-31Add allocation information to undefined behaviour errors.Hameer Abbasi-0/+12
2021-03-31give full path of constraint in suggest_constraining_type_paramhi-rustin-11/+11
revert file bless with nll mode
2021-03-29Prefer 4 spacesJohnTitor-52/+52
2021-03-29Add a regression test for issue-82792JohnTitor-0/+14
2021-03-27Rollup merge of #81351 - lcnr:big-money-big-prices, r=oli-obkDylan DPC-9/+85
combine: stop eagerly evaluating consts `super_relate_consts` eagerly evaluates constants which doesn't seem too great. I now also finally understand why all of the unused substs test passed. The reason being that we just evaluated the constants in `super_relate_consts` :laughing: While this change isn't strictly necessary as evaluating consts here doesn't hurt, it still feels a lot cleaner to do it this way r? `@oli-obk` `@nikomatsakis`
2021-03-27update testslcnr-8/+8
2021-03-27combine: stop eagerly evaluating constsBastian Kauschke-9/+85
2021-03-27Add regression tests for #56445Simon Jakobi-3/+48
Closes #56445.
2021-03-23Update to not have extra matchkadmin-0/+75
2021-03-23Update with commentskadmin-3/+33
2021-03-23Update with commentskadmin-0/+53
A bunch of nits fixed, and a new test for pretty printing the AST.
2021-03-23Add query for const_param_defaultkadmin-0/+56
2021-03-23progress, stuff compiles nowlcnr-16/+33
2021-03-23Some refactoringvarkor-16/+11
2021-03-23Add has_default to GenericParamDefKind::Constkadmin-2/+18
This currently creates a field which is always false on GenericParamDefKind for future use when consts are permitted to have defaults Update const_generics:default locations Previously just ignored them, now actually do something about them. Fix using type check instead of value Add parsing This adds all the necessary changes to lower const-generics defaults from parsing. Change P<Expr> to AnonConst This matches the arguments passed to instantiations of const generics, and makes it specific to just anonymous constants. Attempt to fix lowering bugs
2021-03-21Rollup merge of #82707 - BoxyUwU:errooaaar, r=oli-obkDylan DPC-21/+38
const_evaluatable_checked: Stop eagerly erroring in `is_const_evaluatable` Fixes #82279 We don't want to be emitting errors inside of is_const_evaluatable because we may call this during selection where it should be able to fail silently There were two errors being emitted in `is_const_evaluatable`. The one causing the compile error in #82279 was inside the match arm for `FailureKind::MentionsParam` but I moved the other error being emitted too since it made things cleaner imo The `NotConstEvaluatable` enum \*should\* have a fourth variant for when we fail to evaluate a concrete const, e.g. `0 - 1` but that cant happen until #81339 cc `@oli-obk` `@lcnr` r? `@nikomatsakis`
2021-03-19Add a second regression testOli Scherer-0/+32
2021-03-19Do not ICE on ty::Error as an error must already have been reportedOli Scherer-0/+35
2021-03-10Rollup merge of #81309 - lcnr:lazy-norm-err-msgh, r=nikomatsakisDylan DPC-4/+6
always eagerly eval consts in Relate r? ```@nikomatsakis``` cc ```@varkor```
2021-03-05Bump mir-opt-level from 3 to 4 in testsSantiago Pastorino-1/+1
2021-03-02errooaaar~Ellen-21/+38
2021-02-24Auto merge of #82159 - BoxyUwU:uwu, r=varkorbors-0/+47
Use correct param_env in conservative_is_privately_uninhabited cc `@lcnr` r? `@varkor` since this is your FIXME that was removed ^^
2021-02-23yeetEllen-0/+47
2021-02-18Rollup merge of #82112 - BoxyUwU:tumbleweed, r=varkorDylan DPC-0/+34
const_generics: Dont evaluate array length const when handling yet another error Same ICE as #82009 except triggered by a different error. cc ``@lcnr`` r? ``@varkor``
2021-02-18Rollup merge of #82055 - JulianKnodt:ty_where_const, r=estebankYuki Okushi-14/+84
Add diagnostics for specific cases for const/type mismatch err For now, this adds at least more information so better diagnostics can be emitted for const mismatch errors. I'm not sure what exactly we want to emit, so I've left notes there temporarily, also to see if this is the right approach r? ```@lcnr``` cc: ```@estebank```
2021-02-16Remove ordering hintkadmin-2/+0
2021-02-16Update w/ commentskadmin-16/+68
2021-02-15Rollup merge of #82067 - BoxyUwU:hahaicantthinkofabadpun, r=oli-obkJonas Schievink-0/+24
const_generics: Fix incorrect ty::ParamEnv::empty() usage Fixes #80561 Not sure if I should keep the `debug!(..)`s or not but its the second time I've needed them so they sure seem useful lol cc ``@lcnr`` r? ``@oli-obk``