about summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2021-10-06Rollup merge of #89588 - BoxyUwU:add_a_test_uwu, r=lcnrManish Goregaokar-0/+29
Add a test for generic_const_exprs Test that const_eval_resolve evaluates consts with unused inference vars in substs r? ``@lcnr``
2021-10-06testEllen-0/+29
2021-10-05Rollup merge of #89317 - JulianKnodt:precise_errors, r=BoxyUwUManish Goregaokar-9/+17
Move generic error message to separate branches This decomposes an error message in generic constants into more specific branches, for better readability. r? ``@lcnr``
2021-10-04Move generic error message to separate brancheskadmin-9/+17
This decomposes an error message in generic constants into more specific branches, for better readability.
2021-10-01Rollup merge of #89029 - notriddle:notriddle/issue-89013, r=estebankManish Goregaokar-0/+137
feat(rustc_parse): recover from pre-RFC-2000 const generics syntax Fixes #89013
2021-09-28feat(rustc_typeck): avoid erroring with "wrong number of generics" if ↵Michael Howell-42/+6
there's other problems As shown in the two test requirements that got updated, if there's other problems, then those other problems are probably the root cause of the incorrect generics count.
2021-09-28Improve error messages for bad type constraintsMichael Howell-19/+14
Co-authored-by: Esteban Kuber <esteban@kuber.com.ar>
2021-09-28Use less verbose syntax for error annotationsMichael Howell-4/+4
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-09-25Use larger span for adjustments on method callsAaron Hill-1/+1
Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-17Apply review commentsYuki Okushi-4/+6
2021-09-17Recover invalid assoc type bounds using `==`Yuki Okushi-0/+40
2021-09-16Auto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisabors-1/+3
Point at argument instead of call for their obligations When an obligation is introduced by a specific `fn` argument, point at the argument instead of the `fn` call if the obligation fails to be fulfilled. Move the information about pointing at the call argument expression in an unmet obligation span from the `FulfillmentError` to a new `ObligationCauseCode`. When giving an error about an obligation introduced by a function call that an argument doesn't fulfill, and that argument is a block, add a span_label pointing at the innermost tail expression. Current output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:31 | 2 | let p = Some(45).and_then({ | ______________________--------_^ | | | | | required by a bound introduced by this call 3 | | |x| println!("doubling {}", x); 4 | | Some(x * 2) | | ----------- 5 | | }); | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Previous output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:22 | 2 | let p = Some(45).and_then({ | ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Partially address #27300. Will require rebasing on top of #88546.
2021-09-16feat(rustc_parse): recover from pre-RFC-2000 const generics syntaxMichael Howell-0/+178
Fixes #89013
2021-09-16fix rebaseEsteban Kuber-1/+3
2021-09-15Move object safety suggestions to the end of the errorEsteban Kuber-1/+1
2021-09-13Auto merge of #87915 - estebank:fancy-spans, r=oli-obkbors-2/+2
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
2021-09-12Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnrManish Goregaokar-22/+77
generic_const_exprs: use thir for abstract consts instead of mir Changes `AbstractConst` building to use `thir` instead of `mir` so that there's less chance of consts unifying when they shouldn't because lowering to mir dropped information (see `abstract-consts-as-cast-5.rs` test) r? `@lcnr`
2021-09-11Rollup merge of #88779 - estebank:unused-delims, r=davidtwcoJubilee-1/+6
Use more accurate spans for "unused delimiter" lint
2021-09-09Ignore automatically derived impls of `Clone` and `Debug` in dead code analysisFabian Wolff-0/+3
2021-09-09add test for builtin types N + N unifying with fn callEllen-1/+22
2021-09-09Use more accurate spans for "unused delimiter" lintEsteban Kuber-1/+6
2021-09-09CI pleaseEllen-0/+1
2021-09-09resolve `from_hir_call` FIXMEEllen-1/+24
2021-09-09add a `CastKind` to `Node::Cast`Ellen-0/+21
2021-09-09bless stderrEllen-13/+8
2021-09-09dont support blocksEllen-9/+3
2021-09-06Rollup merge of #88602 - BoxyUwU:tests-uwu-nya, r=lcnrRyan Levick-0/+203
Add tests for some const generics issues closes #82956 closes #84659 closes #86530 closes #86535 there is also a random test in here about array repeat expressions that I already had on this branch but it seems to fit the theme of this PR so kept it... r? `@lcnr`
2021-09-03Auto merge of #88597 - cjgillot:lower-global, r=petrochenkovbors-6/+6
Move global analyses from lowering to resolution Split off https://github.com/rust-lang/rust/pull/87234 r? `@petrochenkov`
2021-09-02tidyEllen-2/+2
2021-09-02E-not-needs-testEllen-0/+203
2021-09-02Rollup merge of #88592 - b-naber:region_substs, r=oli-obkMara Bos-0/+26
Fix ICE in const check Fixes https://github.com/rust-lang/rust/issues/88433
2021-09-02add testb-naber-0/+26
2021-09-01Stop sorting bodies by span.Camille GILLOT-6/+6
The definition order is already close to the span order, and only differs in corner cases.
2021-08-30`feature(const_param_types)` -> `feature(adt_const_params)`lcnr-83/+83
2021-08-30allow unordered const/ty params if any cg feature is activelcnr-2/+0
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-2743/+803
2021-08-30remove lazy_normalization_constsEllen-0/+36
2021-08-30rename const_evaluatable_checked to generic_const_exprsEllen-155/+119
:sparkles:
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-1/+0
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-16Use note to point at bound introducing requirementEsteban Küber-100/+140
2021-08-12Rollup merge of #87885 - m-ou-se:edition-guide-links, r=rylevGuillaume Gomez-1/+1
Link to edition guide instead of issues for 2021 lints. This changes the 2021 lints to not link to github issues, but to the edition guide instead. Fixes #86996
2021-08-12Use smaller spans for some structured suggestionsEsteban Kuber-2/+2
Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts * E0212
2021-08-11Modify structured suggestion outputEsteban Küber-101/+80
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-11Rollup merge of #87854 - BoxyUwU:var-None, r=oli-obkYuki Okushi-0/+24
correctly handle enum variants in `opt_const_param_of` Fixes #87542 `opt_const_param_of` was returning `None` for args on an enum variant `Enum::Variant::<10>` because we called `generics_of` on the enum variant which has no generics. r? `@oli-obk`
2021-08-09Link to edition guide instead of issues for 2021 lints.Mara Bos-1/+1
2021-08-07fmtEllen-1/+1
2021-08-07less opt in const param ofEllen-0/+24
2021-08-06uwuEllen-1/+1
2021-08-06*sprinkles some dust everywhere*Ellen-1/+2
2021-08-06encode `generics_of` of fields and ty paramsEllen-0/+80