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
fntest() -> *mutfor<'a> Fn(&'ausize){// change to *const and it'll workifletSome(_) = Some(1){// not sure why I have to do thisloop{}}else{loop{}}}fnmain(){}
<anon>:2:5: 6:6 error: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements
<anon>:2 if let Some(_) = Some(1) { // not sure why I have to do this
<anon>:3 loop{}
<anon>:4 } else {
<anon>:5 loop{}
<anon>:6 }
note: in expansion of if let expansion
<anon>:2:5: 6:6 note: expansion site
note: first, the lifetime cannot outlive lifetime ReSkolemized(0, BrNamed(0:7, 'a(61)))...
<anon>:2:5: 6:6 note: ...so that types are compatible (expected `for<'a> core::ops::Fn(&'a usize) + 'static`, found `core::ops::Fn(&usize) + 'static`)
<anon>:2 if let Some(_) = Some(1) { // not sure why I have to do this
<anon>:3 loop{}
<anon>:4 } else {
<anon>:5 loop{}
<anon>:6 }
note: in expansion of if let expansion
<anon>:2:5: 6:6 note: expansion site
<anon>:2:5: 6:6 note: but, the lifetime must be valid for the if let at 2:4...
<anon>:2 if let Some(_) = Some(1) { // not sure why I have to do this
<anon>:3 loop{}
<anon>:4 } else {
<anon>:5 loop{}
<anon>:6 }
note: in expansion of if let expansion
<anon>:2:5: 6:6 note: expansion site
<anon>:2:5: 6:6 note: ...so type `*mut core::ops::Fn(&usize)` of expression is valid during the expression
<anon>:2 if let Some(_) = Some(1) { // not sure why I have to do this
<anon>:3 loop{}
<anon>:4 } else {
<anon>:5 loop{}
<anon>:6 }
note: in expansion of if let expansion
<anon>:2:5: 6:6 note: expansion site
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: !ty.needs_infer()', ../src/librustc_typeck/lib.rs:155
The text was updated successfully, but these errors were encountered:
Fixes#28279.
Currently
`common_supertype(*mut for<'a> Fn(&'a usize), *mut for<'a> Fn(&'a usize) + 'static)`
equals `*mut Fn(&usize)` which seems to be caused by `higher_ranked_sub()` allowing region variables to escape the comparison. This prevents inference from working properly with stuff like `Rc<Fn(&T)>`.
r? @nikomatsakis
The text was updated successfully, but these errors were encountered: