3

regression: infallible residual could not convert error · Issue #86831 · rust-la...

 3 years ago
source link: https://github.com/rust-lang/rust/issues/86831
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Member

scottmcm commented 20 days ago

edited

For the sierra thing, it looks like this is a place where they unwittingly used never type on stable, and that's the core of why it changed. There was actually one place that hit this in the compiler (see the conversation in https://rust-lang.zulipchat.com/#narrow/stream/259160-t-lang.2Fproject-never-type/topic/Coercions.20of.20other.20uninhabited.20types/near/220030226) but that was a place using #![feature(never_type)] so when the previous crater run didn't hit it anywhere else I'd thought it wasn't a thing that would happen in stable :/

The code that broke is

let total_size_usize = group_size_usize
    .checked_mul(info.groups.len())
    .ok_or_else(host_memory_space_overlow)?;

where the function is

pub fn host_memory_space_overlow() -> ! {
    panic!("Memory address space overlow")
}

Repro: https://play.rust-lang.org/?version=beta&mode=debug&edition=2018&gist=f90e3876b81fc12b185284b5006457ba

It actually works fine if it's changed to

.ok_or_else(|| host_memory_space_overlow())?;

https://play.rust-lang.org/?version=beta&mode=debug&edition=2018&gist=f4b06b729fc59aa3226e64b1deaaaf4b

I'll send them a PR. (Edit: zakarumych/sierra#3 -- which is now merged.)

Aside: This is one of those spots that I think could be nice with let-else, since it would emphasize that the function called diverges:

let Some(total_size_usize) = group_size_usize
    .checked_mul(info.groups.len())
else { host_memory_space_overlow() };

The dhall one is known, and I sent an (incorrect) PR Nadrieril/dhall-rust#213 for it, and it was fixed back in March with Nadrieril/dhall-rust@846c14f

So twelf should also be fixed as of bnjjj/twelf@3ad9fc5 (thought it's not clear to me what version that would be)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK