You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example fails to compile in a nonsense way:
#![allow(missing_copy_implementations)]#![allow(unused_variables)]use std::borrow::ToOwned;pubstructCFGNode;pubtypeNode<'a> = &'aCFGNode;pubtraitGraphWalk<'c,N>{/// Returns all the nodes in this graph.fnnodes(&'cself)where[N]:ToOwned<Vec<N>>;}impl<'g>GraphWalk<'g,Node<'g>>foru32{fnnodes(&'gself)where[Node<'g>]:ToOwned<Vec<Node<'g>>>{loop{}}}impl<'h>GraphWalk<'h,Node<'h>>foru64{fnnodes(&'hself)where[Node<'h>]:ToOwned<Vec<Node<'h>>>{loop{}}}fnmain(){}
<anon>:23:5: 24:17 error: mismatched types:
expected `core::borrow::ToOwned<collections::vec::Vec<&'h CFGNode>>`,
found `core::borrow::ToOwned<collections::vec::Vec<&'g CFGNode>>`
(lifetime mismatch) [E0308]
<anon>:23 fn nodes(&'h self) where [Node<'h>]:ToOwned<Vec<Node<'h>>>
<anon>:24 { loop { } }
<anon>:24:5: 24:17 note: the lifetime 'h as defined on the block at 24:4...
<anon>:24 { loop { } }
^~~~~~~~~~~~
<anon>:18:5: 18:17 note: ...does not necessarily outlive the lifetime 'g as defined on the block at 18:4
<anon>:18 { loop { } }
^~~~~~~~~~~~
<anon>:23:5: 24:17 error: mismatched types:
expected `core::borrow::ToOwned<collections::vec::Vec<&'h CFGNode>>`,
found `core::borrow::ToOwned<collections::vec::Vec<&'g CFGNode>>`
(lifetime mismatch) [E0308]
<anon>:23 fn nodes(&'h self) where [Node<'h>]:ToOwned<Vec<Node<'h>>>
<anon>:24 { loop { } }
<anon>:18:5: 18:17 note: the lifetime 'g as defined on the block at 18:4...
<anon>:18 { loop { } }
^~~~~~~~~~~~
<anon>:24:5: 24:17 note: ...does not necessarily outlive the lifetime 'h as defined on the block at 24:4
<anon>:24 { loop { } }
^~~~~~~~~~~~
error: aborting due to 2 previous errors
playpen: application terminated with error code 101
Program ended.
These are nonsense because you can see the compiler is comparing two lifetimes ('g and 'h) that are never simultaneously in scope. This arises due to errors in caching.
The text was updated successfully, but these errors were encountered:
are any where-clauses at all. This seems to be the simplest possible
rule and will (hopefully!) put an end to these annoying "cache leak"
bugs. Fixesrust-lang#22019.
Simplify cache selection by just using the local cache whenever there
are any where-clauses at all. This seems to be the simplest possible
rule and will (hopefully!) put an end to these annoying "cache leak"
bugs. Fixes#22019.
r? @aturon
The following example fails to compile in a nonsense way:
Running this code yields the following errors:
These are nonsense because you can see the compiler is comparing two lifetimes (
'g
and'h
) that are never simultaneously in scope. This arises due to errors in caching.The text was updated successfully, but these errors were encountered: