-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Restore Opaque
behavior to coherence check
#99666
Conversation
Hm, guess not? |
@compiler-errors is the |
@lcnr that's the only difference I could find, but I didn't look further than the opaque change that I touched in this PR. Just pointed out that comment because it seems #99552 did change behavior, not just replicated the old behavior like the comment suggested, unless I'm misunderstanding the point of that comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the following as an additional test:
#![feature(type_alias_impl_trait)]
struct Outer<T: ?Sized> {
i: InnerSend<T>,
}
type InnerSend<T: ?Sized> = impl Send;
fn constrain<T: ?Sized>() -> InnerSend<T> {
()
}
trait SendMustNotImplDrop {}
impl<T: ?Sized + Send + Drop> SendMustNotImplDrop for T {}
impl<T: ?Sized> SendMustNotImplDrop for Outer<T> {}
fn main() {}
this triggers the ice using auto traits.
It was surprising to me that we never look into the opaque types during coherence, causing an ICE for closures etc as well, (by changing constrain
to || ()
). The reason for that is that is_knowable
fails for auto trait/sized impls on Opaque
types as they always result in Conflict::Upstream
.
r=me after adding this test and fixing my nit
It did change the behavior for I interpreted the comment by oli to be about #99552 my new FIXME. While rust/compiler/rustc_trait_selection/src/traits/coherence.rs Lines 720 to 723 in 7f93d4a
|
94d3ffe
to
4fca3e8
Compare
4fca3e8
to
b7cf9f7
Compare
@bors r=lcnr |
Restore `Opaque` behavior to coherence check Fixes rust-lang#99663. This broke in 84c3fcd. I'm not exactly certain that adding this behavior back is necessarily correct, but at least the UI test I provided may stimulate some thoughts. I think delaying a bug here is certainly not correct in the case of opaques -- if we want to change coherence behavior for opaques, then we should at least be emitting a new error. r? `@lcnr`
Rollup of 5 pull requests Successful merges: - rust-lang#99618 (handle consts with param/infer in `const_eval_resolve` better) - rust-lang#99666 (Restore `Opaque` behavior to coherence check) - rust-lang#99692 (interpret, ptr_offset_from: refactor and test too-far-apart check) - rust-lang#99739 (Remove erroneous E0133 code from an error message.) - rust-lang#99748 (Use full type name instead of just saying `impl Trait` in "captures lifetime" error) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #99663.
This broke in 84c3fcd. I'm not exactly certain that adding this behavior back is necessarily correct, but at least the UI test I provided may stimulate some thoughts.
I think delaying a bug here is certainly not correct in the case of opaques -- if we want to change coherence behavior for opaques, then we should at least be emitting a new error.
r? @lcnr