about summary refs log tree commit diff
path: root/src/test/ui/structs/struct-record-suggestion.fixed
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-23 15:12:09 +0000
committerbors <bors@rust-lang.org>2022-08-23 15:12:09 +0000
commita1bea1551b8312b6abfbbf7d49bafac2e6ce8ee4 (patch)
tree0ed13d7fbdb1bbecb2499452d47625c915ec93b2 /src/test/ui/structs/struct-record-suggestion.fixed
parent1cff5642037b83ce1239a624bbe617a9aa0d59b1 (diff)
parent28ead17745916a602fed4ed41a104fb7856544f5 (diff)
Auto merge of #100920 - Dylan-DPC:rollup-vlcw3sr, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #99249 (Do not re-parse function signatures to suggest generics)
 - #100309 (Extend comma suggestion to cases where fields arent missing)
 - #100368 (InferCtxt tainted_by_errors_flag should be Option<ErrorGuaranteed>)
 - #100768 (Migrate `rustc_plugin_impl` to `SessionDiagnostic`)
 - #100835 (net listen backlog update, follow-up from #97963.)
 - #100851 (Fix rustc_parse_format precision & width spans)
 - #100857 (Refactor query modifier parsing)
 - #100907 (Fix typo in UnreachableProp)
 - #100909 (Minor `ast::LitKind` improvements)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/ui/structs/struct-record-suggestion.fixed')
-rw-r--r--src/test/ui/structs/struct-record-suggestion.fixed24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/test/ui/structs/struct-record-suggestion.fixed b/src/test/ui/structs/struct-record-suggestion.fixed
index 48144cd1ce2..49e38b196de 100644
--- a/src/test/ui/structs/struct-record-suggestion.fixed
+++ b/src/test/ui/structs/struct-record-suggestion.fixed
@@ -6,11 +6,29 @@ struct A {
     d: usize,
 }
 
-fn main() {
-    let q = A { c: 5, .. Default::default() };
+fn a() {
+    let q = A { c: 5,..Default::default() };
     //~^ ERROR mismatched types
     //~| ERROR missing fields
     //~| HELP separate the last named field with a comma
-    let r = A { c: 5, .. Default::default() };
+    let r = A { c: 5, ..Default::default() };
     assert_eq!(q, r);
 }
+
+#[derive(Debug, Default, Eq, PartialEq)]
+struct B {
+    b: u32,
+}
+
+fn b() {
+    let q = B { b: 1,..Default::default() };
+    //~^ ERROR mismatched types
+    //~| HELP separate the last named field with a comma
+    let r = B { b: 1 };
+    assert_eq!(q, r);
+}
+
+fn main() {
+    a();
+    b();
+}