about summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2023-09-07Auto merge of #115582 - compiler-errors:refine-yeet, r=oli-obkbors-40/+187
Implement refinement lint for RPITIT Implements a lint that warns against accidentally refining an RPITIT in an implementation. This is not a hard error, and can be suppressed with `#[allow(refining_impl_trait)]`, since this behavior may be desirable -- the lint just serves as an acknowledgement from the impl author that they understand that the types they write in the implementation are an API guarantee. This compares bounds syntactically, not semantically -- semantic implication is more difficult and essentially relies on adding the ability to keep the RPITIT hidden in the trait system so that things can be proven about the type that shows up in the impl without its own bounds leaking through, either via a new reveal mode or something else. This was experimentally implemented in #111931. Somewhat opinionated choices: 1. Putting the lint behind `refining_impl_trait` rather than a blanket `refine` lint. This could be changed, but I like keeping the lint specialized to RPITITs so the explanation can be tailored to it. 2. This PR does not include the `#[refine]` attribute or the feature gate, since it's kind of orthogonal and can be added in a separate PR. r? `@oli-obk`
2023-09-07add support for rustc_abi(assert_eq) and use it to test some ↵Ralf Jung-1/+232
repr(transparent) cases
2023-09-07Ensure that dyn trait bounds stay sortedMichael Goulet-7/+7
2023-09-07Lint node for PRIVATE_BOUNDS is the item which has the boundsMichael Goulet-0/+7
2023-09-07Don't ICE when computing ctype's repr_nullable_ptr for possibly-unsized tyMichael Goulet-0/+24
2023-09-07Find lowest span out of use + attrsMichael Goulet-1/+1
2023-09-07Test showing it doesnt workMichael Goulet-0/+45
2023-09-07Rename folder typoMichael Goulet-0/+0
2023-09-07Don't suggest dereferencing to unsized typeMichael Goulet-0/+37
2023-09-07fixes #114896surechen-0/+18
2023-09-07Print the path of an RPITIT in RTNMichael Goulet-2/+64
2023-09-07Add noteMichael Goulet-0/+5
2023-09-07Don't emit refining_impl_trait for private itemsMichael Goulet-46/+69
2023-09-07Use self instead of the actual self tyMichael Goulet-2/+2
2023-09-07Implement refinement lint for RPITITMichael Goulet-16/+135
2023-09-07Auto merge of #115166 - Urgau:invalid_ref_casting-invalid-unsafecell-usage, ↵bors-20/+76
r=est31 Lint on invalid usage of `UnsafeCell::raw_get` in reference casting This PR proposes to take into account `UnsafeCell::raw_get` method call for non-Freeze types for the `invalid_reference_casting` lint. The goal of this is to catch those kind of invalid reference casting: ```rust fn as_mut<T>(x: &T) -> &mut T { unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) } //~^ ERROR casting `&T` to `&mut T` is undefined behavior } ``` r? `@est31`
2023-09-06Rollup merge of #115587 - mojave2:issue-115348, r=oli-obkMatthias Krüger-0/+37
fix #115348 fix #115348 It looks that: - In `rustc_mir_build::build`, the body of function will not be built, when the `tcx.check_match(def)` fails due to `non-exhaustive patterns` - In `rustc_mir_transform::check_unsafety`, the `UnsafetyChecker` collects all `used_unsafe_blocks` in the MIR of a function, and the `UnusedUnsafeVisitor` will visit all `UnsafeBlock`s in the HIR and collect `unused_unsafes`, which are not contained in `used_unsafe_blocks`, and report `unnecessary_unsafe`s - So the unsafe block in the issue example code will be reported as `unnecessary_unsafe`.
2023-09-06Rollup merge of #115578 - ouz-a:rustc_clarify, r=oli-obkMatthias Krüger-9/+9
Clarify cryptic comments Clarifies some unclear comments that lurked in the compiler. r? ``@oli-obk``
2023-09-06Rollup merge of #115473 - gurry:113110-expected-item, r=compiler-errorsMatthias Krüger-0/+33
Add explanatory note to 'expected item' error Fixes #113110 It changes the diagnostic from this: ``` error: expected item, found `5` --> ../test.rs:1:1 | 1 | 5 | ^ expected item ``` to this: ``` error: expected item, found `5` --> ../test.rs:1:1 | 1 | 5 | ^ expected item | = note: items are things that can appear at the root of a module = note: for a full list see https://doc.rust-lang.org/reference/items.html ```
2023-09-06Rollup merge of #114511 - chenyukang:yukang-fix-114374-fmt-args, r=b-naberMatthias Krüger-0/+49
Remove the unhelpful let binding diag comes from FormatArguments Fixes #114374
2023-09-06add diagnostic for raw identifiers in format stringLukas Markeffsky-0/+61
2023-09-07suggest iter_mut() where trying to modify elements from .iter()yukang-0/+233
2023-09-06add a regression testmojave2-0/+37
2023-09-06rustc_layout/abi: error when attribute is applied to the wrong thingRalf Jung-18/+58
2023-09-06rustc_abi: also support debugging function pointersRalf Jung-6/+102
2023-09-06make comments less crypticouz-a-9/+9
2023-09-06Change unsafe_op_in_unsafe_fn to be warn-by-default from edition 2024Wim Looman-0/+33
2023-09-06still accept references to u8 slices and str in packed fieldsRalf Jung-11/+41
2023-09-06Add explanatory note to 'expected item' errorGurinder Singh-0/+33
2023-09-06Auto merge of #115529 - chenyukang:yukang-fix-115402-overflowsize, ↵bors-0/+60
r=compiler-errors Fix error report for size overflow from transmute Fixes #115402 The span in the error reporting always points to the `dst`, this is an old issue, I may open another PR to fix it.
2023-09-06Auto merge of #115371 - matthewjasper:if-let-guard-parsing, r=cjgillotbors-2/+47
Make if let guard parsing consistent with normal guards - Add tests that struct expressions are not allowed in `if let` and `while let` (no change, consistent with `if` and `while`) - Allow struct expressions in `if let` guards (consistent with `if` guards). r? `@cjgillot` Closes #93817 cc #51114
2023-09-06Fix error report for size overflow from transmuteyukang-0/+60
2023-09-05fix detecting references to packed unsized fieldsRalf Jung-11/+34
2023-09-05Restore some removed testsMichael Goulet-12/+50
2023-09-05Correctly deny late-bound lifetimes from parent in anon consts and TAITsMichael Goulet-120/+157
2023-09-05 unconstrained region vars: do not ICE ICE babylcnr-0/+48
2023-09-05Auto merge of #115553 - matthiaskrgr:rollup-c0045hz, r=matthiaskrgrbors-6/+121
Rollup of 5 pull requests Successful merges: - #115353 (Emit error instead of ICE when optimized MIR is missing) - #115488 (Take `&mut Results` in `ResultsVisitor`) - #115492 (Allow `large_assignments` for Box/Arc/Rc initialization) - #115519 (Don't ICE on associated type projection without feature gate in new solver) - #115534 (Expose more information with DefId in smir) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-05Rollup merge of #115519 - compiler-errors:next-solver-assoc-ice, r=lcnrMatthias Krüger-0/+40
Don't ICE on associated type projection without feature gate in new solver Self-explanatory, we should avoid ICEs when the feature gate is not enabled. Continue to ICE when the feature gate *is* enabled, though. Fixes #115500
2023-09-05Rollup merge of #115492 - Enselic:large-box-move, r=oli-obkMatthias Krüger-6/+56
Allow `large_assignments` for Box/Arc/Rc initialization Does the `stop linting in box/arc initialization` task of #83518. r? `@oli-obk` who is E-mentor.
2023-09-05Rollup merge of #115353 - Enselic:no-optimized-mir, r=oli-obkMatthias Krüger-0/+25
Emit error instead of ICE when optimized MIR is missing Closes #51388
2023-09-05Auto merge of #115531 - RalfJung:read_via_copy, r=scottmcmbors-4/+26
read_via_copy: don't prematurely optimize away the read Always do the read to ensure consistent UB error messages in const-eval/Miri. r? `@scottmcm`
2023-09-05Auto merge of #115467 - compiler-errors:assoc-ty-object-safety, r=oli-obkbors-22/+59
Do not require associated types with Self: Sized to uphold bounds when confirming object candidate RPITITs and associated types that have `Self: Sized` bounds are opted out of the `dyn Trait` well-formedness check that happens during confirmation. This ensures that we can actually *use* `dyn Trait`s that have associated types that, e.g., have GATs and RPITITs and other naughty things as long as those are opted-out of object safety via a `Self: Sized` bound. Fixes #115464 This seems like a natural part of https://github.com/rust-lang/rust/pull/112319#issuecomment-1592574451, and I don't think needs re-litigation. r? `@oli-obk`
2023-09-04read_via_copy: don't prematurely optimize away the readRalf Jung-4/+26
2023-09-04Add help to allow lint for the implied by suggestionUrgau-0/+13
2023-09-04Auto merge of #115513 - Urgau:normalize-msg-after-translate, r=petrochenkovbors-0/+16
Don't forget to normalize the translated message This PR adds a missing call to `normalize_whitespace` after translating an label. Fixes https://github.com/rust-lang/rust/issues/115498
2023-09-03Don't ICE on associated type projection without feature gateMichael Goulet-0/+40
2023-09-03Auto merge of #115270 - sebastiantoh:issue-105479, r=Nadrierilbors-4/+80
Add note on non-exhaustiveness when matching on str and nested non-exhaustive enums Fixes https://github.com/rust-lang/rust/issues/105479 r? `@Nadrieril`
2023-09-03Don't forget to normalize the translated messageUrgau-0/+16
2023-09-03Rollup merge of #115478 - gurry:115462-exprfield-no-warn, r=compiler-errorsGuillaume Gomez-4/+52
Emit unused doc comment warnings for pat and expr fields Fixes #115462
2023-09-03Improve clarity of diagnostic message on non-exhaustive matchesSebastian Toh-8/+8