-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #106973 - oli-obk:tait_ice_closure_in_impl_header, r=…
…lcnr Don't treat closures from other crates as local fixes #104817 r? `@lcnr` Specialization can prefer an impl for an opaque type over a blanket impls that also matches. If the blanket impl only applies if an auto-trait applies, we look at the hidden type of the opaque type to see if that implements the auto trait. The hidden type can be a closure or generator, and thus we will end up seeing these types in coherence and have to handle them properly.
- Loading branch information
Showing
5 changed files
with
58 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...coherence/coherence-with-generator.stderr → ...nce/coherence-with-generator.stock.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![feature(type_alias_impl_trait)] | ||
#![cfg_attr(specialized, feature(specialization))] | ||
#![allow(incomplete_features)] | ||
|
||
// revisions: stock specialized | ||
// [specialized]check-pass | ||
|
||
trait OpaqueTrait {} | ||
impl<T> OpaqueTrait for T {} | ||
type OpaqueType = impl OpaqueTrait; | ||
fn mk_opaque() -> OpaqueType { | ||
|| 0 | ||
} | ||
trait AnotherTrait {} | ||
impl<T: Send> AnotherTrait for T {} | ||
impl AnotherTrait for OpaqueType {} | ||
//[stock]~^ conflicting implementations of trait `AnotherTrait` for type `OpaqueType` | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `OpaqueType` | ||
--> $DIR/issue-104817.rs:16:1 | ||
| | ||
LL | impl<T: Send> AnotherTrait for T {} | ||
| -------------------------------- first implementation here | ||
LL | impl AnotherTrait for OpaqueType {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |