rust icon indicating copy to clipboard operation
rust copied to clipboard

Suppress suggestions in derive macro

Open long-long-float opened this issue 1 year ago • 15 comments

close #118809

I suppress warnings inside derive macros.

For example, the compiler emits following error by a program described in https://github.com/rust-lang/rust/issues/118809#issuecomment-1852256687 with a suggestion that indicates invalid syntax.

error[E0308]: `?` operator has incompatible types
 --> src/main.rs:3:17
  |
3 | #[derive(Debug, Deserialize)]
  |                 ^^^^^^^^^^^ expected `u32`, found `u64`
  |
  = note: `?` operator cannot convert from `u64` to `u32`
  = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
  |
3 | #[derive(Debug, Deserialize.try_into().unwrap())]
  |                            ++++++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `serde_test` (bin "serde_test") due to 2 previous errors

In this PR, suggestions to cast are suppressed.

error[E0308]: `?` operator has incompatible types
 --> src/main.rs:3:17
  |
3 | #[derive(Debug, Deserialize)]
  |                 ^^^^^^^^^^^ expected `u32`, found `u64`
  |
  = note: `?` operator cannot convert from `u64` to `u32`
  = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0308`.
error: could not compile `serde_test` (bin "serde_test") due to 2 previous errors

long-long-float avatar Jan 23 '24 16:01 long-long-float

r? @oli-obk

(rustbot has picked a reviewer for you, use r? to override)

rustbot avatar Jan 23 '24 16:01 rustbot

LGTM (please don't take my word for it, I've only messed with this section of the compiler twice :D ).

I am qualified enough to ask for a squash though.

Teapot4195 avatar Jan 23 '24 19:01 Teapot4195

@Teapot4195 Thank you for comment. I squashed my commits.

long-long-float avatar Jan 24 '24 04:01 long-long-float

I think we could check this directly in push_suggestion, so that no suggestions at all get reported on expansions of derives. Can you try that out and see if it works for you?

Adding a test for this is rather involved I'd presume, so manually testing it seems ok to me. But if you wanna try adding a test, we do have tests like /home/ubuntu/rustc/rust10/tests/ui/proc-macro/derive-b.rs so you can probably just copy one of these tests and their derive and create a derive that will always emit your diagnostic.

oli-obk avatar Jan 24 '24 08:01 oli-obk

@oli-obk Thank you for your suggestion. I fixed to check in push_suggestion. I will try to add a test tomorrow.

long-long-float avatar Jan 24 '24 15:01 long-long-float

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

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_59cc0208-8fd7-4145-a682-7d85b7aa43c4
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=suppress-suggestions-in-derive-macro
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_59cc0208-8fd7-4145-a682-7d85b7aa43c4
GITHUB_REF=refs/pull/120272/merge
GITHUB_REF_NAME=120272/merge
GITHUB_REF_PROTECTED=false
---
Built container sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Looks like docker image is the same as before, not uploading
https://ci-caches.rust-lang.org/docker/7ebc15c01a233894034d277c8cce4e949f4e7791f66b4727c8fb6e058a0b8171d6152e1441d677cef0653843ceeee469c097b8699b2bb74249e674f6aa1a8813
sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Wed Jan 24 15:14:59 UTC 2024
  network time: Wed, 24 Jan 2024 15:14:59 GMT
  network time: Wed, 24 Jan 2024 15:14:59 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
..........................i............................................................. 11000/16046
........................................................................................ 11088/16046
........................................................................................ 11176/16046
........................................................................................ 11264/16046
..............................................F.F....................................... 11352/16046
........................................................................................ 11528/16046
........................................................................................ 11616/16046
.................................................ii................i.....iii............ 11704/16046
........................................................................................ 11792/16046
---
13    |         unsatisfied trait bound introduced here
14    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
- help: consider further restricting the associated type
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
19 
20 error: aborting due to 1 previous error
21 

---
To only update this specific test, also pass `--test-args associated-types/issue-38821.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/associated-types/issue-38821.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/issue-38821" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/issue-38821/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
Build completed unsuccessfully in 0:13:12
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                 ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

---

---- [ui] tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs stdout ----
diff of stderr:

12 LL | #[derive(Eq, PartialEq)]
13    |          -- lifetime `'b` is missing in item created through this procedural macro
14 LL | struct Test {
-    |            - help: consider introducing lifetime `'b` here: `<'b>`
16 LL |     a: &'b str,
17    |         ^^ undeclared lifetime


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152/auxiliary"
--- stderr -------------------------------
error[E0261]: use of undeclared lifetime name `'b`
##[error]  --> /checkout/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9
   |
   |
LL | struct Test {
   |            - help: consider introducing lifetime `'b` here: `<'b>`
LL |     a: &'b str,
   |         ^^ undeclared lifetime
error[E0261]: use of undeclared lifetime name `'b`
##[error]  --> /checkout/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9
   |
   |
LL | #[derive(Eq, PartialEq)]
   |          -- lifetime `'b` is missing in item created through this procedural macro
LL | struct Test {
LL |     a: &'b str,
   |         ^^ undeclared lifetime
error[E0261]: use of undeclared lifetime name `'b`
##[error]  --> /checkout/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:13:13
   |
   |
LL |     fn foo(&'b self) {} //~ ERROR use of undeclared lifetime name `'b`
   |             ^^ undeclared lifetime
   |
help: consider introducing lifetime `'b` here
   |
LL |     fn foo<'b>(&'b self) {} //~ ERROR use of undeclared lifetime name `'b`
   |           ++++
help: consider introducing lifetime `'b` here
   |
LL | impl<'b> T for Test {

error: aborting due to 3 previous errors

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


---- [ui] tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs stdout ----
diff of stderr:

14    |
15 LL |     struct Foo([u8; S]);
-    |
- help: you might be missing a const parameter
-    |
-    |
- LL |     struct Foo<const S: /* Type */>([u8; S]);
22 
23 error[E0658]: `impl Trait` in type aliases is unstable
24   --> $DIR/issue-119778-type-error-ice.rs:9:14

---
--- stderr -------------------------------
error[E0425]: cannot find value `S` in this scope
##[error]  --> /checkout/tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs:5:21
   |
LL |     struct Foo([u8; S]);
   |
help: you might be missing a const parameter
   |
   |
LL |     struct Foo<const S: /* Type */>([u8; S]);

error[E0425]: cannot find value `S` in this scope
##[error]  --> /checkout/tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs:5:21
   |
   |
LL |     struct Foo([u8; S]);

error[E0658]: `impl Trait` in type aliases is unstable
##[error]  --> /checkout/tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs:9:14
   |
   |
LL |     type U = impl Copy;
   |              ^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0425, E0658.
For more information about an error, try `rustc --explain E0425`.
---
11    |                ^^^^^^^^^^^ not found in this scope
12    |
- help: you might be missing a type parameter
-    |
- LL |     struct Foo<NonExistent>(NonExistent);
-    |               +++++++++++++
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
18 error[E0658]: `impl Trait` in type aliases is unstable
19   --> $DIR/issue-119493-type-error-ice.rs:9:14


---
   |
LL |     struct Foo(NonExistent);
   |                ^^^^^^^^^^^ not found in this scope
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0658]: `impl Trait` in type aliases is unstable
##[error]  --> /checkout/tests/ui/pattern/usefulness/issue-119493-type-error-ice.rs:9:14
   |
LL |     type U = impl Copy;
LL |     type U = impl Copy;
   |              ^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0412, E0658.
For more information about an error, try `rustc --explain E0412`.
For more information about an error, try `rustc --explain E0412`.
------------------------------------------


---- [ui] tests/ui/traits/issue-50480.rs stdout ----
diff of stderr:

20    |
21 LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
-    |
- help: you might be missing a type parameter
-    |
-    |
- LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
28 
29 error[E0412]: cannot find type `NotDefined` in this scope
30   --> $DIR/issue-50480.rs:3:15


32 LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
34    |
- help: you might be missing a type parameter
-    |
-    |
- LL | struct Foo<NotDefined>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
-    |           ++++++++++++
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
40 error[E0412]: cannot find type `N` in this scope
41   --> $DIR/issue-50480.rs:11:18



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480/issue-50480.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args traits/issue-50480.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/issue-50480.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480/auxiliary"
--- stderr -------------------------------
error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:12
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |
help: you might be missing a type parameter
   |
   |
LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:15
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:12
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:15
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:11:18
   |
   |
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |            |
   |            similarly named type parameter `T` defined here
   |
help: a type parameter with a similar name exists
help: a type parameter with a similar name exists
   |
LL | struct Bar<T>(T, T, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
help: you might be missing a type parameter
   |
   |
LL | struct Bar<T, N>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:11:21
   |
   |
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0204]: the trait `Copy` cannot be implemented for this type
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:1:17
   |
   |
LL | #[derive(Clone, Copy)]
   |                 ^^^^
LL | //~^ ERROR the trait `Copy` cannot be implemented for this type
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                                                    |
   |                                                    this field does not implement `Copy`
   |
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0204]: the trait `Copy` cannot be implemented for this type
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:9:17
   |
LL | #[derive(Clone, Copy)]
   |                 ^^^^
LL | //~^ ERROR the trait `Copy` cannot be implemented for this type
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                                                          |
   |                                                          this field does not implement `Copy`
   |
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

rust-log-analyzer avatar Jan 24 '24 15:01 rust-log-analyzer

Looks like rustc has tests 😆 try running ./x.py test --bless, that should do it. Though potentially clippy is also affected, so you'd need to bless that, too

oli-obk avatar Jan 24 '24 15:01 oli-obk

@oli-obk Thank you for telling me. I checked the result of test and noticed that some valid suggestions are removed after modification.

--- a/tests/ui/pattern/usefulness/issue-119778-type-error-ice.stderr
+++ b/tests/ui/pattern/usefulness/issue-119778-type-error-ice.stderr
@@ -14,11 +14,6 @@ error[E0425]: cannot find value `S` in this scope
    |
 LL |     struct Foo([u8; S]);
    |                     ^ not found in this scope
-   |
-help: you might be missing a const parameter
-   |
-LL |     struct Foo<const S: /* Type */>([u8; S]);
-   |               +++++++++++++++++++++

 error[E0658]: `impl Trait` in type aliases is unstable

I think the reason of test failure is that the checks in push_suggestion are affecting other suggestions than casting (checking in suggest_cast). To minimize effect, I think it's better to check in suggest_cast. I would like to hear your opinion.

long-long-float avatar Jan 25 '24 10:01 long-long-float

I think it's ok to lose this suggestion if it is still reported in another error in the same test. If that is not the case, then we need to figure out why this code is marked as expanded by a derive.

oli-obk avatar Jan 25 '24 13:01 oli-obk

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

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_38b30a0d-1be5-417b-99ca-67c48483aa55
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=suppress-suggestions-in-derive-macro
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_38b30a0d-1be5-417b-99ca-67c48483aa55
GITHUB_REF=refs/pull/120272/merge
GITHUB_REF_NAME=120272/merge
GITHUB_REF_PROTECTED=false
---
Built container sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Looks like docker image is the same as before, not uploading
https://ci-caches.rust-lang.org/docker/7ebc15c01a233894034d277c8cce4e949f4e7791f66b4727c8fb6e058a0b8171d6152e1441d677cef0653843ceeee469c097b8699b2bb74249e674f6aa1a8813
sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Sat Jan 27 16:55:11 UTC 2024
  network time: Sat, 27 Jan 2024 16:55:11 GMT
  network time: Sat, 27 Jan 2024 16:55:11 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
13    |         unsatisfied trait bound introduced here
14    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
- help: consider further restricting the associated type
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
19 
19 
20 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

73    |         |
74    |         unsatisfied trait bound introduced here
75    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
75    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
- help: consider further restricting the associated type
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
80 
80 
81 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

93    |         unsatisfied trait bound introduced here
93    |         unsatisfied trait bound introduced here
94    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- help: consider further restricting the associated type
-    |
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
100 
100 
101 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

111    |         -------  ^^^^^^^^^^^^     ^
112    |         |
113    |         unsatisfied trait bound introduced here
113    |         unsatisfied trait bound introduced here
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
115 
115 
116 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
144    |         unsatisfied trait bound introduced here
144    |         unsatisfied trait bound introduced here
145    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
146    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
-    |
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
151 
151 
152 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

163    |         |
164    |         unsatisfied trait bound introduced here
165    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
165    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
- help: consider further restricting the associated type
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
170 
170 
171 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

183    |         unsatisfied trait bound introduced here
183    |         unsatisfied trait bound introduced here
184    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- help: consider further restricting the associated type
-    |
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
190 
190 
191 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

201    |         -------  ^^^^^^^^^^^^     ^
202    |         |
203    |         unsatisfied trait bound introduced here
203    |         unsatisfied trait bound introduced here
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
205 
205 
206 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/issue-38821/issue-38821.stderr
To update references, rerun the tests and pass the `--bless` flag
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args associated-types/issue-38821.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/associated-types/issue-38821.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/issue-38821" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/issue-38821/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                 ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
   |
LL | pub enum ColumnInsertValue<Col, Expr> where
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
   |
LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
   |
LL | / pub enum ColumnInsertValue<Col, Expr> where
LL | | //~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
LL | | //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
LL | |     Col: Column,
LL | |     Default(Col),
LL | | }
LL | | }
   | |_^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
   |
LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                 ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: aborting due to 16 previous errors

For more information about this error, try `rustc --explain E0277`.
---
11    |                ^^^^^^^^^^^ not found in this scope
12    |
- help: you might be missing a type parameter
-    |
- LL |     struct Foo<NonExistent>(NonExistent);
-    |               +++++++++++++
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
18 error[E0658]: `impl Trait` in type aliases is unstable
19   --> $DIR/issue-119493-type-error-ice.rs:9:14


---
   |
LL |     struct Foo(NonExistent);
   |                ^^^^^^^^^^^ not found in this scope
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0658]: `impl Trait` in type aliases is unstable
##[error]  --> /checkout/tests/ui/pattern/usefulness/issue-119493-type-error-ice.rs:9:14
   |
LL |     type U = impl Copy;
LL |     type U = impl Copy;
   |              ^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0412, E0658.
For more information about an error, try `rustc --explain E0412`.
For more information about an error, try `rustc --explain E0412`.
------------------------------------------


---- [ui] tests/ui/traits/issue-50480.rs stdout ----
diff of stderr:

27 LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
29    |
- help: you might be missing a type parameter
-    |
-    |
- LL | struct Foo<NotDefined>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
-    |           ++++++++++++
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
35 error[E0412]: cannot find type `N` in this scope
36   --> $DIR/issue-50480.rs:11:18



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480/issue-50480.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args traits/issue-50480.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/issue-50480.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480/auxiliary"
--- stderr -------------------------------
error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:12
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |
help: you might be missing a type parameter
   |
   |
LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:15
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:12
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:15
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:11:18
   |
   |
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |            |
   |            similarly named type parameter `T` defined here
   |
help: a type parameter with a similar name exists
help: a type parameter with a similar name exists
   |
LL | struct Bar<T>(T, T, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
help: you might be missing a type parameter
   |
   |
LL | struct Bar<T, N>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:11:21
   |
   |
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0204]: the trait `Copy` cannot be implemented for this type
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:1:17
   |
   |
LL | #[derive(Clone, Copy)]
   |                 ^^^^
LL | //~^ ERROR the trait `Copy` cannot be implemented for this type
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                                                    |
   |                                                    this field does not implement `Copy`
   |
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0204]: the trait `Copy` cannot be implemented for this type
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:9:17
   |
LL | #[derive(Clone, Copy)]
   |                 ^^^^
LL | //~^ ERROR the trait `Copy` cannot be implemented for this type
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                                                          |
   |                                                          this field does not implement `Copy`
   |
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

rust-log-analyzer avatar Jan 27 '24 17:01 rust-log-analyzer

some tests are still failing

oli-obk avatar Jan 29 '24 13:01 oli-obk

@oli-obk I noticed that. And I investigated how to explain why some code is marked as expanded by a derive.

I have one assumption of this. For example, the suggestion in tests/ui/associated-types/issue-38821.rs is suppressed in this PR.

--- a/tests/ui/associated-types/issue-38821.stderr
+++ b/tests/ui/associated-types/issue-38821.stderr
@@ -12,10 +12,6 @@ LL | impl<T: NotNull> IntoNullable for T {
    |         |
    |         unsatisfied trait bound introduced here
    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: consider further restricting the associated type
-   |
-LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
-   |                                                                       +++++++++++++++++++++++++++++++++++++++
 
 error: aborting due to 1 previous error

This suggestion is came from Copy. It can be also checked from part.span.ctxt().outer_expn_data().

part.span.ctxt().outer_expn_data() = ExpnData {
    kind: Macro(
        Derive,
        "Copy",
    ),
    parent: crate0::{{expn2}},
    call_site: test.rs:23:17: 23:21 (#0),
    disambiguator: 0,
    def_site: /rust/library/core/src/marker.rs:480:1: 480:15 (#0),
    allow_internal_unstable: Some(
        [
            "core_intrinsics",
            "derive_clone_copy",
        ],
    ),
    edition: Edition2021,
    macro_def_id: Some(
        DefId(2:2960 ~ core[36fa]::marker::Copy),
    ),
    parent_module: Some(
        DefId(2:2944 ~ core[36fa]::marker),
    ),
    allow_internal_unsafe: false,
    local_inner_macros: false,
    collapse_debuginfo: false,
}

Also I checked the result of expansion by -Zunpretty=expanded.

// ...
//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied                                                     
pub enum ColumnInsertValue<Col, Expr> where Col: Column,                                                                                
    Expr: Expression<SqlType = <Col::SqlType as IntoNullable>::Nullable> {                                                              
    Expression(Col, Expr),                                                                                                              
    Default(Col),                                                                                                                       
}                                                                                                                                       
// ...
#[automatically_derived]
impl<Col: ::core::marker::Copy, Expr: ::core::marker::Copy>
    ::core::marker::Copy for ColumnInsertValue<Col, Expr> where Col: Column,
    Expr: Expression<SqlType = <Col::SqlType as IntoNullable>::Nullable> /* here? */ {
}
// ...

I am guessing that the suggestion is in the here? location, but I don't know how to explain it exactly.

Could you tell me how to explain this or is there better explanation? Thank you.

long-long-float avatar Jan 29 '24 16:01 long-long-float

Ah yea, that makes sense :/ Not sure what the best way forward is.

I guess ideally we'd make the expansion somehow signal that it is referring to code copied from non-expanded code (in contrast to fully generated code, which is what the original issue was about).

That would require modifying our derives, and would not help for proc macro derives, for which I don't know how we can address it at this point.

oli-obk avatar Jan 29 '24 16:01 oli-obk

@oli-obk If the suggest position(Span) is within the original code's derive(...) in the original code, it can be suppressed. However it is possible that there is a correct suggestion even within the derive(...).

I think the essence of this problem is that it is necessary to determine whether a suggestion is grammatically correct or not. It would be impossible to determine that using only in_derive_expansion. Even the simple method of judging in the first suggest_cast may suppress a correct suggestion.

As a different approach, I have an idea to check if the code to which the suggestion is applied is grammatically correct, and suppress it if it is not. I would like to implement a PoC if I can afford it.

long-long-float avatar Feb 02 '24 03:02 long-long-float

As a different approach, I have an idea to check if the code to which the suggestion is applied is grammatically correct, and suppress it if it is not. I would like to implement a PoC if I can afford it.

that sound scary. I don't think we should go down that route (if I understand correctly what you're trying to do)

I think the essence of this problem is that it is necessary to determine whether a suggestion is grammatically correct or not. It would be impossible to determine that using only in_derive_expansion. Even the simple method of judging in the first suggest_cast may suppress a correct suggestion.

that sounds doable. we store information about the derive's span in the expansion info. So we could check if it overlaps with that.

oli-obk avatar Feb 02 '24 14:02 oli-obk

@oli-obk On second thought, your suggested method seems to solve the issue. However, let me confirm that I did not fully understand how to implement it.

  1. In derive exapantion, we store information about the derive's span in the expansion info ExpnData .

    // in ExpnData
    /// Whether this ExpnData is between an attribute `derive(...)`
    bool in_derive_attribute,
    
  2. In push_suggestion , we check whether spans are in derive(...) using the information, not using in_derive_expansion

    • We just check in_derive_attribute

I don't (can't) take care about proc-macro now.

long-long-float avatar Feb 04 '24 08:02 long-long-float

That sounds good to me. We can figure out proc macros later, doesn't have to be in this PR

oli-obk avatar Feb 04 '24 09:02 oli-obk

Thank you! I will implement by this method.

long-long-float avatar Feb 04 '24 15:02 long-long-float

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

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6f9be6ba-8da3-4fa1-b51f-0a95738dc9f7
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=suppress-suggestions-in-derive-macro
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6f9be6ba-8da3-4fa1-b51f-0a95738dc9f7
GITHUB_REF=refs/pull/120272/merge
GITHUB_REF_NAME=120272/merge
GITHUB_REF_PROTECTED=false
---
#12 writing image sha256:5d9da521dfb082222be20353fa1c1a6e7ffa90b44fabc21c4922dde85948b2af done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.1s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Mon Feb  5 15:35:06 UTC 2024
  network time: Mon, 05 Feb 2024 15:35:06 GMT
  network time: Mon, 05 Feb 2024 15:35:06 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
13    |         unsatisfied trait bound introduced here
14    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
- help: consider further restricting the associated type
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
19 
19 
20 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

73    |         |
74    |         unsatisfied trait bound introduced here
75    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
75    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
- help: consider further restricting the associated type
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
80 
80 
81 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

93    |         unsatisfied trait bound introduced here
93    |         unsatisfied trait bound introduced here
94    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- help: consider further restricting the associated type
-    |
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
100 
100 
101 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

111    |         -------  ^^^^^^^^^^^^     ^
112    |         |
113    |         unsatisfied trait bound introduced here
113    |         unsatisfied trait bound introduced here
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
115 
115 
116 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
144    |         unsatisfied trait bound introduced here
144    |         unsatisfied trait bound introduced here
145    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
146    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
-    |
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
151 
151 
152 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

163    |         |
164    |         unsatisfied trait bound introduced here
165    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
165    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
- help: consider further restricting the associated type
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
170 
170 
171 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

183    |         unsatisfied trait bound introduced here
183    |         unsatisfied trait bound introduced here
184    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
- help: consider further restricting the associated type
-    |
-    |
- LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
190 
190 
191 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

201    |         -------  ^^^^^^^^^^^^     ^
202    |         |
203    |         unsatisfied trait bound introduced here
203    |         unsatisfied trait bound introduced here
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
205 
205 
206 error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied

The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/issue-38821/issue-38821.stderr
To update references, rerun the tests and pass the `--bless` flag
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args associated-types/issue-38821.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/associated-types/issue-38821.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/issue-38821" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/associated-types/issue-38821/auxiliary"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                 ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
   |
LL | pub enum ColumnInsertValue<Col, Expr> where
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
   |
LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
   |
LL | / pub enum ColumnInsertValue<Col, Expr> where
LL | | //~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
LL | | //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
LL | |     Col: Column,
LL | |     Default(Col),
LL | | }
LL | | }
   | |_^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
   |
LL |     Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                 ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
Build completed unsuccessfully in 0:13:02
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |          ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`


error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
   |
LL | #[derive(Debug, Copy, Clone)]
LL | #[derive(Debug, Copy, Clone)]
   |                       ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable`
   |
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
   |
   |
LL | impl<T: NotNull> IntoNullable for T {
   |         |
   |         unsatisfied trait bound introduced here
   |         unsatisfied trait bound introduced here
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: aborting due to 16 previous errors

For more information about this error, try `rustc --explain E0277`.
---
11    |                ^^^^^^^^^^^ not found in this scope
12    |
- help: you might be missing a type parameter
-    |
- LL |     struct Foo<NonExistent>(NonExistent);
-    |               +++++++++++++
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
18 error[E0658]: `impl Trait` in type aliases is unstable
19   --> $DIR/issue-119493-type-error-ice.rs:9:14


---
   |
LL |     struct Foo(NonExistent);
   |                ^^^^^^^^^^^ not found in this scope
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0658]: `impl Trait` in type aliases is unstable
##[error]  --> /checkout/tests/ui/pattern/usefulness/issue-119493-type-error-ice.rs:9:14
   |
LL |     type U = impl Copy;
LL |     type U = impl Copy;
   |              ^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0412, E0658.
For more information about an error, try `rustc --explain E0412`.
For more information about an error, try `rustc --explain E0412`.
------------------------------------------


---- [ui] tests/ui/traits/issue-50480.rs stdout ----
diff of stderr:

27 LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
29    |
- help: you might be missing a type parameter
-    |
-    |
- LL | struct Foo<NotDefined>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
-    |           ++++++++++++
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
35 error[E0412]: cannot find type `N` in this scope
36   --> $DIR/issue-50480.rs:11:18



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480/issue-50480.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args traits/issue-50480.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/issue-50480.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480/auxiliary"
--- stderr -------------------------------
error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:12
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |
help: you might be missing a type parameter
   |
   |
LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:15
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:12
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:15
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |
   |
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:11:18
   |
   |
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |            |
   |            similarly named type parameter `T` defined here
   |
help: a type parameter with a similar name exists
help: a type parameter with a similar name exists
   |
LL | struct Bar<T>(T, T, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
help: you might be missing a type parameter
   |
   |
LL | struct Bar<T, N>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:11:21
   |
   |
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0204]: the trait `Copy` cannot be implemented for this type
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:1:17
   |
   |
LL | #[derive(Clone, Copy)]
   |                 ^^^^
