-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-associated_type_bounds`#![feature(associated_type_bounds)]``#![feature(associated_type_bounds)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
#![feature(unboxed_closures, associated_type_bounds)]
fn foo<F>(f: F) where
F: for<'a> FnOnce<(&'a i32,), Output: 'a> {}
fn main() {
foo(|x: &i32| -> &i32 { x });
}
produces:
error: internal compiler error: src/librustc_typeck/check/mod.rs:692: escaping bound vars in predicate Obligation(predicate=Binder(OutlivesPredicate(_, ReLateBound(DebruijnIndex(1), BrNamed(DefId(0:5 ~ playground[eb44]::foo[0]::'a[0]), 'a)))), depth=0)
--> src/main.rs:7:5
|
7 | foo(|x: &i32| -> &i32 { x }); // OK
| ^^^
This does not happen if written out in this form, even though I think it should be equivalent:
F: for<'a> FnOnce<(&'a i32,)>,
for<'a> <F as FnOnce<(&'a i32,)>>::Output: 'a,
May or may not be related to #70263.
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-associated_type_bounds`#![feature(associated_type_bounds)]``#![feature(associated_type_bounds)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
[-]"escaping bound vars in predicate" with unboxed_closures and associated_type_bounds[/-][+]"escaping bound vars in predicate" with unboxed_closures, associated_type_bounds, HRTB[/+]Centril commentedon Mar 23, 2020
cc @alexreg
alexreg commentedon Mar 23, 2020
@Centril Interesting. Is this (should this be) even supported right now? My point is, you can't do this just by concatenating where bounds, so...
Centril commentedon Mar 23, 2020
Minimized
The "desugared" version compiles fine.
[-]"escaping bound vars in predicate" with unboxed_closures, associated_type_bounds, HRTB[/-][+]"escaping bound vars in predicate" with associated_type_bounds, HRTB[/+]Centril commentedon Mar 23, 2020
Desugared version for reference: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e52885892c45f3ab84d4f5d75ad46414
assertion failed: !value.has_escaping_bound_vars()
#74713JohnTitor commentedon Oct 7, 2020
Triage: This is no longer ICE with the latest nightly, marking as E-needs-test.
Auto merge of rust-lang#77741 - JohnTitor:add-tests, r=matthewjasper