Uh oh!
There was an error while loading. Please reload this page.
Restore Opaque behavior to coherence check - #99666
Conversation
compiler-errors
commented
Jul 24, 2022
Hm, guess not? |
lcnr
commented
Jul 25, 2022
@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.
please add the following as an additional test:
#![feature(type_alias_impl_trait)]structOuter<T: ?Sized>{i:InnerSend<T>,}typeInnerSend<T: ?Sized> = implSend;fnconstrain<T: ?Sized>() -> InnerSend<T>{()}traitSendMustNotImplDrop{}impl<T: ?Sized + Send + Drop>SendMustNotImplDropforT{}impl<T: ?Sized>SendMustNotImplDropforOuter<T>{}fnmain(){}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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lcnr
commented
Jul 25, 2022
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
4fca3e8Compare4fca3e8 to
b7cf9f7Comparecompiler-errors
commented
Jul 26, 2022
@bors r=lcnr |
bors
commented
Jul 26, 2022
Restore `Opaque` behavior to coherence check Fixesrust-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