Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix dyn incompleteness with multiple supertraits with different substitutions #133397

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

So much to write about this.

Fixes #133361

r? @ghost

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Nov 23, 2024
@compiler-errors
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Nov 23, 2024

⌛ Trying commit 88fa8f4 with merge 52ae244...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 23, 2024
…ss, r=<try>

Fix dyn incompleteness with multiple supertraits with different substitutions

So much to write about this.

Fixes rust-lang#133361

r? `@ghost`
@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
#16 exporting to docker image format
#16 sending tarball 27.8s done
#16 DONE 33.3s
##[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-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
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-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--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', 'rust.lld=false', '--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-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
---- [ui] tests/ui/associated-types/associated-types-overridden-binding-2.rs stdout ----

error: ui test compiled successfully!
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/associated-types/associated-types-overridden-binding-2.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" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--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/associated-types-overridden-binding-2" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stderr: none


---- [ui] tests/ui/associated-types/issue-59324.rs stdout ----
---- [ui] tests/ui/associated-types/issue-59324.rs stdout ----

error: /checkout/tests/ui/associated-types/issue-59324.rs:23: expected error not found: the trait bound `(): Foo` is not satisfied

error: /checkout/tests/ui/associated-types/issue-59324.rs:23: expected error not found: the trait bound `(): Foo` is not satisfied

error: 0 unexpected errors found, 2 expected errors not found
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/associated-types/issue-59324.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" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--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-59324" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
--- not found errors (from test file) ---
ERROR     line  23: the trait bound `(): Foo` is not satisfied
ERROR     line  23: the trait bound `(): Foo` is not satisfied
---
---

thread '[ui] tests/ui/associated-types/issue-59324.rs' panicked at src/tools/compiletest/src/runtest.rs:789:13:
errors differ from expected
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- [ui] tests/ui/traits/alias/dont-elaborate-non-self.rs stdout ----

error: /checkout/tests/ui/traits/alias/dont-elaborate-non-self.rs:7: unexpected error: '7:14: 7:24: the size for values of type `(dyn Fn<()> + 'static)` cannot be known at compilation time [E0277]'

error: /checkout/tests/ui/traits/alias/dont-elaborate-non-self.rs:7: expected error not found: the size for values of type `(dyn Fn() -> Fut + 'static)` cannot be known at compilation time
error: 1 unexpected errors found, 1 expected errors not found
status: exit status: 1
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/alias/dont-elaborate-non-self.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" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--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/alias/dont-elaborate-non-self" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
--- unexpected errors (from JSON output) ---
--- unexpected errors (from JSON output) ---
ERROR     line   7: 7:14: 7:24: the size for values of type `(dyn Fn<()> + 'static)` cannot be known at compilation time [E0277]
--- not found errors (from test file) ---
--- not found errors (from test file) ---
ERROR     line   7: the size for values of type `(dyn Fn() -> Fut + 'static)` cannot be known at compilation time

thread '[ui] tests/ui/traits/alias/dont-elaborate-non-self.rs' panicked at src/tools/compiletest/src/runtest.rs:789:13:
errors differ from expected


---- [ui] tests/ui/traits/alias/object.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/alias/object.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" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/alias/object/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0369]: binary operation `==` cannot be applied to type `Option<<dyn Iterator as Iterator>::Item>`
   |
   |
LL |     assert_eq!(c.next(), Some(123));
   |     |
   |     Option<<dyn Iterator as Iterator>::Item>
   |     Option<{integer}>
   |
   |
note: the foreign item type `Option<<dyn Iterator as Iterator>::Item>` doesn't implement `PartialEq<Option<{integer}>>`
   |
   |
   = note: not implement `PartialEq<Option<{integer}>>`
   = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `<dyn Iterator as Iterator>::Item` doesn't implement `Debug`
##[error]  --> /checkout/tests/ui/traits/alias/object.rs:17:5
   |
   |
LL |     assert_eq!(c.next(), Some(123));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<dyn Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
   = help: the trait `Debug` is not implemented for `<dyn Iterator as Iterator>::Item`
   = help: the trait `Debug` is implemented for `Option<T>`
   = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

---
---- [ui] tests/ui/traits/issue-24010.rs#next stdout ----

error in revision `next`: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/issue-24010.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" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "next" "--check-cfg" "cfg(FALSE,current,next)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/issue-24010.next/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Znext-solver"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0275]: overflow evaluating the requirement `Box<(dyn Foo + 'static)>: Fn(i32)`
   |
LL |     f(42)
   |     ^^^^^


error[E0275]: overflow evaluating the requirement `<Box<(dyn Foo + 'static)> as FnOnce<(i32,)>>::Output == i32`
   |
LL |     f(42)
   |     ^^^^^


error[E0275]: overflow evaluating the requirement `extern "rust-call" fn(&Box<(dyn Foo + 'static)>, (i32,)) -> <... as FnOnce<...>>::Output well-formed`
   |
LL |     f(42)
   |     ^^^^^


error[E0275]: overflow evaluating the requirement `<Box<(dyn Foo + 'static)> as FnOnce<(i32,)>>::Output well-formed`
   |
LL |     f(42)
   |     ^^^^^


error[E0275]: overflow evaluating the requirement `<Box<(dyn Foo + 'static)> as FnOnce<(i32,)>>::Output == _`
   |
LL |     f(42)
   |     ^^^^^

---
---- [ui] tests/ui/traits/issue-96664.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/issue-96664.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" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--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-96664" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
--- stderr -------------------------------
error[E0392]: type parameter `E` is never used
##[error]  --> /checkout/tests/ui/traits/issue-96664.rs:12:20
   |
   |
LL | pub struct Evolver<E: Evaluator> {
   |                    ^ unused type parameter
LL |     rand_state: Box<dyn RandState<E::State>>,
   |                                   - `E` is named here, but is likely unused in the containing type
   |
   = help: consider removing `E`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 1 previous error

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


---- [ui] tests/ui/traits/next-solver/dont-elaborate-for-projections.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/next-solver/dont-elaborate-for-projections.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" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--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/next-solver/dont-elaborate-for-projections" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Znext-solver"
--- stderr -------------------------------
error[E0275]: overflow evaluating the requirement `dyn Iter<'_, ()>: Iter<'_, _>`
##[error]  --> /checkout/tests/ui/traits/next-solver/dont-elaborate-for-projections.rs:9:16
   |
---
   |
note: required by a bound in `needs_iter`
  --> /checkout/tests/ui/traits/next-solver/dont-elaborate-for-projections.rs:6:22
   |
LL | fn needs_iter<'a, T: Iter<'a, I> + ?Sized, I: 'a>(_: &T) {}
   |                      ^^^^^^^^^^^ required by this bound in `needs_iter`
error: aborting due to 1 previous error

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


---- [ui] tests/ui/wf/hir-wf-canonicalized.rs stdout ----

error: ui test compiled successfully!
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/wf/hir-wf-canonicalized.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" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "-C" "incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/wf/hir-wf-canonicalized/hir-wf-canonicalized.inc" "-Z" "incremental-verify-ich" "--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/wf/hir-wf-canonicalized" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stderr: none



@bors
Copy link
Contributor

bors commented Nov 23, 2024

☀️ Try build successful - checks-actions
Build commit: 52ae244 (52ae2445414b2a196b318d85c2819995c6e5f1aa)

@compiler-errors
Copy link
Member Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-133397 created and queued.
🤖 Automatically detected try build 52ae244
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-crater Status: Waiting on a crater run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coherence with object types with overlapping supertrait projections is incomplete
5 participants