about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-02-02Rollup merge of #107577 - nnethercote:reinstate-hir-stats, r=jyn514Matthias Krüger-1/+5
Reinstate the `hir-stats.rs` tests on stage 1. r? ```@the8472```
2023-02-02Rollup merge of #107532 - compiler-errors:erase-regions-in-uninhabited, ↵Matthias Krüger-0/+18
r=jackh726 Erase regions before doing uninhabited check in borrowck ~Also, fingerprint query keys/values when debug assertions are enabled. This should make it easier to check for issues like this without `-Cincremental`, and make UI tests a bit cleaner.~ edit: moving that to a separate PR Fixes #107505
2023-02-02Rollup merge of #107524 - cjgillot:both-storage, r=RalfJungMatthias Krüger-37/+162
Remove both StorageLive and StorageDead in CopyProp. Fixes https://github.com/rust-lang/rust/issues/107511 https://github.com/rust-lang/rust/pull/106908 removed StorageDead without the accompanying StorageLive. In loops, execution would see repeated StorageLive, without any StorageDead, which is UB. So when removing storage statements, we have to remove both StorageLive and StorageDead. ~I also added a MIR validation pass for StorageLive. It may be a bit overzealous.~
2023-02-02Rollup merge of #107493 - clubby789:range-fat-arrow-followup, r=estebankMatthias Krüger-12/+9
Improve diagnostic for missing space in range pattern Improves the diagnostic in #107425 by turning it into a note explaining the parsing issue. r? `@compiler-errors`
2023-02-02Rollup merge of #106919 - compiler-errors:underscore-typo-in-field-pat, ↵Matthias Krüger-22/+25
r=jackh726 Recover `_` as `..` in field pattern
2023-02-02Improve diagnostic for missing space in range patternclubby789-12/+9
2023-02-02Auto merge of #107478 - compiler-errors:anon-enum-tys-are-ambiguous, r=estebankbors-160/+53
Revert "Teach parser to understand fake anonymous enum syntax" and related commits anonymous enum types are currently ambiguous in positions like: * `|` operator: `a as fn() -> B | C` * closure args: `|_: as fn() -> A | B` I first tried to thread around `RecoverAnonEnum` into all these positions, but the resulting complexity in the compiler is IMO not worth it, or at least worth a bit more thinking time. In the mean time, let's revert this syntax for now, so we can go back to the drawing board. Fixes #107461 cc: `@estebank` `@cjgillot` #106960 --- ### Squashed revert commits: Revert "review comment: Remove AST AnonTy" This reverts commit 020cca8d36cb678e3ddc2ead41364be314d19e93. Revert "Ensure macros are not affected" This reverts commit 12d18e403139eeeeb339e8611b2bed4910864edb. Revert "Emit fewer errors on patterns with possible type ascription" This reverts commit c847a01a3b1f620c4fdb98c75805033e768975d1. Revert "Teach parser to understand fake anonymous enum syntax" This reverts commit 2d824206655bfb26cb5eed43490ee396542b153e.
2023-02-02Recover _ as .. in field patternMichael Goulet-22/+25
2023-02-02Add a testMichael Goulet-0/+26
2023-02-02Revert "Teach parser to understand fake anonymous enum syntax" and related ↵Michael Goulet-160/+27
commits Revert "review comment: Remove AST AnonTy" This reverts commit 020cca8d36cb678e3ddc2ead41364be314d19e93. Revert "Ensure macros are not affected" This reverts commit 12d18e403139eeeeb339e8611b2bed4910864edb. Revert "Emit fewer errors on patterns with possible type ascription" This reverts commit c847a01a3b1f620c4fdb98c75805033e768975d1. Revert "Teach parser to understand fake anonymous enum syntax" This reverts commit 2d824206655bfb26cb5eed43490ee396542b153e.
2023-02-02Rollup merge of #107576 - P1n3appl3:master, r=tmandryMatthias Krüger-0/+3
Add proc-macro boilerplate to crt-static test I was seeing this failure when running ui tests with with a `-Cpanic=abort` stdlib targeting fuchsia: ``` ---- [ui] tests/ui/proc-macro/crt-static.rs stdout ---- normalized stderr: warning: building proc macro crate with `panic=abort` may crash the compiler should the proc-macro panic warning: 1 warning emitted The actual stderr differed from the expected stderr. ``` `force-host` was enough to stop it from running/failing, not sure if I should also add `needs-unwind`?
2023-02-02Rollup merge of #107488 - nnethercote:fix-PartialEq-syntax, r=RalfJungMatthias Krüger-3/+3
Fix syntax in `-Zunpretty-expanded` output for derived `PartialEq`. If you do `derive(PartialEq)` on a packed struct, the output shown by `-Zunpretty=expanded` includes expressions like this: ``` { self.x } == { other.x } ``` This is invalid syntax. This doesn't break compilation, because the AST nodes are constructed within the compiler. But it does mean anyone using `-Zunpretty=expanded` output as a guide for hand-written impls could get a nasty surprise. This commit fixes things by instead using this form: ``` ({ self.x }) == ({ other.x }) ``` r? ``@RalfJung``
2023-02-02Rollup merge of #107201 - compiler-errors:confusing-async-fn-note, r=estebankMatthias Krüger-190/+19
Remove confusing 'while checking' note from opaque future type mismatches Maybe I'm just misinterpreting the wording of the note. The only value I can see in this note is that it points out where the async's opaque future is coming from, but the way it's doing it is misleading IMO. For example: ```rust note: while checking the return type of the `async fn` --> $DIR/dont-suggest-missing-await.rs:7:24 | LL | async fn make_u32() -> u32 { | ^^^ checked the `Output` of this `async fn`, found opaque type ``` We point at the type `u32` in the HIR, but then say "found opaque type". We also say "while checking"... but we're typechecking a totally different function when we get this type mismatch! r? ``@estebank`` but feel free to reassign and/or take your time reviewing this. I'd be inclined to also discuss reworking the presentation of this type mismatch to restore some of these labels in a way that makes it more clear what it's trying to point out.
2023-02-02Reinstate the `hir-stats.rs` tests on stage 1.Nicholas Nethercote-1/+5
2023-02-01Add proc-macro boilerplate to crt-static testJoseph Ryan-0/+3
2023-02-01rustc_parse: migrate more to diagnostic structsXiretza-1/+1
2023-02-01tests: rename test cases to match new behaviourXiretza-2/+2
2023-02-01Fix condition for "missing `struct`" diagnostic on tuple structsXiretza-6/+41
The check previously matched this, and suggested adding a missing `struct`: pub Foo(...): It was probably intended to match this instead (semicolon instead of colon): pub Foo(...);
2023-02-01Forbid #[suggestion_*(...)] on VecsXiretza-2/+51
It is ambiguous whether this should produce several `.span_suggestions()` calls or one `.multipart_suggestions()` call.
2023-02-01Auto merge of #107257 - inquisitivecrystal:ffi-attr, r=davidtwcobors-3/+69
Strengthen validation of FFI attributes Previously, `codegen_attrs` validated the attributes `#[ffi_pure]`, `#[ffi_const]`, and `#[ffi_returns_twice]` to make sure that they were only used on foreign functions. However, this validation was insufficient in two ways: 1. `codegen_attrs` only sees items for which code must be generated, so it was unable to raise errors when the attribute was incorrectly applied to macros and the like. 2. the validation code only checked that the item with the attr was foreign, but not that it was a foreign function, allowing these attributes to be applied to foreign statics as well. This PR moves the validation to `check_attr`, which sees all items. It additionally changes the validation to ensure that the attribute's target is `Target::ForeignFunction`, only allowing the attributes on foreign functions and not foreign statics. Because these attributes are unstable, there is no risk for backwards compatibility. The changes also ending up making the code much easier to read. This PR is best reviewed commit by commit. Additionally, I was considering moving the tests to the `attribute` subdirectory, to get them out of the general UI directory. I could do that as part of this PR or a follow-up, as the reviewer prefers. CC: #58328, #58329
2023-02-01Rollup merge of #107533 - ↵Matthias Krüger-12/+12
pnkfelix:distinguish-generator-state-in-print-type-sizes, r=compiler-errors Extend `-Z print-type-sizes` to distinguish generator upvars+locals from "normal" fields. For example, for this code: ```rust async fn wait() {} async fn test(arg: [u8; 8192]) { wait().await; drop(arg); } async fn test_ideal(_rg: [u8; 8192]) { wait().await; // drop(arg); } fn main() { let gen_t = test([0; 8192]); let gen_i = test_ideal([0; 8192]); println!("expect {}, got: {}", std::mem::size_of_val(&gen_i), std::mem::size_of_val(&gen_t)); } ``` the `-Z print-type-sizes` output used to start with: ``` print-type-size type: `[async fn body@issue-62958-a.rs:3:32: 6:2]`: 16386 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Suspend0`: 16385 bytes print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size field `.arg`: 8192 bytes print-type-size field `.__awaitee`: 1 bytes ... print-type-size type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes print-type-size field `.value`: 8192 bytes ... ``` but with this change, it now instead prints: ``` print-type-size type: `[async fn body@issue-62958-a.rs:3:32: 6:2]`: 16386 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Suspend0`: 16385 bytes print-type-size upvar `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size local `.arg`: 8192 bytes print-type-size local `.__awaitee`: 1 bytes ... print-type-size type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes print-type-size field `.value`: 8192 bytes ``` (spawned off of investigation of https://github.com/rust-lang/rust/issues/62958 )
2023-02-01Rollup merge of #107499 - ↵Matthias Krüger-36/+0
compiler-errors:deduce_sig_from_projection-generator-tweak, r=michaelwoerister Do not depend on Generator trait when deducing closure signature 1. Do not depend on `Generator` trait when deducing closure signature. 2. Compare the name of the `Generator::Return` associated item, rather than its order in the trait. Seems more stable this way.
2023-02-01Rollup merge of #107487 - edward-shen:edward-shen/107213-round-2, r=estebankMatthias Krüger-6/+6
Make the "extra if in let...else block" hint a suggestion Changes the hint to a suggestion, suggested in #107213. r? ```@estebank```
2023-02-01Rollup merge of #107389 - zvavybir:master, r=estebankMatthias Krüger-5/+5
Fixing confusion between mod and remainder Like many programming languages, rust too confuses remainder and modulus. The `%` operator and the associated `Rem` trait is (as the trait name suggests) the remainder, but since most people are linguistically more familiar with the modulus the documentation sometimes claims otherwise. This PR tries to fix this problem in rustc.
2023-02-01Fix syntax in `-Zunpretty-expanded` output for derived `PartialEq`.Nicholas Nethercote-3/+3
If you do `derive(PartialEq)` on a packed struct, the output shown by `-Zunpretty=expanded` includes expressions like this: ``` { self.x } == { other.x } ``` This is invalid syntax. This doesn't break compilation, because the AST nodes are constructed within the compiler. But it does mean anyone using `-Zunpretty=expanded` output as a guide for hand-written impls could get a nasty surprise. This commit fixes things by instead using this form: ``` ({ self.x }) == ({ other.x }) ```
2023-02-01Auto merge of #107536 - GuillaumeGomez:rollup-xv7dx2h, r=GuillaumeGomezbors-5/+7
Rollup of 12 pull requests Successful merges: - #106898 (Include both md and yaml ICE ticket templates) - #107331 (Clean up eslint annotations and remove unused JS function) - #107348 (small refactor to new projection code) - #107354 (rustdoc: update Source Serif 4 from 4.004 to 4.005) - #107412 (avoid needless checks) - #107467 (Improve enum checks) - #107486 (Track bound types like bound regions) - #107491 (rustdoc: remove unused CSS from `.setting-check`) - #107508 (`Edition` micro refactor) - #107525 (PointeeInfo is advisory only) - #107527 (rustdoc: stop making unstable items transparent) - #107535 (Replace unwrap with ? in TcpListener doc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-01Erase regions before uninhabited checkMichael Goulet-0/+18
2023-01-31Bless updated output from print-type-sizes tests.Felix S. Klock II-12/+12
2023-01-31Rollup merge of #107527 - notriddle:notriddle/wcagcontrast, r=GuillaumeGomezGuillaume Gomez-5/+7
rustdoc: stop making unstable items transparent Fixes #93393
2023-01-31make unaligned_reference a hard errorRalf Jung-607/+65
2023-01-31rustdoc: stop making unstable items transparentMichael Howell-5/+7
Fixes #93393
2023-01-31Remove assignment.Camille GILLOT-78/+70
2023-01-31Remove both StorageLive and StorageDead in CopyProp.Camille GILLOT-38/+10
2023-01-31Add test.Camille GILLOT-0/+161
2023-01-31Auto merge of #106399 - estebank:type-err-span-label, r=nagisabors-888/+920
Modify primary span label for E0308 Looking at the reactions to https://hachyderm.io/`@ekuber/109622160673605438,` a lot of people seem to have trouble understanding the current output, where the primary span label on type errors talks about the specific types that diverged, but these can be deeply nested type parameters. Because of that we could see "expected i32, found u32" in the label while the note said "expected Vec<i32>, found Vec<u32>". This understandably confuses people. I believe that once people learn to read these errors it starts to make more sense, but this PR changes the output to be more in line with what people might expect, without sacrificing terseness. Fix #68220.
2023-01-31Auto merge of #100754 - davidtwco:translation-incremental, r=compiler-errorsbors-1/+1
incremental: migrate diagnostics - Apply the diagnostic migration lints to more functions on `Session`, namely: `span_warn`, `span_warn_with_code`, `warn` `note_without_error`, `span_note_without_error`, `struct_note_without_error`. - Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`. - Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs. r? `@compiler-errors` cc #100717
2023-01-31Do not depend on Generator trait when deducing closure signatureMichael Goulet-36/+0
2023-01-31Rollup merge of #107479 - compiler-errors:probe-can-call-ocx, r=BoxyUwUYuki Okushi-0/+56
Use `ObligationCtxt::new_in_snapshot` in `satisfied_from_param_env` We can evaluate nested `ConstEvaluatable` obligations in an evaluation probe, which will ICE if we use `ObligationCtxt::new`. Fixes #107474 Fixes #106666 r? `@BoxyUwU` but feel free to reassign cc `@JulianKnodt` who i think added this assertion code Not sure if the rustdoc test is needed, but can't hurt. They're the same root cause, though.
2023-01-31Rollup merge of #107476 - notriddle:notriddle/item-decl-3, r=GuillaumeGomezYuki Okushi-273/+272
rustdoc: remove unnecessary wrapper `div.item-decl` from HTML
2023-01-31Rollup merge of #107245 - compiler-errors:new-solver-unsizing, r=lcnrYuki Okushi-0/+66
Implement unsizing in the new trait solver This makes hello world compile! Ignore the first commit, that's just #107146 which is waiting on merge. I'll leave some comments inline about design choices that might be debatable. r? `@lcnr` (until we have a new trait solver reviewer group...)
2023-01-31Auto merge of #105650 - cassaundra:float-literal-suggestion, r=pnkfelixbors-0/+50
Fix invalid float literal suggestions when recovering an integer Only suggest adding a zero to integers with a preceding dot when the change will result in a valid floating point literal. For example, `.0x0` should not be turned into `0.0x0`. r? nnethercote
2023-01-30Make the "extra if in let...else block" hint a suggestionEdward Shen-6/+6
2023-01-30Fix unquoted projection types in labelEsteban Küber-1/+1
2023-01-30Make structured suggestion for fn casting verboseEsteban Küber-24/+35
2023-01-30Tweak E0271 wordingEsteban Küber-12/+12
2023-01-30Mention fn coercion rules (needs to be expanded)Esteban Küber-17/+36
2023-01-30Fix invalid float literal suggestions when recovering an integerCassaundra Smith-0/+50
Only suggest adding a zero to integers with a preceding dot when the change will result in a valid floating point literal. For example, `.0x0` should not be turned into `0.0x0`.
2023-01-30Tweak use of trimmed pathsEsteban Küber-37/+40
2023-01-30Hide lifetimes of `impl Trait` in force trimmed pathsEsteban Küber-1/+1
2023-01-30Do not mention lifetime names in force trimmed pathsEsteban Küber-40/+40