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

Relax the Sized requirement on the Error impl for Box. #120457

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smmalis37
Copy link
Contributor

This is already the case for Arc and ThinBox, so I'm guessing this was just an oversight? This will be insta-stable, and probably needs an FCP.

@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2024

r? @joshtriplett

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 28, 2024
@rust-log-analyzer
Copy link
Collaborator

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)
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: Sun Jan 28 21:02:14 UTC 2024
  network time: Sun, 28 Jan 2024 21:02:14 GMT
  network time: Sun, 28 Jan 2024 21:02:14 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
---
   Compiling cfg-if v1.0.0
   Compiling adler v1.0.2
   Compiling rustc-demangle v0.1.23
   Compiling unwind v0.0.0 (/checkout/library/unwind)
error[E0119]: conflicting implementations of trait `From<Box<dyn core::error::Error>>` for type `Box<dyn core::error::Error>`
     |
     |
2215 | impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a> {
     |
     = note: conflicting implementation in crate `core`:
     = note: conflicting implementation in crate `core`:
             - impl<T> From<T> for T;
     = note: upstream crates may add a new impl of trait `core::marker::FnPtr` for type `dyn core::error::Error` in future versions

error[E0119]: conflicting implementations of trait `From<Box<dyn core::error::Error + Send + Sync>>` for type `Box<dyn core::error::Error + Send + Sync>`
     |
     |
2248 | impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync + 'a> {
     |
     = note: conflicting implementation in crate `core`:
     = note: conflicting implementation in crate `core`:
             - impl<T> From<T> for T;
     = note: upstream crates may add a new impl of trait `core::marker::FnPtr` for type `dyn core::error::Error + core::marker::Send + core::marker::Sync` in future versions
For more information about this error, try `rustc --explain E0119`.
error: could not compile `alloc` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:00:12

@smmalis37 smmalis37 changed the title Relax the Sized restriction on the Error impl for Box. Relax the Sized requirement on the Error impl for Box. Jan 28, 2024
@joshtriplett
Copy link
Member

r? libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 11, 2024
@rustbot rustbot assigned BurntSushi and unassigned joshtriplett Feb 11, 2024
@smmalis37 smmalis37 closed this Mar 4, 2024
@smmalis37 smmalis37 reopened this Mar 4, 2024
@rust-log-analyzer
Copy link
Collaborator

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)
#12 writing image sha256:06f458c6b60cab3c1025a086ae9e377f6edf557f09cff5af6d512fc4b71bd7f7 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 Mar  4 00:33:26 UTC 2024
  network time: Mon, 04 Mar 2024 00:33:26 GMT
  network time: Mon, 04 Mar 2024 00:33:26 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
---
   Compiling cfg-if v1.0.0
   Compiling adler v1.0.2
   Compiling rustc-demangle v0.1.23
   Compiling unwind v0.0.0 (/checkout/library/unwind)
error[E0119]: conflicting implementations of trait `From<Box<dyn core::error::Error>>` for type `Box<dyn core::error::Error>`
     |
     |
2238 | impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a> {
     |
     = note: conflicting implementation in crate `core`:
     = note: conflicting implementation in crate `core`:
             - impl<T> From<T> for T;
     = note: upstream crates may add a new impl of trait `core::marker::FnPtr` for type `dyn core::error::Error` in future versions

error[E0119]: conflicting implementations of trait `From<Box<dyn core::error::Error + Send + Sync>>` for type `Box<dyn core::error::Error + Send + Sync>`
     |
     |
2271 | impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync + 'a> {
     |
     = note: conflicting implementation in crate `core`:
     = note: conflicting implementation in crate `core`:
             - impl<T> From<T> for T;
     = note: upstream crates may add a new impl of trait `core::marker::FnPtr` for type `dyn core::error::Error + core::marker::Send + core::marker::Sync` in future versions
For more information about this error, try `rustc --explain E0119`.
error: could not compile `alloc` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:00:11

@smmalis37
Copy link
Contributor Author

I don't understand how this creates conflicting impls of From?

@joboet
Copy link
Contributor

joboet commented Mar 16, 2024

Because Box<dyn Error> now implements Error, there are two implementations of From<Box<dyn Error>> for Box<dyn Error>: one from the standard impl<T> From<T> for T and one from impl<E: Error> From<E> for Box<dyn Error>. This can't ever be allowed because the two implementations do different things: the first one doesn't create a new allocation, the second one adds one Box indirection.

@Dylan-DPC Dylan-DPC added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants