-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Regression: geoarrow crate does not compile in release mode on 1.82 #131960
Comments
We would also need a magic -3 adjustment on top of the existing recursion limit hack to make this compile. I could speculate but I don't think I understand why. I think it's pretty clear though that's the regression test we checked in doesn't cover the scenario that geoarrow is hitting. |
At the current time, I'm not working on any fix for this regression. I'm really not sure what a reasonable change would be; we can add some more magic numbers to the cycle avoidance recursion limit, but I'm not sure what number we can add that's reasonable. I suspect that whatever we do, there will be some type that someone can write that will run into this error anyway. It's my understanding that this error can be fixed in the new trait solver, but that won't land for so long that it's kind of off topic for this issue. I feel like there should be a better way to write the cycle avoidance call graph code, but I don't know if this scenario can be avoided by that. |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
Somewhat minimized reproduction code: geoarrow-repro.zip (around 80 lines of actual rust code) The issue appears to be sensitive to the exact module paths and the exact dependencies used.
|
This version of the code reproduces the issue on nightly (tested with Codepub trait GeometryCollectionTrait: Sized {
type T;
type ItemType<'a>: 'a + GeometryTrait<T = Self::T>
where
Self: 'a;
fn geometries(&self) -> GeometryCollectionIterator<'_, Self::T, Self::ItemType<'_>, Self> {
unimplemented!()
}
}
pub trait GeometryTrait {
type T;
type GeometryCollection<'a>: 'a + GeometryCollectionTrait<T = Self::T>
where
Self: 'a;
fn as_type(&self) -> GeometryType<'_, Self::GeometryCollection<'_>>;
}
pub enum GeometryType<'a, GC>
where
GC: GeometryCollectionTrait,
{
GeometryCollection(&'a GC),
}
pub struct GeometryCollectionIterator<
'a,
T,
ItemType: 'a + GeometryTrait<T = T>,
G: GeometryCollectionTrait<T = T, ItemType<'a> = ItemType>,
> {
_a: &'a G,
}
impl<
'a,
T,
ItemType: 'a + GeometryTrait<T = T>,
G: GeometryCollectionTrait<T = T, ItemType<'a> = ItemType>,
> Iterator for GeometryCollectionIterator<'a, T, ItemType, G>
{
type Item = ItemType;
fn next(&mut self) -> Option<Self::Item> {
unimplemented!()
}
}
pub fn add_geometry(geometry: &impl GeometryTrait<T = f64>) {
match geometry.as_type() {
GeometryType::GeometryCollection(g) => add_geometry_collection(g),
}
}
pub fn add_geometry_collection(geometry_collection: &impl GeometryCollectionTrait<T = f64>) {
for geometry in geometry_collection.geometries() {
add_geometry(&geometry);
}
}
pub fn bounding_rect_geometry_collection(geom: &impl GeometryCollectionTrait<T = f64>) {
add_geometry_collection(geom);
} |
This issue is originally reported by @kylebarron at #128887 (comment)
The
geoarrow
crate does not compile in release mode on rust 1.82.0, despite compiling fine in debug mode or in rust 1.81.0.The code can be obtained by:
git clone https://github.com/geoarrow/geoarrow-rs cd geoarrow-rs git checkout 0b6715c6a56f0115f9078803fae945700713b22f
The following commands give compilation errors:
The following commands compile fine without errors:
rustup run 1.81 cargo build --release rustup run 1.81 cargo build rustup run 1.82 cargo build rustup run nightly cargo build RUSTFLAGS='-Zinline-mir=no' rustup run nightly cargo build --release
Note that this is issue is distinct from the previous 1.80-to-nightly geoarrow regression, which is fixed in #129714 and tested in #129757.
@rustbot labels regression-from-stable-to-stable
The text was updated successfully, but these errors were encountered: