<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/source/rss.xsl.xml"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Changes in for_lt.rs</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>e189bdb687a56bcf389798f1d3a2f261fff2ef54 - rust: types: add `ForLt` trait for higher-ranked lifetime support</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/for_lt.rs#e189bdb687a56bcf389798f1d3a2f261fff2ef54</link>
        <description>rust: types: add `ForLt` trait for higher-ranked lifetime supportThere are a few cases, e.g. when dealing with data referencing eachother, one might want to write code that is generic over lifetimes. Forexample, if you want to take a function that takes `&amp;&apos;a Foo` and gives`Bar&lt;&apos;a&gt;`, you can write:    f: impl for&lt;&apos;a&gt; FnOnce(&amp;&apos;a Foo) -&gt; Bar&lt;&apos;a&gt;,However, it becomes tricky when you want that function to not have afixed `Bar`, but have it be generic again. In this case, one needssomething that is generic over types that are themselves generic overlifetimes.`ForLt` provides such support. It provides a trait `ForLt` whichdescribes a type generic over a lifetime. One may use `ForLt::Of&lt;&apos;a&gt;` toget an instance of a type for a specific lifetime.For the case of cross referencing, one would almost always want thelifetime to be covariant. Therefore this is also made a requirement forthe `ForLt` trait, so functions with `ForLt` trait bound can assumecovariance.A macro `ForLt!()` is provided to be able to obtain a type thatimplements `ForLt`. For example, `ForLt!(for&lt;&apos;a&gt; Bar&lt;&apos;a&gt;)` would yield atype that `&lt;TheType as ForLt&gt;::Of&lt;&apos;a&gt;` is `Bar&lt;&apos;a&gt;`. This also workswith lifetime elision, e.g. `ForLt!(Bar&lt;&apos;_&gt;)` or for types withoutlifetime at all, e.g. `ForLt!(u32)`.The API design draws inspiration from the higher-kinded-types [1] crate,however a different design decision has been taken (e.g. covariancerequirement) and the implementation is independent.License headers use &quot;Apache-2.0 OR MIT&quot; because I anticipate this to beused in pin-init crate too which is licensed as such.Link: https://docs.rs/higher-kinded-types/ [1]Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;Reviewed-by: Eliot Courtney &lt;ecourtney@nvidia.com&gt;Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;Acked-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;Reviewed-by: Alexandre Courbot &lt;acourbot@nvidia.com&gt;Link: https://patch.msgid.link/20260525202921.124698-23-dakr@kernel.org[ Handle macro_rules! invocations in the ForLt! proc macro&apos;s covariance  and WF checks. Since proc macros cannot expand macro_rules!, add a  visit_macro() implementation to conservatively assume macro  invocations may contain lifetimes, forcing them through the  compiler-assisted covariance proof.  Fix a few typos in the documentation and in the commit message, add  empty lines before samples, add missing periods and consistently use  markdown.  - Danilo ]Signed-off-by: Danilo Krummrich &lt;dakr@kernel.org&gt;

            List of files:
            /linux/rust/macros/for_lt.rs</description>
        <pubDate>Mon, 25 May 2026 22:21:09 +0200</pubDate>
        <dc:creator>Gary Guo &lt;gary@garyguo.net&gt;</dc:creator>
    </item>
</channel>
</rss>
