Skip to content

Commit

Permalink
Merge #932
Browse files Browse the repository at this point in the history
932: Incoming breakage: Replace an invalid `#[deprecated]` attribute with a doc comment r=michaelkirk a=fmease

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/main/CODE_OF_CONDUCT.md).
- [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.
---

`#[deprecated]` attributes on `impl` blocks do not have any effect and normally the deny-by-default lint `useless_deprecated` would be triggered with the message *this `#[deprecated]` annotation has no effect*.
However, there is a bug in the current version of the Rust compiler that makes it ignore the attribute entirely if it is *malformed*
which is the case for the `#[deprecated]` attached to the `From` impl for `GeometryCollection` (the version is not surrounded by double quotes).
I've replaced the attribute with a documentation comment similar to the one for the softly deprecated associated function `GeometryCollection::new_from`.

---

The compiler bug is about to be fixed (rust-lang/rust#104148) and the malformed attribute will soon become a hard error.
This future breakage was found with the help of [crater](https://github.com/rust-lang/crater) (see the [build log](https://crater-reports.s3.amazonaws.com/pr-104148/try%23692571811df96d28cfa90e2b8cdf3be7e99c44e1/reg/geo-types-0.7.7/log.txt)).

Co-authored-by: León Orell Valerian Liehr <[email protected]>
  • Loading branch information
bors[bot] and fmease authored Nov 11, 2022
2 parents 3b0d573 + dbe5b4f commit 5bd52c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion geo-types/src/geometry/geometry_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ impl<T: CoordNum> GeometryCollection<T> {
}
}

#[deprecated(since = 0.7.5, note = "Use `GeometryCollection::from(vec![geom])` instead.")]
/// **DO NOT USE!** Deprecated since 0.7.5.
///
/// Use `GeometryCollection::from(vec![geom])` instead.
impl<T: CoordNum, IG: Into<Geometry<T>>> From<IG> for GeometryCollection<T> {
fn from(x: IG) -> Self {
Self(vec![x.into()])
Expand Down

0 comments on commit 5bd52c1

Please sign in to comment.