about summary refs log tree commit diff
path: root/tests/ui/const-generics
AgeCommit message (Collapse)AuthorLines
2023-08-08fix: not insert missing lifetime for `ConstParamTy`bohan-0/+27
2023-08-06add testcase that hits valtree_into_mplace with a custom DSTRalf Jung-0/+21
2023-08-06bless testsDeadbeef-8/+36
2023-08-02Auto merge of #112431 - Urgau:cast_ref_to_mut_improvments, r=Nilstriebbors-2/+11
Improve `invalid_reference_casting` lint This PR is a follow-up to https://github.com/rust-lang/rust/pull/111567 and https://github.com/rust-lang/rust/pull/113422. This PR does multiple things: - First it adds support for deferred de-reference, the goal is to support code like this, where the casting and de-reference are not done on the same expression ```rust let myself = self as *const Self as *mut Self; *myself = Self::Ready(value); ``` - Second it does not lint anymore on SB/TB UB code by only checking assignments (`=`, `+=`, ...) and creation of mutable references `&mut *` - Thirdly it greatly improves the diagnostics in particular for cast from `&mut` to `&mut` or assignments - ~~And lastly it renames the lint from `cast_ref_to_mut` to `invalid_reference_casting` which is more consistent with the ["rules"](https://github.com/rust-lang/rust-clippy/issues/2845) and also more consistent with what the lint checks~~ *https://github.com/rust-lang/rust/pull/113422* This PR is best reviewed commit by commit. r? compiler
2023-08-02Replace old private-in-public diagnostic with type privacy lintsBryanskiy-26/+2
2023-08-01Auto merge of #112849 - m-ou-se:panic-message-format, r=thomccbors-2/+2
Change default panic handler message format. This changes the default panic hook's message format from: ``` thread '{thread}' panicked at '{message}', {location} ``` to ``` thread '{thread}' panicked at {location}: {message} ``` This puts the message on its own line without surrounding quotes, making it easiser to read. For example: Before: ``` thread 'main' panicked at 'env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`', src/main.rs:4:6 ``` After: ``` thread 'main' panicked at src/main.rs:4:6: env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh` ``` --- See this PR by `@nyurik,` which does that for only multi-line messages (specifically because of `assert_eq`): https://github.com/rust-lang/rust/pull/111071 This is the change that does that for *all* panic messages.
2023-07-31normalize backtrace error messagesyukang-5/+5
2023-07-29print omitted frames count for short backtrace modeyukang-0/+2
2023-07-29Adjust some tests for invalid_reference_casting improvementsUrgau-3/+3
2023-07-29Revert "Temporarily switch invalid_reference_casting lint to allow-by-default"Urgau-2/+11
This reverts commit f25ad54a4d0febbcb2b7e951835228b7b2320b49.
2023-07-29Change default panic handler message format.Mara Bos-2/+2
2023-07-29Auto merge of #113422 - Urgau:cast_ref_to_mut-pre-beta, r=Nilstriebbors-11/+2
Rename and allow `cast_ref_to_mut` lint This PR is a small subset of https://github.com/rust-lang/rust/pull/112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`). BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until https://github.com/rust-lang/rust/pull/112431 is merged. r? `@Nilstrieb`
2023-07-27update tests, adding known-bugDeadbeef-18/+2
2023-07-18moved note as unspanned note, moved note to the bottom of the msgnxya-10/+2
2023-07-18added links as a notenxya-2/+2
2023-07-18add links to query documentation for E0391nxya-2/+2
2023-07-18added links as a notenxya-2/+12
2023-07-18add links to query documentation for E0391nxya-2/+2
2023-07-14Auto merge of #113519 - SparrowLii:parallel_typeck, r=cjgillotbors-22/+20
typeck in parallel #108118 caused `typeck` to be transferred to the serial part (`check_unused`), which made the performance of parallel rustc significantly reduced. This pr re-parallelize this part, which increases the average performance improvement of parallel rustc in `full` and `incr-full` scenarios from [14.4%](https://github.com/rust-lang/rust/pull/110284#issuecomment-1545354608) to [23.2%](https://github.com/rust-lang/rust/pull/110284#issuecomment-1624770626). r? `@cjgillot` cc `@oli-obk` `@Zoxc`
2023-07-13Temporarily switch invalid_reference_casting lint to allow-by-defaultUrgau-11/+2
2023-07-13Rename cast_ref_to_mut lint to invalid_reference_castingUrgau-1/+1
2023-07-11typeck in parallelSparrowLii-22/+20
2023-07-10Do not set up wrong span for adjustmentsMichael Goulet-3/+3
2023-07-08Rollup merge of #113005 - compiler-errors:dont-query-normalize, r=cjgillotMatthias Krüger-15/+15
Don't call `query_normalize` when reporting similar impls Firstly, It's sketchy to be using `query_normalize` at all during HIR typeck -- it's asking for an ICE 😅. Secondly, we're normalizing an impl trait ref that potentially has parameter types in `ty::ParamEnv::empty()`, which is kinda sketchy as well. The only UI test change from removing this normalization is that we don't evaluate anonymous constants in impls, which end up giving us really ugly suggestions: ``` error[E0277]: the trait bound `[X; 35]: Default` is not satisfied --> /home/gh-compiler-errors/test.rs:4:5 | 4 | <[X; 35] as Default>::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[X; 35]` | = help: the following other types implement trait `Default`: &[T] &mut [T] [T; 32] [T; core::::array::{impl#30}::{constant#0}] [T; core::::array::{impl#31}::{constant#0}] [T; core::::array::{impl#32}::{constant#0}] [T; core::::array::{impl#33}::{constant#0}] [T; core::::array::{impl#34}::{constant#0}] and 27 others ``` So just fold the impls with a `BottomUpFolder` that calls `ty::Const::eval`. This doesn't work totally correctly with generic-const-exprs, but it's fine for stable code, and this is error reporting after all.
2023-07-04implement `ConstEvaluatable` goals in new solverlcnr-1/+13
we don't yet handle `generic_const_exprs`, someone else can do that :3
2023-06-29Fix type privacy lints error messageBryanskiy-4/+4
2023-06-29Rollup merge of #112670 - petrochenkov:typriv, r=eholkMatthias Krüger-1/+1
privacy: Type privacy lints fixes and cleanups See individual commits. Follow up to https://github.com/rust-lang/rust/pull/111801.
2023-06-27Don't sort strings right after we just sorted by typesMichael Goulet-15/+15
2023-06-25Rollup merge of #112990 - JohnTitor:issue-96699, r=TaKO8KiGuillaume Gomez-0/+87
Add a regression test for #96699 Closes #96699 r? `@BoxyUwU`
2023-06-24Add a regression test for #96699Yuki Okushi-0/+87
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-06-24Add a regression test for #109141Yuki Okushi-0/+39
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-06-19Don't ICE on unnormalized struct tail in layout computationMichael Goulet-4/+4
2023-06-15privacy: Feature gate new type privacy lintsVadim Petrochenkov-1/+1
2023-06-15change `std::marker::Sized` to just `Sized`Lukas Markeffsky-2/+2
2023-06-14Rollup merge of #112506 - compiler-errors:const-infer-ice, r=b-naberMatthias Krüger-6/+6
Properly check associated consts for infer placeholders We only reported an error if it was in a "suggestable" position (according to `is_suggestable_infer_ty`) -- this isn't correct for infer tys that can show up in other places in the constant's type, like behind a dyn trait. fixes #112491
2023-06-14Rollup merge of #112520 - chenyukang:yukang-fix-112505, r=fee1-deadMatthias Krüger-0/+19
Fix the overflow issue for transmute_generic_consts Fixes #112505
2023-06-13Auto merge of #112549 - jieyouxu:fix-tests-for-unit-bindings, r=Nilstriebbors-2/+2
Adjust UI tests for `unit_bindings` lint - Explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Use `let () = init;` or `let pat = ();` where appropriate. - Fix disjoint-capture-in-same-closure test which wasn't actually testing a closure: `tests/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs`. Note that unfortunately there's *a lot* of UI tests, there are a couple of places where I may have left something like `let (): ()` (this is not needed but is left over from an ealier version of the lint) which is bad style. This PR is to help with the `unit_bindings` lint at #112380.
2023-06-12Adjust UI tests for `unit_bindings`许杰友 Jieyou Xu (Joe)-2/+2
- Either explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Fix disjoint-capture-in-same-closure test
2023-06-12Private-in-public lints implementationBryanskiy-2/+26
2023-06-11Fix the overflow issue for transmute_generic_constsyukang-0/+19
2023-06-11properly check associated consts for infer placeholdersMichael Goulet-6/+6
2023-06-08add a test for #105709Takayuki Maeda-0/+9
replace build with check Co-authored-by: Michael Goulet <michael@errs.io> use appropriate test name
2023-06-06remove `has_error_field` helper methodlcnr-25/+4
2023-06-02Auto merge of #112198 - compiler-errors:rollup-o2xe4of, r=compiler-errorsbors-83/+227
Rollup of 7 pull requests Successful merges: - #111670 (Require that const param tys implement `ConstParamTy`) - #111914 (CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…) - #112030 (Migrate `item_trait_alias` to Askama) - #112150 (Support 128-bit atomics on all x86_64 Apple targets) - #112174 (Fix broken link) - #112190 (Improve comments on `TyCtxt` and `GlobalCtxt`.) - #112193 (Check tuple elements are `Sized` in `offset_of`) Failed merges: - #112071 (Group rfcs tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-01Implement custom diagnostic for ConstParamTyMichael Goulet-80/+209
2023-06-01Impl ConstParamTy for tuples, make PartialStructuralEq a supertrait tooMichael Goulet-3/+18
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-2/+2
2023-05-31Adjust tests for newly uplifted cast_ref_to_mut lintUrgau-2/+11
2023-05-27Rollup merge of #111991 - BoxyUwU:change_error_term_display, r=compiler-errorsMatthias Krüger-4/+4
Change ty and const error's pretty printing to be in braces `[const error]` and `[type error]` are slightly confusing since they look like either a slice with an error type for the element ty or a slice with a const argument as the type ???. This PR changes them to display as `{const error}` and `{type error}` similar to `{integer}`. This does not update the `Debug` impls for them which is done in #111988. I updated some error logic to avoid printing the substs of trait refs when unable to resolve an assoc item for them, this avoids emitting errors with `{type error}` in them. The substs are not relevant for these errors since we don't take into account the substs when resolving the assoc item. r? ``@compiler-errors``
2023-05-26print const and type errors in braces not square bracketsBoxy-4/+4