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

Regression: conflicting implementations of trait std::convert::Into<std::boxed::Box<_>> for type Bow<'_, _> #46328

Closed
SimonSapin opened this issue Nov 28, 2017 · 6 comments
Labels
regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@SimonSapin
Copy link
Contributor

https://crates.io/crates/bow/1.0.3 contains this impl:

impl<'a, T: 'a + ToBox + ?Sized> Into<boxed::Box<T>> for Bow<'a, T> {
    fn into(self) -> boxed::Box<T> {
        self.into_box()
    }
}

It compiles on nightly-2017-11-27, but fails in nightly-2017-11-28 with:

error[E0119]: conflicting implementations of trait `std::convert::Into<std::boxed::Box<_>>` for type `Bow<'_, _>`:
   --> src/lib.rs:124:1
    |
124 | / impl<'a, T: 'a + ToBox + ?Sized> Into<boxed::Box<T>> for Bow<'a, T> {
125 | |     fn into(self) -> boxed::Box<T> {
126 | |         self.into_box()
127 | |     }
128 | | }
    | |_^
    |
    = note: conflicting implementation in crate `core`:
            - impl<T, U> std::convert::Into<U> for T
              where U: std::convert::From<T>;

Range between the two nighlies: 827cb0d...560a5da

c48650e from #44884 sounds maybe relevant. CC @arielb1

@arielb1 arielb1 added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Nov 28, 2017
@arielb1
Copy link
Contributor

arielb1 commented Nov 28, 2017

That... was not supposed to be a part of this PR, but rather #46192. I'll revert.

OTOH, I think any crate can implement From<Bow<TheirType>> for their TheirTypeBox<TheirType> and cause a coherence conflict, so the new logic is correct. It should still be a future-compat lint rather than an hard error.

@SimonSapin
Copy link
Contributor Author

I don’t understand how this could be a conflict. The "source" type in the impl above is Box<T>, not T.

@arielb1
Copy link
Contributor

arielb1 commented Nov 28, 2017

@SimonSapin

My bad, I meant

impl From<Bow<TheirType>> for Box<TheirType>

Which is legal because Box is #[fundamental] and there are no generics to cause orphan rule violations.

@SimonSapin
Copy link
Contributor Author

In that impl allowed in a crate defining neither Bow nor Box?

SimonSapin added a commit to servo/servo that referenced this issue Nov 28, 2017
This removes 3927 lines of Rust code in 6 crates from the dependency graph:
parse-hosts, multistr, bow, extra-default, len-trait, and push-trait.

On of these doesn’t build in today’s Nightly:
rust-lang/rust#46328
SimonSapin added a commit to servo/servo that referenced this issue Nov 28, 2017
This removes 3927 lines of Rust code in 6 crates from the dependency graph:
parse-hosts, multistr, bow, extra-default, len-trait, and push-trait.

One of these crates doesn’t build in today’s Nightly:
rust-lang/rust#46328
bors-servo pushed a commit to servo/servo that referenced this issue Nov 28, 2017
Replace parse-hosts crate with 10 lines of code.

This removes 3927 lines of Rust code in 6 crates from the dependency graph: parse-hosts, multistr, bow, extra-default, len-trait, and push-trait.

One of these crates doesn’t build in today’s Nightly: rust-lang/rust#46328

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19411)
<!-- Reviewable:end -->
@SimonSapin
Copy link
Contributor Author

Ariel says on IRC this is a real conflict and the new rustc behavior is meant to stay. The impl above is allowed because Box is #[fundamental].

CC @clarcharr, author of this crate.

@TimNN TimNN added C-bug Category: This is a bug. and removed C-bug Category: This is a bug. labels Nov 28, 2017
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Nov 29, 2017
… (from servo:parse-hosts); r=nox

This removes 3927 lines of Rust code in 6 crates from the dependency graph: parse-hosts, multistr, bow, extra-default, len-trait, and push-trait.

One of these crates doesn’t build in today’s Nightly: rust-lang/rust#46328

Source-Repo: https://github.com/servo/servo
Source-Revision: ae3c3ba1c2f265e01a377f73f4a9016aded54367

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : b7d289b529cbdba3679c1e6c626264d90dd648d2
xeonchen pushed a commit to xeonchen/gecko-cinnabar that referenced this issue Nov 29, 2017
… (from servo:parse-hosts); r=nox

This removes 3927 lines of Rust code in 6 crates from the dependency graph: parse-hosts, multistr, bow, extra-default, len-trait, and push-trait.

One of these crates doesn’t build in today’s Nightly: rust-lang/rust#46328

Source-Repo: https://github.com/servo/servo
Source-Revision: ae3c3ba1c2f265e01a377f73f4a9016aded54367
@arielb1
Copy link
Contributor

arielb1 commented Nov 30, 2017

I reverted the commit so I'll close this issue.

@arielb1 arielb1 closed this as completed Nov 30, 2017
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this issue Dec 5, 2017
… (from servo:parse-hosts); r=nox

This removes 3927 lines of Rust code in 6 crates from the dependency graph: parse-hosts, multistr, bow, extra-default, len-trait, and push-trait.

One of these crates doesn’t build in today’s Nightly: rust-lang/rust#46328

Source-Repo: https://github.com/servo/servo
Source-Revision: ae3c3ba1c2f265e01a377f73f4a9016aded54367
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 2, 2019
… (from servo:parse-hosts); r=nox

This removes 3927 lines of Rust code in 6 crates from the dependency graph: parse-hosts, multistr, bow, extra-default, len-trait, and push-trait.

One of these crates doesn’t build in today’s Nightly: rust-lang/rust#46328

Source-Repo: https://github.com/servo/servo
Source-Revision: ae3c3ba1c2f265e01a377f73f4a9016aded54367

UltraBlame original commit: 09c999bcd0ab5a90adc7ae2cdf6187fea59a546f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 2, 2019
… (from servo:parse-hosts); r=nox

This removes 3927 lines of Rust code in 6 crates from the dependency graph: parse-hosts, multistr, bow, extra-default, len-trait, and push-trait.

One of these crates doesn’t build in today’s Nightly: rust-lang/rust#46328

Source-Repo: https://github.com/servo/servo
Source-Revision: ae3c3ba1c2f265e01a377f73f4a9016aded54367

UltraBlame original commit: 09c999bcd0ab5a90adc7ae2cdf6187fea59a546f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 2, 2019
… (from servo:parse-hosts); r=nox

This removes 3927 lines of Rust code in 6 crates from the dependency graph: parse-hosts, multistr, bow, extra-default, len-trait, and push-trait.

One of these crates doesn’t build in today’s Nightly: rust-lang/rust#46328

Source-Repo: https://github.com/servo/servo
Source-Revision: ae3c3ba1c2f265e01a377f73f4a9016aded54367

UltraBlame original commit: 09c999bcd0ab5a90adc7ae2cdf6187fea59a546f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

No branches or pull requests

3 participants