rust icon indicating copy to clipboard operation
rust copied to clipboard

Use a proper probe for shadowing impl

Open compiler-errors opened this issue 1 year ago • 6 comments

r? lcnr

compiler-errors avatar May 07 '24 15:05 compiler-errors

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

rustbot avatar May 07 '24 15:05 rustbot

The job x86_64-gnu-llvm-17 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 30.2s done
#16 DONE 42.6s
##[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-17]
---
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-17', '--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', '--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-17/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
---- [ui] tests/ui/closures/deduce-signature/deduce-from-opaque-type-after-norm.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/closures/deduce-signature/deduce-from-opaque-type-after-norm.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)" "--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/closures/deduce-signature/deduce-from-opaque-type-after-norm.next" "-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/closures/deduce-signature/deduce-from-opaque-type-after-norm.next/auxiliary" "-Znext-solver"
--- stderr -------------------------------
error[E0282]: type annotations needed
##[error]  --> /checkout/tests/ui/closures/deduce-signature/deduce-from-opaque-type-after-norm.rs:7:10
   |
   |
LL |         |x| x.count_ones()
   |          ^  - type must be known at this point
help: consider giving this closure parameter an explicit type
   |
   |
LL |         |x: /* Type */| x.count_ones()

error: aborting due to 1 previous error

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

+ error[E0308]: mismatched types
+   --> $DIR/issue-71659.rs:15:9
+    |
+ LL | impl<T: ?Sized, U: ?Sized + Unsize<T>> CastTo<T> for U {
+    |      -          - found type parameter
+    |      expected type parameter
+    |      expected type parameter
+ LL |     fn cast_to(&self) -> &T {
+    |                          -- expected `&T` because of return type
+ LL |         self
+    |         ^^^^ expected `&T`, found `&U`
+    = note: expected reference `&T`
+               found reference `&U`
+               found reference `&U`
+    = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
+    = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
+ error[E0308]: mismatched types
+   --> $DIR/issue-71659.rs:25:9
+    |
+ LL | pub trait Cast {
+ LL | pub trait Cast {
+    | -------------- found type parameter
+ LL |     fn cast<T: ?Sized>(&self) -> &T
+    |             -                    -- expected `&T` because of return type
+    |             expected type parameter
+ ...
+ LL |         self
+ LL |         self
+    |         ^^^^ expected `&T`, found `&Self`
+    = note: expected reference `&T`
+               found reference `&Self`
+               found reference `&Self`
+    = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
+    = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
+ 
1 error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied
3    |


13 LL |         Self: CastTo<T>,
14    |               ^^^^^^^^^ required by this bound in `Cast::cast`
- error: aborting due to 1 previous error
+ error: aborting due to 3 previous errors
17 
- For more information about this error, try `rustc --explain E0277`.
---
To only update this specific test, also pass `--test-args unsized/issue-71659.rs`

error in revision `next`: 1 errors occurred comparing output.
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/unsized/issue-71659.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)" "--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/unsized/issue-71659.next" "-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/unsized/issue-71659.next/auxiliary" "-Znext-solver"
--- stderr -------------------------------
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/unsized/issue-71659.rs:15:9
   |
   |
LL | impl<T: ?Sized, U: ?Sized + Unsize<T>> CastTo<T> for U {
   |      -          - found type parameter
   |      expected type parameter
   |      expected type parameter
LL |     fn cast_to(&self) -> &T {
   |                          -- expected `&T` because of return type
LL |         self
   |         ^^^^ expected `&T`, found `&U`
   = note: expected reference `&T`
              found reference `&U`
              found reference `&U`
   = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
   = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/unsized/issue-71659.rs:25:9
   |
LL | pub trait Cast {
LL | pub trait Cast {
   | -------------- found type parameter
LL |     fn cast<T: ?Sized>(&self) -> &T
   |             -                    -- expected `&T` because of return type
   |             expected type parameter
...
LL |         self
LL |         self
   |         ^^^^ expected `&T`, found `&Self`
   = note: expected reference `&T`
              found reference `&Self`
              found reference `&Self`
   = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
   = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters

error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied
   |
   |
LL |     let x = x.cast::<[i32]>();
   |               ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo`
note: required by a bound in `Cast::cast`
  --> /checkout/tests/ui/unsized/issue-71659.rs:23:15
   |
   |
LL |     fn cast<T: ?Sized>(&self) -> &T
LL |     where
LL |     where
LL |         Self: CastTo<T>,
   |               ^^^^^^^^^ required by this bound in `Cast::cast`
error: aborting due to 3 previous errors

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

rust-log-analyzer avatar May 07 '24 15:05 rust-log-analyzer

@bors r+ rollup

lcnr avatar May 13 '24 13:05 lcnr

:pushpin: Commit b39ef8b1fd24f1acb2a4102e9e8ee9edf5b55b6e has been approved by lcnr

It is now in the queue for this repository.

bors avatar May 13 '24 13:05 bors

https://github.com/rust-lang/rust/pull/125079#issuecomment-2107877799 @bors r-

fmease avatar May 13 '24 15:05 fmease

You just need to import bug now that various #[macro_use]s inside compiler/ are gone (#124511, #124914).

fmease avatar May 13 '24 15:05 fmease

@bors r=lcnr

compiler-errors avatar May 14 '24 03:05 compiler-errors

:pushpin: Commit dbd2ca6478dca81dc4ed64f9dec09fb216d34f1a has been approved by lcnr

It is now in the queue for this repository.

bors avatar May 14 '24 03:05 bors