LL | //~^ ERROR the trait `Copy` cannot be implemented for this type
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                                                    |
   |                                                    this field does not implement `Copy`
   |
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0204]: the trait `Copy` cannot be implemented for this type
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:9:17
   |
LL | #[derive(Clone, Copy)]
   |                 ^^^^
LL | //~^ ERROR the trait `Copy` cannot be implemented for this type
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                                                          |
   |                                                          this field does not implement `Copy`
   |
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

rust-log-analyzer avatar Feb 05 '24 15:02 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_ed4abcdb-c6d1-44b0-b3e5-a80a2aac34e1
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=suppress-suggestions-in-derive-macro
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_ed4abcdb-c6d1-44b0-b3e5-a80a2aac34e1
GITHUB_REF=refs/pull/120272/merge
GITHUB_REF_NAME=120272/merge
GITHUB_REF_PROTECTED=false
---
#12 writing image sha256:a6515694a95dc13d76397f8279773f084da529714a05b0b073c6ad953db297a6 done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.0s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Thu Feb  8 16:09:55 UTC 2024
  network time: Thu, 08 Feb 2024 16:09:55 GMT
  network time: Thu, 08 Feb 2024 16:09:55 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---

---- [ui] tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs stdout ----
diff of stderr:

12 LL | #[derive(Eq, PartialEq)]
13    |          -- lifetime `'b` is missing in item created through this procedural macro
14 LL | struct Test {
+    |            - help: consider introducing lifetime `'b` here: `<'b>`
15 LL |     a: &'b str,
16    |         ^^ undeclared lifetime


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152/auxiliary"
--- stderr -------------------------------
error[E0261]: use of undeclared lifetime name `'b`
##[error]  --> /checkout/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9
   |
   |
LL | struct Test {
   |            - help: consider introducing lifetime `'b` here: `<'b>`
LL |     a: &'b str,
   |         ^^ undeclared lifetime

error[E0261]: use of undeclared lifetime name `'b`
##[error]  --> /checkout/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9
   |
   |
LL | #[derive(Eq, PartialEq)]
   |          -- lifetime `'b` is missing in item created through this procedural macro
LL | struct Test {
   |            - help: consider introducing lifetime `'b` here: `<'b>`
LL |     a: &'b str,
   |         ^^ undeclared lifetime
error[E0261]: use of undeclared lifetime name `'b`
##[error]  --> /checkout/tests/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:13:13
   |
   |
LL |     fn foo(&'b self) {} //~ ERROR use of undeclared lifetime name `'b`
   |             ^^ undeclared lifetime
   |
help: consider introducing lifetime `'b` here
   |
LL |     fn foo<'b>(&'b self) {} //~ ERROR use of undeclared lifetime name `'b`
   |           ++++
help: consider introducing lifetime `'b` here
   |
LL | impl<'b> T for Test {

error: aborting due to 3 previous errors

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


---- [ui] tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs stdout ----
diff of stderr:

14    |
15 LL |     struct Foo([u8; S]);
+    |
+ help: you might be missing a const parameter
+    |
+    |
+ LL |     struct Foo<const S: /* Type */>([u8; S]);
17 
18 error[E0658]: `impl Trait` in type aliases is unstable
19   --> $DIR/issue-119778-type-error-ice.rs:9:14

---
--- stderr -------------------------------
error[E0425]: cannot find value `S` in this scope
##[error]  --> /checkout/tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs:5:21
   |
LL |     struct Foo([u8; S]);
   |
help: you might be missing a const parameter
   |
   |
LL |     struct Foo<const S: /* Type */>([u8; S]);

error[E0425]: cannot find value `S` in this scope
##[error]  --> /checkout/tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs:5:21
   |
   |
LL |     struct Foo([u8; S]);
   |
help: you might be missing a const parameter
   |
   |
LL |     struct Foo<const S: /* Type */>([u8; S]);

error[E0658]: `impl Trait` in type aliases is unstable
##[error]  --> /checkout/tests/ui/pattern/usefulness/issue-119778-type-error-ice.rs:9:14
   |
   |
LL |     type U = impl Copy;
   |              ^^^^^^^^^
   |
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
   = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0425, E0658.
For more information about an error, try `rustc --explain E0425`.
For more information about an error, try `rustc --explain E0425`.
------------------------------------------


---- [ui] tests/ui/traits/issue-50480.rs stdout ----
diff of stderr:

20    |
21 LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
+    |
+ help: you might be missing a type parameter
+    |
+    |
+ LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
23 
24 error[E0412]: cannot find type `NotDefined` in this scope
25   --> $DIR/issue-50480.rs:3:15

---
To only update this specific test, also pass `--test-args traits/issue-50480.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/issue-50480.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-50480/auxiliary"
--- stderr -------------------------------
error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:12
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |
help: you might be missing a type parameter
   |
   |
LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:15
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:12
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |
help: you might be missing a type parameter
   |
   |
LL | struct Foo<N>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:15
   |
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |
help: you might be missing a type parameter
   |
   |
LL | struct Foo<NotDefined>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `N` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:12:18
   |
   |
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |            |
   |            similarly named type parameter `T` defined here
   |
help: a type parameter with a similar name exists
help: a type parameter with a similar name exists
   |
LL | struct Bar<T>(T, T, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
help: you might be missing a type parameter
   |
   |
LL | struct Bar<T, N>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0412]: cannot find type `NotDefined` in this scope
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:12:21
   |
   |
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);

error[E0204]: the trait `Copy` cannot be implemented for this type
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:1:17
   |
   |
LL | #[derive(Clone, Copy)]
   |                 ^^^^
LL | //~^ ERROR the trait `Copy` cannot be implemented for this type
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                                                    |
   |                                                    this field does not implement `Copy`
   |
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0204]: the trait `Copy` cannot be implemented for this type
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:10:17
   |
LL | #[derive(Clone, Copy)]
   |                 ^^^^
LL | //~^ ERROR the trait `Copy` cannot be implemented for this type
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                                                          |
   |                                                          this field does not implement `Copy`
   |
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `i32` is not an iterator
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:3:27
   |
LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                           ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
   = help: the trait `Iterator` is not implemented for `i32`
   = help: the trait `Iterator` is not implemented for `i32`
   = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
error[E0277]: `i32` is not an iterator
##[error]  --> /checkout/tests/ui/traits/issue-50480.rs:12:33
   |
   |
LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String);
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator
   = help: the trait `Iterator` is not implemented for `i32`
   = help: the trait `Iterator` is not implemented for `i32`
   = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
error: aborting due to 10 previous errors

Some errors have detailed explanations: E0204, E0277, E0412.
For more information about an error, try `rustc --explain E0204`.

rust-log-analyzer avatar Feb 08 '24 16:02 rust-log-analyzer

@oli-obk I fixed push_suggestion and all tests are passed (no test results are changed). I solved the problem by simpler method using ExpnData.call_site. I noticed that call_site points inside derive(...) when in_derive_expansion is true.

BTW I want to add a UI test about this issue from this code. However the code depends on serde crate. It may be difficult to add a test about the issue.

long-long-float avatar Feb 09 '24 16:02 long-long-float

yea we can't use crates.io crates in tests. the only way a test can be added right now is via the following:

we do have tests like /home/ubuntu/rustc/rust10/tests/ui/proc-macro/derive-b.rs so you can probably just copy one of these tests and their derive and create a derive that will always emit your diagnostic.

oli-obk avatar Feb 09 '24 16:02 oli-obk

Thank you for your review. I added a test for the issue and fix to use for-loop.

long-long-float avatar Feb 10 '24 17:02 long-long-float

Great! Let's land this then

@bors r+ rollup

oli-obk avatar Feb 10 '24 18:02 oli-obk

:pushpin: Commit 1e59e662258fc301dd7b396ac0e3686568a71164 has been approved by oli-obk

It is now in the queue for this repository.

bors avatar Feb 10 '24 18:02 bors

@bors r-

I've been told about a possible perf impact that previous attempts have had

oli-obk avatar Feb 10 '24 18:02 oli-obk

@bors try @rust-timer queue

oli-obk avatar Feb 10 '24 18:02 oli-obk

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Feb 10 '24 18:02 rust-timer

:hourglass: Trying commit 1e59e662258fc301dd7b396ac0e3686568a71164 with merge 7ad25162fa95115bd7470b9314ba8b2e4edaa45e...

bors avatar Feb 10 '24 18:02 bors

:sunny: Try build successful - checks-actions Build commit: 7ad25162fa95115bd7470b9314ba8b2e4edaa45e (7ad25162fa95115bd7470b9314ba8b2e4edaa45e)

bors avatar Feb 10 '24 20:02 bors