summary refs log tree commit diff
path: root/src/test/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2021-11-25Visit `param_env` field in Obligation's `TypeFoldable` implAaron Hill-7/+16
This oversight appears to have gone unnoticed for a long time without causing issues, but it should still be fixed.
2021-11-20Do not mention associated items when they introduce an obligationEsteban Kuber-16/+0
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-16/+9
Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). Address part of #89418.
2021-11-19Rollup merge of #90578 - lcnr:add-test, r=Mark-SimulacrumYuki Okushi-0/+85
add const generics test cc https://github.com/rust-lang/rust/pull/89829#issuecomment-948921310 r? rust-lang/project-const-generics
2021-11-18bless nlllcnr-0/+26
2021-11-17add const generics testlcnr-0/+59
2021-11-14Fix span for non-satisfied trivial trait boundsNilstrieb-41/+28
The spans for "trait bound not satisfied" errors in trivial trait bounds referenced the entire item (fn, impl, struct) before. Now they only reference the obligation itself (`String: Copy`) Address #90869
2021-11-08Add a note about feature(explicit_generic_args_with_impl_trait) to the ↵Jakub Kądziołka-0/+3
relevant error message
2021-11-06Move some tests to more reasonable directoriesCaio-0/+60
2021-10-30Rollup merge of #90396 - b-naber:type_flags_ices_default_anon_consts, r=lcnrMatthias Krüger-0/+47
Prevent type flags assertions being thrown in default_anon_const_substs if errors occurred Fixes https://github.com/rust-lang/rust/issues/90364 Fixes https://github.com/rust-lang/rust/issues/88997 r? ``@lcnr``
2021-10-29ignore type flags insertion in default_anon_const_substs if error occurredb-naber-0/+47
2021-10-29add testb-naber-0/+20
2021-10-26Rollup merge of #90181 - notriddle:notriddle/error-pointer, r=estebankMatthias Krüger-4/+8
fix(rustc_typeck): report function argument errors on matching type Fixes #90101
2021-10-25Rollup merge of #90266 - b-naber:uneval_substs, r=lcnrMatthias Krüger-0/+25
Prevent duplicate caller bounds candidates by exposing default substs in Unevaluated Fixes https://github.com/rust-lang/rust/issues/89334 The changes introduced in https://github.com/rust-lang/rust/pull/87280 allowed for "duplicate" caller bounds candidates to be assembled that only differed in their default substs having been "exposed" or not and resulted in an ambiguity error during trait selection. To fix this we expose the defaults substs during the creation of the ParamEnv. r? `@lcnr`
2021-10-25fix(rustc_typeck): report function argument errors on matching typeMichael Howell-4/+8
Fixes #90101
2021-10-25add testsb-naber-0/+25
2021-10-23Rollup merge of #89829 - voidc:assoc-const-variance, r=lcnrMatthias Krüger-25/+5
Consider types appearing in const expressions to be invariant This is an approach to fix #80977. Currently, a type parameter which is only used in a constant expression is considered bivariant and will trigger error E0392 *"parameter T is never used"*. Here is a short example: ```rust pub trait Foo { const N: usize; } struct Bar<T: Foo>([u8; T::N]) where [(); T::N]:; ``` ([playgound](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2015&gist=b51a272853f75925e72efc1597478aa5)) While it is possible to silence this error by adding a `PhantomData<T>` field, I think the better solution would be to make `T` invariant. This would be analogous to the invariance constraints added for associated types. However, I'm quite new to the compiler and unsure whether this is the right approach. r? ``@varkor`` (since you authored #60058)
2021-10-21*dust dust*Ellen-2/+2
2021-10-20OrderingEllen-1/+10
2021-10-20add fixmeEllen-1/+1
2021-10-20InferenceEllen-0/+26
2021-10-20WfnessEllen-0/+59
2021-10-20Return pos impl traitEllen-0/+94
2021-10-20Trait objectsEllen-0/+104
2021-10-12Bless testsDominik Stolz-25/+5
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