about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-02-03Rollup merge of #107602 - estebank:anon-enum-access, r=compiler-errorsMatthias Krüger-27/+125
Parse and recover from type ascription in patterns Reintroduce part of #106960, which was reverted in #107478. r? `@compiler-errors`
2023-02-03Rollup merge of #107500 - bryangarza:future-sizes-baseline-test, ↵Matthias Krüger-0/+94
r=compiler-errors Add tests to assert current behavior of large future sizes Based on a couple of sources: - https://swatinem.de/blog/future-size/ - https://github.com/rust-lang/rust/issues/62958
2023-02-03Rollup merge of #106805 - madsravn:master, r=compiler-errorsMatthias Krüger-0/+69
Suggest `{var:?}` when finding `{?:var}` in inline format strings Link to issue: https://github.com/rust-lang/rust/issues/106572 This is my first PR to this project, so hopefully I can get some good pointers with me from the first PR. Currently my idea was to test out whether or not this is the correct solution to this issue and then hopefully expand upon the idea to not only work for Debug formatting but for all of them. If this is a valid solution, I will create a new issue to give a better error message to a broader range of wrong-order formatting.
2023-02-03Rollup merge of #106575 - estebank:issue-64008, r=pnkfelixMatthias Krüger-5/+64
Suggest `move` in nested closure when appropriate Fix #64008.
2023-02-02Auto merge of #107000 - GuillaumeGomez:fix-items-in-doc-hidden-block, ↵bors-8/+129
r=notriddle,petrochenkov Fix handling of items inside a `doc(hidden)` block Fixes #106373. cc `@aDotInTheVoid` r? `@notriddle`
2023-02-02Parse and recover from type ascription in patternsEsteban Küber-27/+125
2023-02-02Suggest `move` in nested closure when appropriateEsteban Küber-5/+64
Fix #64008.
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-02PR fixing wrong order of format parameters in strings. Issue #106572Mads Ravn-0/+69
Adding Adding Fixing small issues for PR Adding tests Removing unused binding Changing the wording on note Fixing PR comment
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-02Bless tests after rebaseBryan Garza-14/+14
2023-02-02Update test to not trigger stack overflowBryan Garza-8/+5
2023-02-02Move ignore-pass to large-arg testBryan Garza-11/+11
2023-02-02Update based on PR commentsBryan Garza-3/+4
2023-02-02Add tests to assert current behavior of large future sizesBryan Garza-0/+96
Based on a couple of sources: - https://swatinem.de/blog/future-size/ - https://github.com/rust-lang/rust/issues/62958
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