summary refs log tree commit diff
path: root/tests/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-7/+7
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
2024-01-30Rollup merge of #120293 - estebank:issue-102629, r=nnethercoteGuillaume Gomez-15/+15
Deduplicate more sized errors on call exprs Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-26Auto merge of #116167 - RalfJung:structural-eq, r=lcnrbors-50/+15
remove StructuralEq trait The documentation given for the trait is outdated: *all* function pointers implement `PartialEq` and `Eq` these days. So the `StructuralEq` trait doesn't really seem to have any reason to exist any more. One side-effect of this PR is that we allow matching on some consts that do not implement `Eq`. However, we already allowed matching on floats and consts containing floats, so this is not new, it is just allowed in more cases now. IMO it makes no sense at all to allow float matching but also sometimes require an `Eq` instance. If we want to require `Eq` we should adjust https://github.com/rust-lang/rust/pull/115893 to check for `Eq`, and rule out float matching for good. Fixes https://github.com/rust-lang/rust/issues/115881
2024-01-25Rollup merge of #119895 - oli-obk:track_errors_3, r=matthewjasperMatthias Krüger-1/+10
Remove `track_errors` entirely follow up to https://github.com/rust-lang/rust/pull/119869 r? `@matthewjasper` There are some diagnostic changes adding new diagnostics or not emitting some anymore. We can improve upon that in follow-up work imo.
2024-01-24remove StructuralEq traitRalf Jung-50/+15
2024-01-24Deduplicate more sized errors on call exprsEsteban Küber-15/+15
Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-24Remove extra # from urlest31-2/+2
2024-01-23Rollup merge of #119805 - chenyukang:yukang-fix-119530, r=davidtwcoLeón Orell Valerian Liehr-0/+4
Suggest array::from_fn for array initialization Fixes #119530
2024-01-23Remove track_errors entirelyOli Scherer-1/+10
2024-01-22Make generic const type mismatches not hide trait impls from the trait solverOli Scherer-3/+50
2024-01-21Suggest arry::from_fn for array initializationyukang-0/+4
2024-01-13Bless testsGeorge-lewis-0/+2
Update tests
2024-01-11Silence follow up errors if astconv already erroredOli Scherer-34/+7
2024-01-09Avoid silencing relevant follow-up errorsOli Scherer-13/+156
2024-01-05Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkinbors-4/+4
Merge `unused_tuple_struct_fields` into `dead_code` This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group. [Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn)
2024-01-02Adjust compiler tests for unused_tuple_struct_fields -> dead_codeJake Goulding-4/+4
2024-01-02Reorder `check_item_type` diagnostics so they occur next to the ↵Oli Scherer-2/+43
corresponding `check_well_formed` diagnostics
2023-12-24add test for #116796bohan-0/+16
2023-12-14update use of feature flagslcnr-1/+1
2023-12-09report_not_const_evaluatable_error to avoid ICEing on ConstKind::ExprLenko Donchev-0/+89
2023-12-07Resolve assoc item bindings by namespaceLeón Orell Valerian Liehr-11/+23
If a const is expected, resolve a const. If a type is expected, resolve a type. Don't try to resolve a type first falling back to consts.
2023-12-02Auto merge of #118077 - calebzulawski:sync-portable-simd-2023-11-19, ↵bors-4/+4
r=workingjubilee Portable SIMD subtree update Syncs nightly to the latest changes from rust-lang/portable-simd r? `@rust-lang/libs`
2023-12-02fix an ICE when a valtree failed to evaluateRalf Jung-0/+15
2023-11-30generic_const_exprs: suggest to add the feature, not use itRalf Jung-67/+67
2023-11-27Auto merge of #117200 - rmehri01:repeated_help, r=WaffleLapkinbors-1/+0
Don't add redundant help for object safety violations Fixes #117186 r? WaffleLapkin
2023-11-26don't add redundant help for object safety violationsRyan Mehri-1/+0
2023-11-26Update std::simd usage and test outputsCaleb Zulawski-4/+4
2023-11-24Show number in error message even for one errorNilstrieb-148/+148
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-29On object safety error, mention new enum as alternativeEsteban Küber-0/+1
When we encounter a `dyn Trait` that isn't object safe, look for its implementors. If there's one, mention using it directly If there are less than 9, mention the possibility of creating a new enum and using that instead. Account for object unsafe `impl Trait on dyn Trait {}`. Make a distinction between public and sealed traits. Fix #80194.
2023-10-25Rollup merge of #116401 - WaffleLapkin:vtablin''', r=oli-obkMatthias Krüger-2/+5
Return multiple object-safety violation errors and code improvements to the object-safety check See individual commits for more information. Split off of #114260, since it turned out that the main intent of that PR was wrong. r? oli-obk
2023-10-25Return multiple object-safety violation errorsMaybe Waffle-2/+5
2023-10-25Auto merge of #117180 - matthiaskrgr:rollup-rxhl6ep, r=matthiaskrgrbors-0/+25
Rollup of 7 pull requests Successful merges: - #117111 (Remove support for alias `-Z instrument-coverage`) - #117141 (Require target features to match exactly during inlining) - #117152 (Fix unwrap suggestion for async fn) - #117154 (implement C ABI lowering for CSKY) - #117159 (Work around the fact that `check_mod_type_wf` may spuriously return `ErrorGuaranteed`) - #117163 (compiletest: Display compilation errors in mir-opt tests) - #117173 (Make `Iterator` a lang item) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-25Work around the fact that `check_mod_type_wf` may spuriously return ↵Oli Scherer-0/+25
`ErrorGuaranteed`, even if that error is only emitted by `check_modwitem_types`
2023-10-25Fix problematic commentcui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-10-23Update `since` stability attributes in testsDavid Tolnay-3/+3
2023-10-20Avoid a `track_errors` by bubbling up most errors from `check_well_formed`Oli Scherer-3/+18
2023-10-18Tweak wording of type errors involving type paramsEsteban Küber-1/+1
Fix #78206.
2023-10-16Normalize alloc-id in tests.Camille GILLOT-1/+1
2023-10-15place evaluation: require the original pointer to be aligned if an access ↵Ralf Jung-2/+3
happens
2023-10-15Auto merge of #116688 - compiler-errors:rustfmt-up, r=WaffleLapkin,Nilstriebbors-1/+1
Format all the let-chains in compiler crates Since rust-lang/rustfmt#5910 has landed, soon we will have support for formatting let-chains (as soon as rustfmt syncs and beta gets bumped). This PR applies the changes [from master rustfmt to rust-lang/rust eagerly](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/out.20formatting.20of.20prs/near/374997516), so that the next beta bump does not have to deal with a 200+ file diff and can remain concerned with other things like `cfg(bootstrap)` -- #113637 was a pain to land, for example, because of let-else. I will also add this commit to the ignore list after it has landed. The commands that were run -- I'm not great at bash-foo, but this applies rustfmt to every compiler crate, and then reverts the two crates that should probably be formatted out-of-tree. ``` ~/rustfmt $ ls -1d ~/rust/compiler/* | xargs -I@ cargo run --bin rustfmt -- `@/src/lib.rs` --config-path ~/rust --edition=2021 # format all of the compiler crates ~/rust $ git checkout HEAD -- compiler/rustc_codegen_{gcc,cranelift} # revert changes to cg-gcc and cg-clif ``` cc `@rust-lang/rustfmt` r? `@WaffleLapkin` or `@Nilstrieb` who said they may be able to review this purely mechanical PR :> cc `@Mark-Simulacrum` and `@petrochenkov,` who had some thoughts on the order of operations with big formatting changes in https://github.com/rust-lang/rust/pull/95262#issue-1178993801. I think the situation has changed since then, given that let-chains support exists on master rustfmt now, and I'm fairly confident that this formatting PR should land even if *bootstrap* rustfmt doesn't yet format let-chains in order to lessen the burden of the next beta bump.
2023-10-14Propagate pattern errors via a new `PatKind::Error` variantNadrieril-13/+1
Instead of via `Const::new_error`
2023-10-13Bless tests and new warnings due to formatting changesMichael Goulet-1/+1
2023-10-11Prevent spurious `unreachable pattern` lintsOli Scherer-1/+13
Means you'll get more `non-exhaustive` patterns
2023-10-09Extend impl's def_span to include where clausesMichael Goulet-1/+1
2023-10-06Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiserbors-11/+20
Show more information when multiple `impl`s apply - When there are `impl`s without type params, show only those (to avoid showing overly generic `impl`s). ``` error[E0283]: type annotations needed --> $DIR/multiple-impl-apply.rs:34:9 | LL | let y = x.into(); | ^ ---- type must be known at this point | note: multiple `impl`s satisfying `_: From<Baz>` found --> $DIR/multiple-impl-apply.rs:14:1 | LL | impl From<Baz> for Bar { | ^^^^^^^^^^^^^^^^^^^^^^ ... LL | impl From<Baz> for Foo { | ^^^^^^^^^^^^^^^^^^^^^^ = note: required for `Baz` to implement `Into<_>` help: consider giving `y` an explicit type | LL | let y: /* Type */ = x.into(); | ++++++++++++ ``` - Lower the importance of `T: Sized`, `T: WellFormed` and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user. - Show `<SelfTy as Trait>::assoc_fn` suggestion in more cases. ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> $DIR/cross-return-site-inference.rs:38:16 | LL | return Err(From::from("foo")); | ^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation | LL | return Err(</* self type */ as From>::from("foo")); | +++++++++++++++++++ + ``` Fix #88284.
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-0/+5
2023-10-04Reorder fullfillment errors to keep more interesting ones firstEsteban Küber-11/+20
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed` and coercion errors to the end of the list. The pre-existing deduplication logic eliminates redundant errors better that way, keeping the resulting output with fewer errors than before, while also having more detail.
2023-10-02For a single impl candidate, try to unify it with error trait refMichael Goulet-1/+1
2023-09-28make adt_const_params feature suggestion more consistent with others and ↵asquared31415-48/+193
only suggest it when the type can probably work
2023-09-24ConstParamTy: require EqRalf Jung-3/+34