-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
!Sized
return type error panics with 'no errors encountered even though delay_span_bug
issued'
#80207
Comments
A further reduction clarifies that the bug has nothing to do with std::ops::BitOr. pub trait Foo {
fn do_stuff() -> Self;
}
pub trait Bar {
type Output;
}
impl<T> Foo for dyn Bar<Output = T>
where
Self: Sized,
{
fn do_stuff() -> Self {
todo!()
}
} |
Issue: rust-lang/rust#80207
Assigning |
The rust/compiler/rustc_typeck/src/check/check.rs Lines 182 to 195 in 742c972
It was added in e536257. I think the problem with this program is that we have Pinging @estebank as he is the author of the commit above. |
It would be nice if we could come up with more repro cases that don't involve |
As mentioned in the pr fixing this, the |
Remove incorrect `delay_span_bug` The following code is supposed to compile ```rust use std::ops::BitOr; pub trait IntWrapper { type InternalStorage; } impl<T> BitOr for dyn IntWrapper<InternalStorage = T> where Self: Sized, T: BitOr + BitOr<Output = T>, { type Output = Self; fn bitor(self, _other: Self) -> Self { todo!() } } ``` Before this change it would ICE. In rust-lang#70998 the removed logic was added to provide better suggestions, and the `delay_span_bug` guard was added to protect against a potential logic error when returning traits. As it happens, there are cases, like the one above, where traits can indeed be returned, so valid code was being rejected. Fix (but not close) rust-lang#80207.
Reopening for the backport. |
Remove incorrect `delay_span_bug` The following code is supposed to compile ```rust use std::ops::BitOr; pub trait IntWrapper { type InternalStorage; } impl<T> BitOr for dyn IntWrapper<InternalStorage = T> where Self: Sized, T: BitOr + BitOr<Output = T>, { type Output = Self; fn bitor(self, _other: Self) -> Self { todo!() } } ``` Before this change it would ICE. In rust-lang#70998 the removed logic was added to provide better suggestions, and the `delay_span_bug` guard was added to protect against a potential logic error when returning traits. As it happens, there are cases, like the one above, where traits can indeed be returned, so valid code was being rejected. Fix (but not close) rust-lang#80207.
Code
Meta
Via the playground on all of stable, beta, and nightly.
Error output
Credit
Discovered by rectang as reported on the user forum.
The text was updated successfully, but these errors were encountered: