Skip to content

remove the explicit error for old rental versions#152753

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
cyrgani:remove-hack
Feb 18, 2026
Merged

remove the explicit error for old rental versions#152753
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
cyrgani:remove-hack

Conversation

@cyrgani
Copy link
Contributor

@cyrgani cyrgani commented Feb 17, 2026

This was converted to a hard error 20 months ago (in #125596). This seems like enough time for anyone still using it to notice, so remove the note entirely now.
In comparison, the explicit note for the more impactful time breakage was already removed after 6 months (#129343).

Closes #73933.
Closes #83125.

r? @petrochenkov

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 17, 2026
@petrochenkov
Copy link
Contributor

Could you remove the tests in a separate second commit?
I'm interested how the output looks after the change.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 17, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 17, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@cyrgani
Copy link
Contributor Author

cyrgani commented Feb 17, 2026

The tests don't have any interesting output to show after this change since they are essentially just checking for a type named ProceduralMasqueradeDummyType in a crate named rental and not for the actual failure pattern in rental. They just compile again.

@cyrgani
Copy link
Contributor Author

cyrgani commented Feb 17, 2026

The output from compiling the real rental=0.5.5 is:

error: proc-macro derive panicked
   --> /home/gh-cyrgani/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rental-0.5.5/src/lib.rs:93:12
    |
 93 |         #[derive(__rental_traits)]
    |                  ^^^^^^^^^^^^^^^
...
117 |     define_rental_traits!(32);
    |     ------------------------- in this macro invocation
    |
    = help: message: expected suffix ").0," not found in "#[allow(unused)] enum ProceduralMasqueradeDummyType\n{ Input = (0, stringify! (32)).0 }"
    = note: this error originates in the macro `define_rental_traits` (in Nightly builds, run with -Z macro-backtrace for more info)

error: proc-macro derive panicked
   --> /home/gh-cyrgani/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rental-0.5.5/src/lib.rs:257:13
    |
257 |               #[derive(__rental_structs_and_impls)]
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
...
285 | / rental! {
286 | |     /// Example types that demonstrate the API generated by the rental macro.
287 | |     pub mod examples {
288 | |         use std::sync;
...   |
346 | | }
    | |_- in this macro invocation
    |
    = help: message: expected suffix ").0," not found in "#[allow(unused)] enum ProceduralMasqueradeDummyType\n{\n    Input =\n    (0, stringify!\n    (use std::sync;\n    #[doc =\n    r\" The simplest shared rental. The head is a boxed integer, and the suffix is a ref to that integer. This struct demonstrates the basic API that all shared rental structs have. See [`SimpleMut`](struct.SimpleMut.html) for the mutable analog.\"]\n    #[rental] pub struct SimpleRef { head: Box<i32>, iref: &'head i32, }\n    #[doc =\n    r\" The simplest mutable rental. Mutable rentals have a slightly different API; compare this struct to [`SimpleRef`](struct.SimpleRef.html) for the clearest picture of how they differ.\"]\n    #[rental_mut] pub struct SimpleMut\n    { head: Box<i32>, iref: &'head mut i32, }\n    #[doc =\n    r\" Identical to [`SimpleRef`](struct.SimpleRef.html), but with the `debug` flag enabled. This will provide a `Debug` impl for the struct as long as all of the fields are `Debug`.\"]\n    #[rental(debug)] pub struct SimpleRefDebug\n    { head: Box<i32>, iref: &'head i32, }\n    #[doc =\n    r\" Similar to [`SimpleRef`](struct.SimpleRef.html), but with the `clone` flag enabled. This will provide a `Clone` impl for the struct as long as the prefix fields are `CloneStableDeref` and the suffix is `Clone` . Notice that the head is an `Arc`, since a clone of an `Arc` will deref to the same object as the original.\"]\n    #[rental(clone)] pub struct SimpleRefClone\n    { head: sync::Arc<i32>, iref: &'head i32, }\n    #[doc =\n    r\" Identical to [`SimpleRef`](struct.SimpleRef.html), but with the `deref_suffix` flag enabled. This will provide a `Deref` impl for the struct, which will in turn deref the suffix. Notice that this flag also removes the `self` param from all methods, replacing it with an explicit param. This prevents any rental methods from blocking deref.\"]\n    #[rental(deref_suffix)] pub struct SimpleRefDeref\n    { head: Box<i32>, iref: &'head i32, }\n    #[doc =\n    r\" Identical to [`SimpleMut`](struct.SimpleMut.html), but with the `deref_mut_suffix` flag enabled. This will provide a `DerefMut` impl for the struct, which will in turn deref the suffix.Notice that this flag also removes the `self` param from all methods, replacing it with an explicit param. This prevents any rental methods from blocking deref.\"]\n    #[rental_mut(deref_mut_suffix)] pub struct SimpleMutDeref\n    { head: Box<i32>, iref: &'head mut i32, }\n    #[doc =\n    r\" Identical to [`SimpleRef`](struct.SimpleRef.html), but with the `covariant` flag enabled. For rental structs where the field types have covariant lifetimes, this will allow you to directly borrow the fields, as they can be safely reborrowed to a shorter lifetime. See the [`all`](struct.SimpleRefCovariant.html#method.all) and [`suffix`](struct.SimpleRefCovariant.html#method.suffix) methods.\"]\n    #[rental(covariant)] pub struct SimpleRefCovariant\n    { head: Box<i32>, iref: &'head i32, }\n    #[doc =\n    r\" Identical to [`SimpleRef`](struct.SimpleRef.html), but with the `map_suffix` flag enabled. This will allow the type of the suffix to be changed by mapping it to another instantiation of the same struct with the different type param. See the [`map`](struct.SimpleRefMap.html#method.map), [`try_map`](struct.SimpleRefMap.html#method.try_map), and [`try_map_or_drop`](struct.SimpleRefMap.html#method.try_map_or_drop) methods.\"]\n    #[rental(map_suffix = \"T\")] pub struct SimpleRefMap<T: 'static>\n    { head: Box<i32>, iref: &'head T, })).0\n}"
    = note: this error originates in the macro `rental` (in Nightly builds, run with -Z macro-backtrace for more info)

error: proc-macro derive panicked
   --> /home/gh-cyrgani/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rental-0.5.5/src/lib.rs:257:13
    |
257 |               #[derive(__rental_structs_and_impls)]
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
...
350 | / rental! {
351 | |     /// Premade types for the most common use cases.
352 | |     pub mod common {
353 | |         use std::ops::DerefMut;
...   |
485 | | }
    | |_- in this macro invocation
    |
    = help: message: expected suffix ").0," not found in "#[allow(unused)] enum ProceduralMasqueradeDummyType\n{\n    Input =\n    (0, stringify!\n    (use std::ops::DerefMut; use stable_deref_trait::StableDeref; use\n    std::cell; use std::sync;\n    #[doc = r\" Stores an owner and a shared reference in the same struct.\"]\n    #[doc = r\"\"] #[doc = r\" ```rust\"] #[doc = r\" # extern crate rental;\"]\n    #[doc = r\" # use rental::common::RentRef;\"] #[doc = r\" # fn main() {\"]\n    #[doc = r\" let r = RentRef::new(Box::new(5), |i| &*i);\"]\n    #[doc = r\" assert_eq!(*r, RentRef::rent(&r, |iref| **iref));\"]\n    #[doc = r\" # }\"] #[doc = r\" ```\"]\n    #[rental(debug, clone, deref_suffix, covariant, map_suffix = \"T\")] pub\n    struct RentRef<H: 'static + StableDeref, T: 'static>\n    { head: H, suffix: &'head T, }\n    #[doc = r\" Stores an owner and a mutable reference in the same struct.\"]\n    #[doc = r\"\"] #[doc = r\" ```rust\"] #[doc = r\" # extern crate rental;\"]\n    #[doc = r\" # use rental::common::RentMut;\"] #[doc = r\" # fn main() {\"]\n    #[doc = r\" let mut r = RentMut::new(Box::new(5), |i| &mut *i);\"]\n    #[doc = r\" *r = 12;\"]\n    #[doc = r\" assert_eq!(12, RentMut::rent(&mut r, |iref| **iref));\"]\n    #[doc = r\" # }\"] #[doc = r\" ```\"]\n    #[rental_mut(debug, deref_mut_suffix, covariant, map_suffix = \"T\")] pub\n    struct RentMut<H: 'static + StableDeref + DerefMut, T: 'static>\n    { head: H, suffix: &'head mut T, }\n    #[doc = r\" Stores a `RefCell` and a `Ref` in the same struct.\"]\n    #[doc = r\"\"] #[doc = r\" ```rust\"] #[doc = r\" # extern crate rental;\"]\n    #[doc = r\" # use rental::common::RentRefCell;\"] #[doc = r\" # fn main() {\"]\n    #[doc = r\" use std::cell;\"] #[doc = r\"\"]\n    #[doc =\n    r\" let r = RentRefCell::new(Box::new(cell::RefCell::new(5)), |c| c.borrow());\"]\n    #[doc = r\" assert_eq!(*r, RentRefCell::rent(&r, |c| **c));\"]\n    #[doc = r\" # }\"] #[doc = r\" ```\"]\n    #[rental(debug, clone, deref_suffix, covariant, map_suffix = \"T\")] pub\n    struct RentRefCell<H: 'static + StableDeref, T: 'static>\n    { head: H, suffix: cell::Ref<'head, T>, }\n    #[doc = r\" Stores a `RefCell` and a `RefMut` in the same struct.\"]\n    #[doc = r\"\"] #[doc = r\" ```rust\"] #[doc = r\" # extern crate rental;\"]\n    #[doc = r\" # use rental::common::RentRefCellMut;\"]\n    #[doc = r\" # fn main() {\"] #[doc = r\" use std::cell;\"] #[doc = r\"\"]\n    #[doc =\n    r\" let mut r = RentRefCellMut::new(Box::new(cell::RefCell::new(5)), |c| c.borrow_mut());\"]\n    #[doc = r\" *r = 12;\"]\n    #[doc = r\" assert_eq!(12, RentRefCellMut::rent(&r, |c| **c));\"]\n    #[doc = r\" # }\"] #[doc = r\" ```\"]\n    #[rental_mut(debug, deref_mut_suffix, covariant, map_suffix = \"T\")] pub\n    struct RentRefCellMut<H: 'static + StableDeref + DerefMut, T: 'static>\n    { head: H, suffix: cell::RefMut<'head, T>, }\n    #[doc = r\" Stores a `Mutex` and a `MutexGuard` in the same struct.\"]\n    #[doc = r\"\"] #[doc = r\" ```rust\"] #[doc = r\" # extern crate rental;\"]\n    #[doc = r\" # use rental::common::RentMutex;\"] #[doc = r\" # fn main() {\"]\n    #[doc = r\" use std::sync;\"] #[doc = r\"\"]\n    #[doc =\n    r\" let mut r = RentMutex::new(Box::new(sync::Mutex::new(5)), |c| c.lock().unwrap());\"]\n    #[doc = r\" *r = 12;\"]\n    #[doc = r\" assert_eq!(12, RentMutex::rent(&r, |c| **c));\"]\n    #[doc = r\" # }\"] #[doc = r\" ```\"]\n    #[rental(debug, clone, deref_mut_suffix, covariant, map_suffix = \"T\")] pub\n    struct RentMutex<H: 'static + StableDeref + DerefMut, T: 'static>\n    { head: H, suffix: sync::MutexGuard<'head, T>, }\n    #[doc =\n    r\" Stores an `RwLock` and an `RwLockReadGuard` in the same struct.\"]\n    #[doc = r\"\"] #[doc = r\" ```rust\"] #[doc = r\" # extern crate rental;\"]\n    #[doc = r\" # use rental::common::RentRwLock;\"] #[doc = r\" # fn main() {\"]\n    #[doc = r\" use std::sync;\"] #[doc = r\"\"]\n    #[doc =\n    r\" let r = RentRwLock::new(Box::new(sync::RwLock::new(5)), |c| c.read().unwrap());\"]\n    #[doc = r\" assert_eq!(*r, RentRwLock::rent(&r, |c| **c));\"]\n    #[doc = r\" # }\"] #[doc = r\" ```\"]\n    #[rental(debug, clone, deref_suffix, covariant, map_suffix = \"T\")] pub\n    struct RentRwLock<H: 'static + StableDeref, T: 'static>\n    { head: H, suffix: sync::RwLockReadGuard<'head, T>, }\n    #[doc =\n    r\" Stores an `RwLock` and an `RwLockWriteGuard` in the same struct.\"]\n    #[doc = r\"\"] #[doc = r\" ```rust\"] #[doc = r\" # extern crate rental;\"]\n    #[doc = r\" # use rental::common::RentRwLockMut;\"]\n    #[doc = r\" # fn main() {\"] #[doc = r\" use std::sync;\"] #[doc = r\"\"]\n    #[doc =\n    r\" let mut r = RentRwLockMut::new(Box::new(sync::RwLock::new(5)), |c| c.write().unwrap());\"]\n    #[doc = r\" *r = 12;\"]\n    #[doc = r\" assert_eq!(12, RentRwLockMut::rent(&r, |c| **c));\"]\n    #[doc = r\" # }\"] #[doc = r\" ```\"]\n    #[rental(debug, clone, deref_mut_suffix, covariant, map_suffix = \"T\")] pub\n    struct RentRwLockMut<H: 'static + StableDeref, T: 'static>\n    { head: H, suffix: sync::RwLockWriteGuard<'head, T>, })).0\n}"
    = note: this error originates in the macro `rental` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `rental` (lib) due to 3 previous errors

@cyrgani cyrgani added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 17, 2026
@petrochenkov
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 17, 2026

📌 Commit 195b849 has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 17, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 18, 2026
remove the explicit error for old `rental` versions

This was converted to a hard error 20 months ago (in rust-lang#125596). This seems like enough time for anyone still using it to notice, so remove the note entirely now.
In comparison, the explicit note for the more impactful `time` breakage was already removed after 6 months (rust-lang#129343).

Closes rust-lang#73933.
Closes rust-lang#83125.

r? @petrochenkov
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 18, 2026
remove the explicit error for old `rental` versions

This was converted to a hard error 20 months ago (in rust-lang#125596). This seems like enough time for anyone still using it to notice, so remove the note entirely now.
In comparison, the explicit note for the more impactful `time` breakage was already removed after 6 months (rust-lang#129343).

Closes rust-lang#73933.
Closes rust-lang#83125.

r? @petrochenkov
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 18, 2026
remove the explicit error for old `rental` versions

This was converted to a hard error 20 months ago (in rust-lang#125596). This seems like enough time for anyone still using it to notice, so remove the note entirely now.
In comparison, the explicit note for the more impactful `time` breakage was already removed after 6 months (rust-lang#129343).

Closes rust-lang#73933.
Closes rust-lang#83125.

r? @petrochenkov
rust-bors bot pushed a commit that referenced this pull request Feb 18, 2026
Rollup of 19 pull requests

Successful merges:

 - #145399 (Unify wording of resolve error)
 - #150473 (tail calls: fix copying non-scalar arguments to callee)
 - #152637 (Add a note about elided lifetime)
 - #152657 (std: move `exit` out of PAL)
 - #152729 (compiler: Don't mark `SingleUseConsts` MIR pass as "required for soundness")
 - #152753 (remove the explicit error for old `rental` versions)
 - #152758 (Remove ShallowInitBox.)
 - #151530 (Fix invalid `mut T` suggestion for `&mut T` in missing lifetime error)
 - #152179 (Add documentation note about signed overflow direction)
 - #152474 (Implement opt-bisect-limit for MIR)
 - #152509 (tests/ui/test-attrs: add annotations for reference rules)
 - #152672 (std: use libc version of `_NSGetArgc`/`_NSGetArgv`)
 - #152711 (resolve: Disable an assert that no longer holds)
 - #152732 (add regression test for 147958)
 - #152745 (Fix ICE in `suggest_param_env_shadowing` with incompatible args)
 - #152749 (make `rustc_allow_const_fn_unstable` an actual `rustc_attrs` attribute)
 - #152756 (Miri: recursive validity: also recurse into Boxes)
 - #152770 (carryless_mul: mention the base)
 - #152778 (Update tracking issue number for final_associated_functions)
rust-bors bot pushed a commit that referenced this pull request Feb 18, 2026
Rollup of 20 pull requests

Successful merges:

 - #145399 (Unify wording of resolve error)
 - #150473 (tail calls: fix copying non-scalar arguments to callee)
 - #152637 (Add a note about elided lifetime)
 - #152729 (compiler: Don't mark `SingleUseConsts` MIR pass as "required for soundness")
 - #152751 (Rename dep node "fingerprints" to distinguish key and value hashes)
 - #152753 (remove the explicit error for old `rental` versions)
 - #152758 (Remove ShallowInitBox.)
 - #151530 (Fix invalid `mut T` suggestion for `&mut T` in missing lifetime error)
 - #152179 (Add documentation note about signed overflow direction)
 - #152474 (Implement opt-bisect-limit for MIR)
 - #152509 (tests/ui/test-attrs: add annotations for reference rules)
 - #152672 (std: use libc version of `_NSGetArgc`/`_NSGetArgv`)
 - #152711 (resolve: Disable an assert that no longer holds)
 - #152725 (Rework explanation of CLI lint level flags)
 - #152732 (add regression test for 147958)
 - #152745 (Fix ICE in `suggest_param_env_shadowing` with incompatible args)
 - #152749 (make `rustc_allow_const_fn_unstable` an actual `rustc_attrs` attribute)
 - #152756 (Miri: recursive validity: also recurse into Boxes)
 - #152770 (carryless_mul: mention the base)
 - #152778 (Update tracking issue number for final_associated_functions)
@rust-bors rust-bors bot merged commit 64087bc into rust-lang:main Feb 18, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 18, 2026
rust-timer added a commit that referenced this pull request Feb 18, 2026
Rollup merge of #152753 - cyrgani:remove-hack, r=petrochenkov

remove the explicit error for old `rental` versions

This was converted to a hard error 20 months ago (in #125596). This seems like enough time for anyone still using it to notice, so remove the note entirely now.
In comparison, the explicit note for the more impactful `time` breakage was already removed after 6 months (#129343).

Closes #73933.
Closes #83125.

r? @petrochenkov
@cyrgani cyrgani deleted the remove-hack branch February 18, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking Issue for proc_macro_back_compat Remove fn pretty_printing_compatibility_hack

3 participants

Comments