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

Implement RFC 3624 supertrait_item_shadowing (v2) #125782

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented May 30, 2024

Implements RFC 3624 and the associated lint in the RFC.

Tracking:

cc @Amanieu and rust-lang/rfcs#3624 and #89151

@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. labels May 30, 2024
@compiler-errors compiler-errors changed the title Implement RFC 3624 supertrait_item_shadowing Implement RFC 3624 supertrait_item_shadowing (v2) May 30, 2024
@traviscross traviscross added the F-supertrait_item_shadowing `#![feature(supertrait_item_shadowing)]` label May 30, 2024
@bors
Copy link
Contributor

bors commented Jul 29, 2024

☔ The latest upstream changes (presumably #125443) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC Dylan-DPC added S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 17, 2024
@compiler-errors compiler-errors force-pushed the supertrait-item-shadowing branch 3 times, most recently from e95db1b to 8665a82 Compare September 19, 2024 01:39
@compiler-errors
Copy link
Member Author

OK, this is ready pending RFC approval.

@rust-log-analyzer

This comment has been minimized.

@compiler-errors compiler-errors marked this pull request as ready for review September 19, 2024 15:51
@compiler-errors
Copy link
Member Author

The RFC is now in FCP, so this could probably get reviewed preliminarily but should probably not land until the RFC is merged.

r? compiler

@bors
Copy link
Contributor

bors commented Sep 20, 2024

☔ The latest upstream changes (presumably #124895) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 20, 2024
@rust-log-analyzer

This comment has been minimized.

@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 26.9s done
#16 DONE 39.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
---
diff of stderr:

20   --> $DIR/false-subtrait-after-inference.rs:19:7
21    |
22 LL |     x.hello();
-    |       ^^^^^ the trait `Foo` is not implemented for `i32`, which is required by `W<_>: Downstream`
24    |
25 help: this trait has no implementations, consider adding one
26   --> $DIR/false-subtrait-after-inference.rs:15:1



The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args methods/supertrait-shadowing/false-subtrait-after-inference.rs`

error: 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/methods/supertrait-shadowing/false-subtrait-after-inference.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/methods/supertrait-shadowing/false-subtrait-after-inference" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
--- stderr -------------------------------
--- stderr -------------------------------
warning: trait method `hello` from `Downstream` shadows identically named method from supertrait
##[warning]  --> /checkout/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.rs:19:7
   |
LL |     x.hello();
   |
note: method from `Downstream` shadows a supertrait method
  --> /checkout/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.rs:11:5
   |
---

error[E0277]: the trait bound `i32: Foo` is not satisfied
##[error]  --> /checkout/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.rs:19:7
   |
LL |     x.hello();
   |
help: this trait has no implementations, consider adding one
  --> /checkout/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.rs:15:1
   |
   |
LL | trait Foo {}
   | ^^^^^^^^^
note: required for `W<i32>` to implement `Downstream`
  --> /checkout/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.rs:13:9
   |
LL | impl<T> Downstream for W<T> where T: Foo {}
   |         ^^^^^^^^^^     ^^^^          --- unsatisfied trait bound introduced here
error: aborting due to 1 previous error; 1 warning emitted

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-supertrait_item_shadowing `#![feature(supertrait_item_shadowing)]` S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants