Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typeck: Emit structured suggestions for tuple struct syntax #81737

Merged
merged 1 commit into from
Feb 6, 2021

Conversation

camelid
Copy link
Member

@camelid camelid commented Feb 4, 2021

And tuple variant syntax, but that didn't fit in the subject :)

Now the fact that these are suggestions is exposed both to the layout
engine and to IDEs and rustfix for automatic application.

@camelid camelid added A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Feb 4, 2021
@rust-highfive
Copy link
Collaborator

r? @lcnr

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 4, 2021
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_mir v0.0.0 (/checkout/compiler/rustc_mir)
error: named argument never used
    --> compiler/rustc_typeck/src/check/expr.rs:1474:41
     |
1471 | ...                   "`{adt}::{variant}(/* fields */)`",
     |                       ---------------------------------- formatting specifier missing
...
1474 | ...                   kind_name = kind_name
     |                                   ^^^^^^^^^ named argument never used
error: named argument never used
    --> compiler/rustc_typeck/src/check/expr.rs:1489:80
     |
     |
1489 |                         format!("`{adt}(/* fields */)`", adt = ty, kind_name = kind_name),
     |                                 -----------------------                        ^^^^^^^^^ named argument never used
     |                                 formatting specifier missing

    Checking rustc_plugin_impl v0.0.0 (/checkout/compiler/rustc_plugin_impl)
error[E0308]: mismatched types
error[E0308]: mismatched types
    --> /checkout/library/alloc/src/macros.rs:113:9
     |
110  | / macro_rules! format {
111  | |     ($($arg:tt)*) => {{
112  | |         let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
113  | |         res
     | |         ^^^ expected `&str`, found struct `std::string::String`
115  | | }
     | |_- in this expansion of `format!`
     | 
    ::: compiler/rustc_typeck/src/check/expr.rs:1465:25
    ::: compiler/rustc_typeck/src/check/expr.rs:1465:25
     |
1465 | /                         format!(
1466 | |                             "`{adt}::{variant}` is a tuple {kind_name}, use the appropriate syntax",
1467 | |                             adt = ty,
1468 | |                             variant = variant.ident
     | |_________________________- in this macro invocation

error[E0308]: mismatched types
    --> /checkout/library/alloc/src/macros.rs:113:9
    --> /checkout/library/alloc/src/macros.rs:113:9
     |
110  | / macro_rules! format {
111  | |     ($($arg:tt)*) => {{
112  | |         let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
113  | |         res
     | |         ^^^ expected `&str`, found struct `std::string::String`
115  | | }
     | |_- in this expansion of `format!`
     | 
    ::: compiler/rustc_typeck/src/check/expr.rs:1484:25
    ::: compiler/rustc_typeck/src/check/expr.rs:1484:25
     |
1484 | /                         format!(
1485 | |                             "`{adt}` is a tuple {kind_name}, use the appropriate syntax",
1486 | |                             adt = ty,
1487 | |                             kind_name = kind_name
     | |_________________________- in this macro invocation

error: aborting due to 4 previous errors


For more information about this error, try `rustc --explain E0308`.
error: could not compile `rustc_typeck`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--color" "always" "--features" " llvm max_level_info" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "-p" "rustc-main" "-p" "rustc_driver" "-p" "rustc_mir" "-p" "rustc_macros" "-p" "rustc_infer" "-p" "rustc_attr" "-p" "coverage_test_macros" "-p" "rustc_apfloat" "-p" "rustc_graphviz" "-p" "rustc_trait_selection" "-p" "rustc_parse_format" "-p" "rustc_lexer" "-p" "rustc_index" "-p" "rustc_ast_pretty" "-p" "rustc_error_codes" "-p" "rustc_target" "-p" "rustc_span" "-p" "rustc_arena" "-p" "rustc_session" "-p" "rustc_lint_defs" "-p" "rustc_fs_util" "-p" "rustc_interface" "-p" "rustc_codegen_llvm" "-p" "rustc_llvm" "-p" "rustc_ast_lowering" "-p" "rustc_resolve" "-p" "rustc_passes" "-p" "rustc_privacy" "-p" "rustc_builtin_macros" "-p" "rustc_traits" "-p" "rustc_ty_utils" "-p" "rustc_mir_build" "-p" "rustc_incremental" "-p" "rustc_expand" "-p" "rustc_ast_passes" "-p" "rustc_typeck" "-p" "rustc_symbol_mangling" "-p" "rustc_data_structures" "-p" "rustc_middle" "-p" "rustc_query_system" "-p" "rustc_type_ir" "-p" "rustc_errors" "-p" "rustc_serialize" "-p" "rustc_hir" "-p" "rustc_save_analysis" "-p" "rustc_metadata" "-p" "rustc_ast" "-p" "rustc_feature" "-p" "rustc_plugin_impl" "-p" "rustc_parse" "-p" "rustc_hir_pretty" "-p" "rustc_lint" "-p" "rustc_codegen_ssa" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:02:24

@camelid camelid force-pushed the typeck-structure-sugg branch from 710a10d to a7596d8 Compare February 4, 2021 05:49
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [ui] ui/issues/issue-4736.rs stdout ----
diff of stderr:

7 LL |     let z = NonCopyable{ p: () };
8    |             -----------  ^ field does not exist
9    |             |
-    |             `NonCopyable` is a tuple struct, use the appropriate syntax: `NonCopyable(/* fields */)`
+    |             help: `NonCopyable` is a tuple struct, use the appropriate syntax: ``NonCopyable(/* fields */)``
12 error: aborting due to previous error
13 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-4736/issue-4736.stderr
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-4736.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-4736.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-4736" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-4736/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0560]: struct `NonCopyable` has no field named `p`
   |
   |
LL | struct NonCopyable(());
   |        ----------- `NonCopyable` defined here
...
LL |     let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p`
   |             -----------  ^ field does not exist
   |             |
   |             help: `NonCopyable` is a tuple struct, use the appropriate syntax: ``NonCopyable(/* fields */)``
error: aborting due to previous error

For more information about this error, try `rustc --explain E0560`.


------------------------------------------


---- [ui] ui/issues/issue-80607.rs stdout ----
diff of stderr:

7 LL |     Enum::V1 { x }
8    |     --------   ^ field does not exist
9    |     |
-    |     `Enum::V1` is a tuple variant, use the appropriate syntax: `Enum::V1(/* fields */)`
+    |     help: `Enum::V1` is a tuple variant, use the appropriate syntax: ``Enum::V1(/* fields */)``
12 error: aborting due to previous error
13 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-80607/issue-80607.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-80607.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-80607.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-80607" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-80607/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0559]: variant `Enum::V1` has no field named `x`
   |
LL |     V1(i32),
LL |     V1(i32),
   |     -- `Enum::V1` defined here
...
LL |     Enum::V1 { x } //~ ERROR `Enum::V1` has no field named `x`
   |     --------   ^ field does not exist
   |     |
   |     help: `Enum::V1` is a tuple variant, use the appropriate syntax: ``Enum::V1(/* fields */)``
error: aborting due to previous error

For more information about this error, try `rustc --explain E0559`.


------------------------------------------


---- [ui] ui/numeric/numeric-fields.rs stdout ----
diff of stderr:

7 LL |     let s = S{0b1: 10, 0: 11};
8    |             - ^^^ field does not exist
9    |             |
-    |             `S` is a tuple struct, use the appropriate syntax: `S(/* fields */)`
+    |             help: `S` is a tuple struct, use the appropriate syntax: ``S(/* fields */)``
11 
12 error[E0026]: struct `S` does not have a field named `0x1`


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/numeric/numeric-fields/numeric-fields.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/numeric/numeric-fields/numeric-fields.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args numeric/numeric-fields.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/numeric/numeric-fields.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/numeric/numeric-fields" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/numeric/numeric-fields/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0560]: struct `S` has no field named `0b1`
   |
   |
LL | struct S(u8, u16);
   |        - `S` defined here
...
LL |     let s = S{0b1: 10, 0: 11};
   |             - ^^^ field does not exist
   |             |
   |             help: `S` is a tuple struct, use the appropriate syntax: ``S(/* fields */)``

error[E0026]: struct `S` does not have a field named `0x1`
   |
   |
LL |         S{0: a, 0x1: b, ..} => {}
   |                 ^^^ struct `S` does not have this field
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0026, E0560.
For more information about an error, try `rustc --explain E0026`.
---
test result: FAILED. 11282 passed; 3 failed; 92 ignored; 0 measured; 0 filtered out; finished in 140.85s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-9/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "9.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:16:20

@camelid camelid force-pushed the typeck-structure-sugg branch from a7596d8 to 22da73c Compare February 4, 2021 06:11
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [ui] ui/issues/issue-4736.rs stdout ----
diff of stderr:

7 LL |     let z = NonCopyable{ p: () };
8    |             -----------  ^ field does not exist
9    |             |
-    |             help: `NonCopyable` is a tuple struct, use the appropriate syntax: `NonCopyable(/* fields */)`
+    |             help: `NonCopyable` is a tuple struct, use the appropriate syntax: ``NonCopyable(/* fields */)``
12 error: aborting due to previous error
13 
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-4736/issue-4736.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-4736.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-4736.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-4736" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-4736/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0560]: struct `NonCopyable` has no field named `p`
   |
   |
LL | struct NonCopyable(());
   |        ----------- `NonCopyable` defined here
...
LL |     let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p`
   |             -----------  ^ field does not exist
   |             |
   |             help: `NonCopyable` is a tuple struct, use the appropriate syntax: ``NonCopyable(/* fields */)``
error: aborting due to previous error

For more information about this error, try `rustc --explain E0560`.


------------------------------------------


---- [ui] ui/issues/issue-80607.rs stdout ----
diff of stderr:

7 LL |     Enum::V1 { x }
8    |     --------   ^ field does not exist
9    |     |
-    |     help: `Enum::V1` is a tuple variant, use the appropriate syntax: `Enum::V1(/* fields */)`
+    |     help: `Enum::V1` is a tuple variant, use the appropriate syntax: ``Enum::V1(/* fields */)``
12 error: aborting due to previous error
13 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-80607/issue-80607.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args issues/issue-80607.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-80607.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-80607" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-80607/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0559]: variant `Enum::V1` has no field named `x`
   |
LL |     V1(i32),
LL |     V1(i32),
   |     -- `Enum::V1` defined here
...
LL |     Enum::V1 { x } //~ ERROR `Enum::V1` has no field named `x`
   |     --------   ^ field does not exist
   |     |
   |     help: `Enum::V1` is a tuple variant, use the appropriate syntax: ``Enum::V1(/* fields */)``
error: aborting due to previous error

For more information about this error, try `rustc --explain E0559`.


------------------------------------------


---- [ui] ui/numeric/numeric-fields.rs stdout ----
diff of stderr:

7 LL |     let s = S{0b1: 10, 0: 11};
8    |             - ^^^ field does not exist
9    |             |
-    |             help: `S` is a tuple struct, use the appropriate syntax: `S(/* fields */)`
+    |             help: `S` is a tuple struct, use the appropriate syntax: ``S(/* fields */)``
11 
12 error[E0026]: struct `S` does not have a field named `0x1`


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/numeric/numeric-fields/numeric-fields.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/numeric/numeric-fields/numeric-fields.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args numeric/numeric-fields.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/numeric/numeric-fields.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/numeric/numeric-fields" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/numeric/numeric-fields/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0560]: struct `S` has no field named `0b1`
   |
   |
LL | struct S(u8, u16);
   |        - `S` defined here
...
LL |     let s = S{0b1: 10, 0: 11};
   |             - ^^^ field does not exist
   |             |
   |             help: `S` is a tuple struct, use the appropriate syntax: ``S(/* fields */)``

error[E0026]: struct `S` does not have a field named `0x1`
   |
   |
LL |         S{0: a, 0x1: b, ..} => {}
   |                 ^^^ struct `S` does not have this field
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0026, E0560.
For more information about an error, try `rustc --explain E0026`.
---
test result: FAILED. 11282 passed; 3 failed; 92 ignored; 0 measured; 0 filtered out; finished in 137.79s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-9/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "9.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:15:06

And tuple variant syntax, but that didn't fit in the subject :)

Now the fact that these are suggestions is exposed both to the layout
engine and to IDEs and rustfix for automatic application.
@camelid camelid force-pushed the typeck-structure-sugg branch from 22da73c to ed62329 Compare February 4, 2021 19:59
@lcnr
Copy link
Contributor

lcnr commented Feb 6, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 6, 2021

📌 Commit ed62329 has been approved by lcnr

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 6, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 6, 2021
…as-schievink

Rollup of 7 pull requests

Successful merges:

 - rust-lang#81402 (tidy: Run tidy style against markdown files.)
 - rust-lang#81434 (BTree: fix documentation of unstable public members)
 - rust-lang#81680 (Refactor `PrimitiveTypeTable` for Clippy)
 - rust-lang#81737 (typeck: Emit structured suggestions for tuple struct syntax)
 - rust-lang#81738 (Miscellaneous small diagnostics cleanup)
 - rust-lang#81766 (Enable 'task list' markdown extension)
 - rust-lang#81812 (Add a test for escaping LLVMisms in inline asm)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f631410 into rust-lang:master Feb 6, 2021
@rustbot rustbot added this to the 1.52.0 milestone Feb 6, 2021
@camelid camelid deleted the typeck-structure-sugg branch February 7, 2021 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants