about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-07-26Use impl generics when suggesting fix on copy implMichael Goulet-0/+95
2022-07-25handle consts with param/infer in const_eval_resolve betterMichael Goulet-43/+2
2022-07-25Restore Opaque behavior to coherence checkMichael Goulet-1/+45
2022-07-25Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkovbors-669/+690
Resolve function lifetime elision on the AST ~Based on https://github.com/rust-lang/rust/pull/97720~ Lifetime elision for functions is purely syntactic in nature, so can be resolved on the AST. This PR replicates the elision logic and diagnostics on the AST, and replaces HIR-based resolution by a `delay_span_bug`. This refactor allows for more consistent diagnostics, which don't have to guess the original code from HIR. r? `@petrochenkov`
2022-07-25Report elision failures on the AST.Camille GILLOT-669/+690
2022-07-25passes: port more of `check_attr` moduleDavid Wood-6/+6
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-25Bubble up obligationsouz-a-1/+3
2022-07-25Rollup merge of #99581 - nnethercote:improve-derive-packed-errors, r=estebankYuki Okushi-46/+60
Improve error messages involving `derive` and `packed`. There are two errors involving `derive` and `packed`. ``` `#[derive]` can't be derived on a `#[repr(packed)]` struct with type or const parameters `#[derive]` can't be derived on a `#[repr(packed)]` struct that does not derive Copy ``` The second one overstates things. It is possible to use derive on a repr(packed) struct that doesn't derive Copy in two cases. - If all the fields within the struct meet the required alignment: 1 for `repr(packed)`, or `N` for `repr(packed(N))`. - If `Default` is the only trait derived. This commit improves things in a few ways. - Changes the errors to say `this trait can't be derived on this ...`. This is more accurate, because it's just *this* trait and *this* packed struct that are a problem, not *all* derived traits on *all* packed structs. - Adds more details to the "ERROR" lines in the test case, enough to distinguish between the two error messages. - Adds more cases to the test case that don't cause errors, e.g. `Default` derives. - Uses a wider variety of builtin traits in the test case, for better coverage. r? `@estebank`
2022-07-25Rollup merge of #99494 - tmiasko:no-pie, r=Mark-SimulacrumYuki Okushi-1/+1
Use non-relocatable code in nofile-limit.rs test To avoid using static-pie which is not essential to the test but which was reported to cause problems on Void Linux where glibc is build without support for static-pie.
2022-07-25suggest removing the tuple struct field for the unwrapped valueTakayuki Maeda-0/+75
add a test case for macro
2022-07-25Generate correct suggestion with named arguments used positionallyPreston From-24/+864
Address issue #99265 by checking each positionally used argument to see if the argument is named and adding a lint to use the name instead. This way, when named arguments are used positionally in a different order than their argument order, the suggested lint is correct. For example: ``` println!("{b} {}", a=1, b=2); ``` This will now generate the suggestion: ``` println!("{b} {a}", a=1, b=2); ``` Additionally, this check now also correctly replaces or inserts only where the positional argument is (or would be if implicit). Also, width and precision are replaced with their argument names when they exists. Since the issues were so closely related, this fix for issue #99265 also fixes issue #99266. Fixes #99265 Fixes #99266
2022-07-25Deeply deny fn and raw ptrs in const genericsMichael Goulet-17/+71
2022-07-25Improve error messages involving `derive` and `packed`.Nicholas Nethercote-46/+60
There are two errors involving `derive` and `packed`. ``` `#[derive]` can't be derived on a `#[repr(packed)]` struct with type or const parameters `#[derive]` can't be derived on a `#[repr(packed)]` struct that does not derive Copy ``` The second one overstates things. It is possible to use derive on a repr(packed) struct that doesn't derive Copy in two cases. - If all the fields within the struct meet the required alignment: 1 for `repr(packed)`, or `N` for `repr(packed(N))`. - If `Default` is the only trait derived. This commit improves things in a few ways. - Changes the errors to say `$TRAIT can't be derived on this ...`. This is more accurate, because it's just $TRAIT and *this* packed struct that are a problem, not *all* derived traits on *all* packed structs. - Adds more details to the "ERROR" lines in the test case, enough to distinguish between the two error messages. - Adds more cases to the test case that don't cause errors, e.g. `Default` derives. - Uses a wider variety of builtin traits in the test case, for better coverage.
2022-07-24interpret, ptr_offset_from: refactor and test too-far-apart checkRalf Jung-22/+103
2022-07-24Do not prefer module parents which are `doc(hidden)` in visibility mapMichael Goulet-3/+3
2022-07-24Add failing testAlik Aslanyan-0/+69
2022-07-24Combine redundant obligation cause codesMichael Goulet-9/+9
2022-07-24Handle additional lifetime bounds on GATs like on methodsMichael Goulet-9/+7
2022-07-24Slightly improve mismatched GAT where clause errorMichael Goulet-25/+28
2022-07-24Move write! and writeln! temporaries test to check-failDavid Tolnay-16/+93
2022-07-24Regression in issue 99684 fixedDavid Tolnay-31/+1
2022-07-24Add regression test minimized from async-std writeDavid Tolnay-0/+67
2022-07-24suggest dereferencing index when trying to use a reference of usize as indexTakayuki Maeda-32/+63
2022-07-24Auto merge of #93429 - fee1-dead-contrib:allow-super-trait-tilde-const, ↵bors-0/+100
r=oli-obk Allow `trait A: ~const B` What's included: a minimal working change set for `~const` supertraits to work. r? `@oli-obk`
2022-07-23Auto merge of #99652 - GuillaumeGomez:rollup-38v0x7y, r=GuillaumeGomezbors-31/+78
Rollup of 6 pull requests Successful merges: - #99298 (Make `ui-fulldeps/gated-plugins` and `ui-fulldeps/multiple-plugins` tests stage 2 only) - #99396 (Add some additional double-adjustment regression tests) - #99449 (Do not resolve associated const when there is no provided value) - #99595 (Mark atomics as unsupported on thumbv6m) - #99627 (Lock stdout once when listing tests) - #99638 (Remove Clean trait implementation for hir::Ty and middle::Ty) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-23Rollup merge of #99449 - compiler-errors:assoc-const-missing-item, r=lcnrGuillaume Gomez-31/+32
Do not resolve associated const when there is no provided value Fixes #98629, since now we just delay a bug when we're not able to evaluate a const item due to the value not actually being provided by anything. This means compilation proceeds forward to where the "missing item in impl" error is emitted. ---- The root issue here is that when we're looking for the defining `LeafDef` in `resolve_associated_item`, we end up getting the trait's AssocItem instead of the impl's AssocItem (which does not exist). This resolution "succeeds" even if the trait's item has no default value, and then since this item has no value to evaluate, it turns into a const eval error. This root issue becomes problematic (as in #98629) when this const eval error happens in wfcheck (for example, due to normalizing the param-env of something that references this const). Since this happens sooner than the check that an impl actually provides all of the items that a trait requires (which happens during later typecheck), we end up aborting compilation early with only this un-informative message. I'm not exactly sure _why_ this bug arises due to #96591 -- perhaps valtrees are evaluated more eagerly than in the old system? r? ``@oli-obk`` or ``@lcnr`` since y'all are familiar with const eval and reviewed #96591, though feel free to reassign. This is a regression from stable to beta, so I would be open to considering this for beta backport. It seems correct to me, especially given the improvements in the other UI tests this PR touches, but may have some side-effects that I'm unaware of...?
2022-07-23Rollup merge of #99396 - compiler-errors:missing-tests, r=Mark-SimulacrumGuillaume Gomez-0/+46
Add some additional double-adjustment regression tests I accidentally missed these when I rebased #98785 cc #98894 and #98897
2022-07-23Auto merge of #98208 - ivanloz:master, r=nagisabors-1/+1
Add support for LLVM ShadowCallStack. LLVMs ShadowCallStack provides backward edge control flow integrity protection by using a separate shadow stack to store and retrieve a function's return address. LLVM currently only supports this for AArch64 targets. The x18 register is used to hold the pointer to the shadow stack, and therefore this only works on ABIs which reserve x18. Further details are available in the [LLVM ShadowCallStack](https://clang.llvm.org/docs/ShadowCallStack.html) docs. # Usage `-Zsanitizer=shadow-call-stack` # Comments/Caveats * Currently only enabled for the aarch64-linux-android target * Requires the platform to define a runtime to initialize the shadow stack, see the [LLVM docs](https://clang.llvm.org/docs/ShadowCallStack.html) for more detail.
2022-07-23Do not suggest adding `;` when `,` is also a choiceMichael Goulet-12/+21
2022-07-23Add testsDeadbeef-0/+100
2022-07-23Rollup merge of #99580 - fmease:fix-issue-99565, r=estebankMatthias Krüger-2/+23
Don't suggest unnameable generic arguments Fixes #99565. `@rustbot` label T-compiler A-diagnostics r? `@rust-lang/wg-diagnostics`
2022-07-22Do not resolve associated const when there is no provided valueMichael Goulet-31/+32
2022-07-22Auto merge of #99521 - fee1-dead-contrib:const_fix_hax, r=oli-obkbors-16/+1
Fix hack that remaps env constness. WARNING: might have perf implications. Are there any more problems with having a constness in the `ParamEnv` now? :) r? `@oli-obk`
2022-07-22include a demo that more programs can be compiledDing Xiang Fei-0/+17
2022-07-22Auto merge of #99491 - workingjubilee:sync-psimd, r=workingjubileebors-7/+8
Sync in portable-simd subtree r? `@ghost`
2022-07-22Rollup merge of #99539 - compiler-errors:bidirectional-block-suggestions, ↵Dylan DPC-40/+107
r=fee1-dead Improve suggestions for returning binding Fixes #99525 Also reworks the cause codes for match and if a bit, I think cleaning them up in a positive way. We no longer need to call `could_remove_semicolon` in successful code, which might save a few cycles?
2022-07-22Rollup merge of #99393 - ↵Dylan DPC-169/+178
Logarithmus:feature/99255-omit-const-generic-suffixes, r=petrochenkov feat: omit suffixes in const generics (e.g. `1_i32`) Closes #99255
2022-07-22Don't suggest unnameable generic argumentsLeón Orell Valerian Liehr-2/+23
2022-07-22Add simd_cast_ptr, simd_expose_addr, and simd_from_exposed_addr intrinsicsCaleb Zulawski-0/+33
2022-07-22Delay a span bug if we see ty/const generic params during writebackMichael Goulet-0/+28
2022-07-22Auto merge of #99420 - RalfJung:vtable, r=oli-obkbors-211/+266
make vtable pointers entirely opaque This implements the scheme discussed in https://github.com/rust-lang/unsafe-code-guidelines/issues/338: vtable pointers should be considered entirely opaque and not even readable by Rust code, similar to function pointers. - We have a new kind of `GlobalAlloc` that symbolically refers to a vtable. - Miri uses that kind of allocation when generating a vtable. - The codegen backends, upon encountering such an allocation, call `vtable_allocation` to obtain an actually dataful allocation for this vtable. - We need new intrinsics to obtain the size and align from a vtable (for some `ptr::metadata` APIs), since direct accesses are UB now. I had to touch quite a bit of code that I am not very familiar with, so some of this might not make much sense... r? `@oli-obk`
2022-07-21Rollup merge of #99552 - lcnr:orphan_check-rework, r=oli-obkMatthias Krüger-1/+1
Rewrite `orphan_check_trait_ref` to use a `TypeVisitor` The current impl is far more confusing than it has any right to be :sparkles: r? rust-lang/types
2022-07-21Rollup merge of #99549 - JohnTitor:issue-52304, r=compiler-errorsMatthias Krüger-0/+11
Add regression test for #52304 Closes #52304 r? ```@compiler-errors``` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-21Rollup merge of #99526 - compiler-errors:normalize-arg-spans, r=oli-obkMatthias Krüger-15/+12
Normalize the arg spans to be within the call span Makes more sense to point out the arg's span, and not the expression inside the macro
2022-07-21Rollup merge of #99413 - steffahn:btree_dropck, r=m-ou-seMatthias Krüger-3/+50
Add `PhantomData` marker for dropck to `BTreeMap` closes #99408
2022-07-21Generalize same_type_modulo_inferMichael Goulet-2/+0
2022-07-21provide a test for #93951Ding Xiang Fei-0/+11
2022-07-21Auto merge of #99059 - Amanieu:fix-96797, r=Mark-Simulacrumbors-0/+26
Add test for #96797 This was fixed in LLVM which was updated in #98285. https://reviews.llvm.org/D127751 Fixes #96797
2022-07-21Add test for #96797Amanieu d'Antras-0/+26
This was fixed in LLVM which was updated in #98285. https://reviews.llvm.org/D127751 Fixes #96797
2022-07-21orphan check: opaque types are an errorlcnr-1/+1