From 4f0da0ae02bef5e284b919db6a0b60d6618c6ca0 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 23 Sep 2024 14:44:54 +0200 Subject: [PATCH 1/8] Add test --- charon/tests/ui/impl-trait.out | 17 +++++++++++++++++ charon/tests/ui/impl-trait.rs | 6 ++++++ charon/tests/ui/quantified-clause.out | 20 +++++++++++++++++++- charon/tests/ui/quantified-clause.rs | 6 ++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 charon/tests/ui/impl-trait.out create mode 100644 charon/tests/ui/impl-trait.rs diff --git a/charon/tests/ui/impl-trait.out b/charon/tests/ui/impl-trait.out new file mode 100644 index 00000000..173fe5e2 --- /dev/null +++ b/charon/tests/ui/impl-trait.out @@ -0,0 +1,17 @@ +error: Unimplemented: Alias(Alias { kind: Opaque, args: [Type(Param(ParamTy { index: 0, name: "U" }))], def_id: test_crate::wrap::{opaque#0} }) + --> tests/ui/impl-trait.rs:4:1 + | +4 | / pub fn wrap() -> impl for<'a> FnOnce(&'a U) -> WrapClone<&'a U> { +5 | | |x| WrapClone(x) +6 | | } + | |_^ + +error: Ignoring the following item due to an error: test_crate::wrap + --> tests/ui/impl-trait.rs:4:1 + | +4 | pub fn wrap() -> impl for<'a> FnOnce(&'a U) -> WrapClone<&'a U> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +Error: Charon driver exited with code 101 diff --git a/charon/tests/ui/impl-trait.rs b/charon/tests/ui/impl-trait.rs new file mode 100644 index 00000000..a626beaf --- /dev/null +++ b/charon/tests/ui/impl-trait.rs @@ -0,0 +1,6 @@ +//@ known-failure + +pub struct WrapClone(T); +pub fn wrap() -> impl for<'a> FnOnce(&'a U) -> WrapClone<&'a U> { + |x| WrapClone(x) +} diff --git a/charon/tests/ui/quantified-clause.out b/charon/tests/ui/quantified-clause.out index 57272085..59528be9 100644 --- a/charon/tests/ui/quantified-clause.out +++ b/charon/tests/ui/quantified-clause.out @@ -23,6 +23,24 @@ error: Ignoring the following item due to an error: test_crate::foo 5 | | F: for<'a> FnMut(&'a ()), | |_____________________________^ -error: aborting due to 2 previous errors; 1 warning emitted +thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: +Error: missing binder when translating lifetime +error: Thread panicked when extracting item `test_crate::bar`. + --> tests/ui/quantified-clause.rs:9:1 + | +9 | / fn bar<'b, T>() +10 | | where +11 | | for<'a> &'b T: 'a, + | |______________________^ + +error: Ignoring the following item due to an error: test_crate::bar + --> tests/ui/quantified-clause.rs:9:1 + | +9 | / fn bar<'b, T>() +10 | | where +11 | | for<'a> &'b T: 'a, + | |______________________^ + +error: aborting due to 4 previous errors; 1 warning emitted Error: Charon driver exited with code 101 diff --git a/charon/tests/ui/quantified-clause.rs b/charon/tests/ui/quantified-clause.rs index f45c9c49..88bd96e0 100644 --- a/charon/tests/ui/quantified-clause.rs +++ b/charon/tests/ui/quantified-clause.rs @@ -5,3 +5,9 @@ where F: for<'a> FnMut(&'a ()), { } + +fn bar<'b, T>() +where + for<'a> &'b T: 'a, +{ +} From 5a058217a0bbe6cb6e555280d128e60eaddd19a4 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 20 Sep 2024 09:51:55 +0200 Subject: [PATCH 2/8] Factor out the handling of region binders --- .../charon-driver/translate/translate_ctx.rs | 69 ++++++++++++++----- .../translate/translate_functions_to_ullbc.rs | 16 +---- .../translate/translate_types.rs | 31 +-------- .../unsupported/advanced-const-generics.out | 2 +- 4 files changed, 57 insertions(+), 61 deletions(-) diff --git a/charon/src/bin/charon-driver/translate/translate_ctx.rs b/charon/src/bin/charon-driver/translate/translate_ctx.rs index abf61df9..cc50c9d2 100644 --- a/charon/src/bin/charon-driver/translate/translate_ctx.rs +++ b/charon/src/bin/charon-driver/translate/translate_ctx.rs @@ -1,5 +1,6 @@ //! The translation contexts. use super::translate_predicates::NonLocalTraitClause; +use super::translate_types::translate_bound_region_kind_name; use charon_lib::ast::*; use charon_lib::common::*; use charon_lib::formatter::{FmtCtx, IntoFormatter}; @@ -23,6 +24,7 @@ use std::cmp::{Ord, PartialOrd}; use std::collections::HashMap; use std::collections::{BTreeMap, VecDeque}; use std::fmt; +use std::mem; use std::path::Component; use std::sync::Arc; @@ -1018,18 +1020,54 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { rid } + /// Translate a binder of regions by appending the stored reguions to the given vector. + pub(crate) fn translate_region_binder( + &mut self, + span: rustc_span::Span, + binder: hax::Binder<()>, + region_vars: &mut Vector, + ) -> Result, Error> { + use hax::BoundVariableKind::*; + binder + .bound_vars + .into_iter() + .map(|p| match p { + Region(region) => { + let name = translate_bound_region_kind_name(®ion); + let id = region_vars.push_with(|index| RegionVar { index, name }); + Ok(id) + } + Ty(_) => { + error_or_panic!(self, span, "Unexpected locally bound type variable"); + } + Const => { + error_or_panic!( + self, + span, + "Unexpected locally bound const generic variable" + ); + } + }) + .try_collect() + } + /// Set the first bound regions group - pub(crate) fn set_first_bound_regions_group(&mut self, names: Vec>) { + pub(crate) fn set_first_bound_regions_group( + &mut self, + span: rustc_span::Span, + binder: hax::Binder<()>, + ) -> Result<(), Error> { assert!(self.bound_region_vars.is_empty()); + assert_eq!(self.region_vars.len(), 1); // Register the variables - let var_ids: Box<[RegionId]> = names - .into_iter() - .map(|name| self.region_vars[0].push_with(|index| RegionVar { index, name })) - .collect(); - - // Push the group + // There may already be lifetimes in the current group. + let mut region_vars = mem::take(&mut self.region_vars[0]); + let var_ids = self.translate_region_binder(span, binder, &mut region_vars)?; + self.region_vars[0] = region_vars; self.bound_region_vars.push_front(var_ids); + + Ok(()) } /// Push a group of bound regions and call the continuation. @@ -1037,23 +1075,20 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { /// it contains universally quantified regions). pub(crate) fn with_locally_bound_regions_group( &mut self, - names: Vec>, + span: rustc_span::Span, + binder: hax::Binder<()>, f: F, - ) -> T + ) -> Result where - F: FnOnce(&mut Self) -> T, + F: FnOnce(&mut Self) -> Result, { assert!(!self.region_vars.is_empty()); - self.region_vars.push_front(Vector::new()); // Register the variables - let var_ids: Box<[RegionId]> = names - .into_iter() - .map(|name| self.region_vars[0].push_with(|index| RegionVar { index, name })) - .collect(); - - // Push the group + let mut bound_vars = Vector::new(); + let var_ids = self.translate_region_binder(span, binder, &mut bound_vars)?; self.bound_region_vars.push_front(var_ids); + self.region_vars.push_front(bound_vars); // Call the continuation let res = f(self); diff --git a/charon/src/bin/charon-driver/translate/translate_functions_to_ullbc.rs b/charon/src/bin/charon-driver/translate/translate_functions_to_ullbc.rs index 408d24dd..bcb63ef3 100644 --- a/charon/src/bin/charon-driver/translate/translate_functions_to_ullbc.rs +++ b/charon/src/bin/charon-driver/translate/translate_functions_to_ullbc.rs @@ -9,7 +9,6 @@ use std::rc::Rc; use super::get_mir::{boxes_are_desugared, get_mir_for_def_id_and_level}; use super::translate_ctx::*; -use super::translate_types; use charon_lib::ast::*; use charon_lib::common::*; use charon_lib::formatter::{Formatter, IntoFormatter}; @@ -21,7 +20,6 @@ use hax_frontend_exporter::{HasMirSetter, HasOwnerIdSetter, SInto}; use itertools::Itertools; use rustc_hir::def_id::DefId; use rustc_middle::mir::START_BLOCK; -use translate_types::translate_bound_region_kind_name; pub(crate) struct SubstFunId { pub func: FnPtr, @@ -1410,18 +1408,8 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { self.push_generics_for_def(span, &def)?; // Add the *late-bound* parameters (bound in the signature, can only be lifetimes). - let bvar_names = signature - .bound_vars - .iter() - // There should only be regions in the late-bound parameters - .map(|bvar| match bvar { - hax::BoundVariableKind::Region(br) => Ok(translate_bound_region_kind_name(&br)), - hax::BoundVariableKind::Ty(_) | hax::BoundVariableKind::Const => { - error_or_panic!(self, span, format!("Unexpected bound variable: {:?}", bvar)) - } - }) - .try_collect()?; - self.set_first_bound_regions_group(bvar_names); + let binder = signature.as_ref().map(|_| ()); + self.set_first_bound_regions_group(span, binder)?; let generics = self.get_generics(); diff --git a/charon/src/bin/charon-driver/translate/translate_types.rs b/charon/src/bin/charon-driver/translate/translate_types.rs index 9eb66f48..202c48b2 100644 --- a/charon/src/bin/charon-driver/translate/translate_types.rs +++ b/charon/src/bin/charon-driver/translate/translate_types.rs @@ -325,36 +325,9 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { trace!("Arrow"); trace!("bound vars: {:?}", sig.bound_vars); - // Translate the generics parameters. - // Note that there can only be bound regions. - let bound_region_names: Vec> = sig - .bound_vars - .iter() - .map(|p| { - use hax::BoundVariableKind::*; - match p { - Region(region) => Ok(translate_bound_region_kind_name(region)), - Ty(_) => { - error_or_panic!( - self, - span, - "Unexpected locally bound type variable" - ); - } - Const => { - error_or_panic!( - self, - span, - "Unexpected locally bound const generic variable" - ); - } - } - }) - .try_collect()?; - - // Push the ground region group let erase_regions = false; - self.with_locally_bound_regions_group(bound_region_names, move |ctx| { + let binder = sig.as_ref().map(|_| ()); + self.with_locally_bound_regions_group(span, binder, move |ctx| { let regions = ctx.region_vars[0].clone(); let inputs = sig .value diff --git a/charon/tests/ui/unsupported/advanced-const-generics.out b/charon/tests/ui/unsupported/advanced-const-generics.out index 0e7b0c97..4b6dc858 100644 --- a/charon/tests/ui/unsupported/advanced-const-generics.out +++ b/charon/tests/ui/unsupported/advanced-const-generics.out @@ -1,4 +1,4 @@ -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:748:42: +thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:721:42: called `Option::unwrap()` on a `None` value note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: Thread panicked when extracting item `test_crate::foo`. From 474b0e7446271ac7dca07a9cb5cc391da1f67385 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 20 Sep 2024 10:56:21 +0200 Subject: [PATCH 3/8] Register predicates directly instead of returning them first --- .../translate/translate_predicates.rs | 60 +++++++------------ .../translate/translate_traits.rs | 2 +- .../translate/translate_types.rs | 2 +- 3 files changed, 24 insertions(+), 40 deletions(-) diff --git a/charon/src/bin/charon-driver/translate/translate_predicates.rs b/charon/src/bin/charon-driver/translate/translate_predicates.rs index c17e46e2..eadf3c54 100644 --- a/charon/src/bin/charon-driver/translate/translate_predicates.rs +++ b/charon/src/bin/charon-driver/translate/translate_predicates.rs @@ -7,7 +7,6 @@ use charon_lib::ids::Vector; use charon_lib::pretty::FmtWithCtx; use charon_lib::types::*; use hax_frontend_exporter as hax; -use macros::{EnumAsGetters, EnumIsA, EnumToGetters}; use rustc_span::def_id::DefId; /// Same as [TraitClause], but where the clause id is a [TraitInstanceId]. @@ -65,14 +64,6 @@ impl FmtWithCtx for NonLocalTraitClause { } } -#[derive(Debug, Clone, EnumIsA, EnumAsGetters, EnumToGetters)] -pub(crate) enum Predicate { - Trait(#[expect(dead_code)] TraitClauseId), - TypeOutlives(TypeOutlives), - RegionOutlives(RegionOutlives), - TraitType(TraitTypeConstraint), -} - impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { pub fn count_generics( &mut self, @@ -120,7 +111,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { /// This function should be called **after** we translated the generics (type parameters, /// regions...). - pub(crate) fn translate_predicates( + pub(crate) fn register_predicates( &mut self, preds: &hax::GenericPredicates, origin: PredicateOrigin, @@ -134,9 +125,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { pred.kind.value, hax::PredicateKind::Clause(hax::ClauseKind::Trait(_)) ) { - // Don't need to do anything with the translated clause, it is already registered - // in `self.trait_clauses`. - let _ = self.translate_predicate(pred, span, origin.clone(), location)?; + self.register_predicate(pred, span, origin.clone(), location)?; } } for (pred, span) in &preds.predicates { @@ -144,17 +133,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { pred.kind.value, hax::PredicateKind::Clause(hax::ClauseKind::Trait(_)) ) { - match self.translate_predicate(pred, span, origin.clone(), location)? { - None => (), - Some(pred) => match pred { - Predicate::TypeOutlives(p) => self.generic_params.types_outlive.push(p), - Predicate::RegionOutlives(p) => self.generic_params.regions_outlive.push(p), - Predicate::TraitType(p) => { - self.generic_params.trait_type_constraints.push(p) - } - Predicate::Trait(_) => unreachable!(), - }, - } + self.register_predicate(pred, span, origin.clone(), location)?; } } Ok(()) @@ -186,7 +165,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { /// auto traits like [core::marker::Sized] and [core::marker::Sync]. /// /// `origin` is where this clause comes from. - pub(crate) fn translate_trait_clause( + pub(crate) fn register_trait_clause( &mut self, hspan: &hax::Span, trait_pred: &hax::TraitPredicate, @@ -281,13 +260,13 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { Ok(TraitDeclRef { trait_id, generics }) } - pub(crate) fn translate_predicate( + pub(crate) fn register_predicate( &mut self, pred: &hax::Predicate, hspan: &hax::Span, origin: PredicateOrigin, location: &PredicateLocation, - ) -> Result, Error> { + ) -> Result<(), Error> { trace!("{:?}", pred); // Predicates are always used in signatures/type definitions, etc. // For this reason, we do not erase the regions. @@ -299,21 +278,24 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { // but it is ok because we only do a simple check. let pred_kind = &pred.kind.value; use hax::{ClauseKind, PredicateKind}; + match pred_kind { PredicateKind::Clause(kind) => { match kind { - ClauseKind::Trait(trait_pred) => Ok(self - .translate_trait_clause(hspan, trait_pred, origin, location)? - .map(Predicate::Trait)), + ClauseKind::Trait(trait_pred) => { + self.register_trait_clause(hspan, trait_pred, origin, location)?; + } ClauseKind::RegionOutlives(p) => { let r0 = self.translate_region(span, erase_regions, &p.lhs)?; let r1 = self.translate_region(span, erase_regions, &p.rhs)?; - Ok(Some(Predicate::RegionOutlives(OutlivesPred(r0, r1)))) + self.generic_params + .regions_outlive + .push(OutlivesPred(r0, r1)); } ClauseKind::TypeOutlives(p) => { let ty = self.translate_ty(span, erase_regions, &p.lhs)?; let r = self.translate_region(span, erase_regions, &p.rhs)?; - Ok(Some(Predicate::TypeOutlives(OutlivesPred(ty, r)))) + self.generic_params.types_outlive.push(OutlivesPred(ty, r)); } ClauseKind::Projection(p) => { // This is used to express constraints over associated types. @@ -335,17 +317,18 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { let trait_ref = trait_ref.unwrap(); let ty = self.translate_ty(span, erase_regions, ty).unwrap(); let type_name = TraitItemName(assoc_item.name.clone().into()); - Ok(Some(Predicate::TraitType(TraitTypeConstraint { - trait_ref, - type_name, - ty, - }))) + self.generic_params + .trait_type_constraints + .push(TraitTypeConstraint { + trait_ref, + type_name, + ty, + }); } ClauseKind::ConstArgHasType(..) => { // I don't really understand that one. Why don't they put // the type information in the const generic parameters // directly? For now we just ignore it. - Ok(None) } ClauseKind::WellFormed(_) | ClauseKind::ConstEvaluatable(_) => { error_or_panic!(self, span, format!("Unsupported clause: {:?}", kind)) @@ -364,6 +347,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { format!("Unsupported predicate: {:?}", pred_kind) ), } + Ok(()) } pub(crate) fn translate_trait_impl_exprs( diff --git a/charon/src/bin/charon-driver/translate/translate_traits.rs b/charon/src/bin/charon-driver/translate/translate_traits.rs index de217c52..2575eeec 100644 --- a/charon/src/bin/charon-driver/translate/translate_traits.rs +++ b/charon/src/bin/charon-driver/translate/translate_traits.rs @@ -138,7 +138,7 @@ impl<'tcx, 'ctx> TranslateCtx<'tcx, 'ctx> { }; // TODO: handle generics (i.e. GATs). // Register the trait clauses as item trait clauses - bt_ctx.translate_predicates( + bt_ctx.register_predicates( &predicates, PredicateOrigin::TraitItem(name.clone()), &PredicateLocation::Item(def_id, name.clone()), diff --git a/charon/src/bin/charon-driver/translate/translate_types.rs b/charon/src/bin/charon-driver/translate/translate_types.rs index 202c48b2..7bc0decd 100644 --- a/charon/src/bin/charon-driver/translate/translate_types.rs +++ b/charon/src/bin/charon-driver/translate/translate_types.rs @@ -680,7 +680,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { } _ => panic!("Unexpected def: {def:?}"), }; - self.translate_predicates(predicates, origin, &location)?; + self.register_predicates(predicates, origin, &location)?; } Ok(()) } From 0b9b7b833e6614818e6303e87abeb5a7f2893c34 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 20 Sep 2024 10:57:38 +0200 Subject: [PATCH 4/8] Update the hax dependency --- charon/Cargo.lock | 6 +++--- charon/Cargo.toml | 2 -- .../translate/translate_predicates.rs | 2 +- charon/tests/ui/generic-associated-types.out | 20 ++++++++++++++++--- .../ui/issue-372-type-param-out-of-range.out | 8 +------- charon/tests/ui/quantified-clause.out | 8 +------- charon/tests/ui/trait-instance-id.out | 18 ++++++++--------- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/charon/Cargo.lock b/charon/Cargo.lock index 6788fbf6..e36f9a58 100644 --- a/charon/Cargo.lock +++ b/charon/Cargo.lock @@ -506,7 +506,7 @@ dependencies = [ [[package]] name = "hax-adt-into" version = "0.1.0-pre.1" -source = "git+https://github.com/hacspec/hax?branch=main#288f77f086bbbd28a953ac66f77281750dbf8138" +source = "git+https://github.com/hacspec/hax?branch=main#39a2f0aa52a605f68caee8f88fc6c479375becf0" dependencies = [ "itertools 0.11.0", "proc-macro2", @@ -517,7 +517,7 @@ dependencies = [ [[package]] name = "hax-frontend-exporter" version = "0.1.0-pre.1" -source = "git+https://github.com/hacspec/hax?branch=main#288f77f086bbbd28a953ac66f77281750dbf8138" +source = "git+https://github.com/hacspec/hax?branch=main#39a2f0aa52a605f68caee8f88fc6c479375becf0" dependencies = [ "bincode", "extension-traits", @@ -535,7 +535,7 @@ dependencies = [ [[package]] name = "hax-frontend-exporter-options" version = "0.1.0-pre.1" -source = "git+https://github.com/hacspec/hax?branch=main#288f77f086bbbd28a953ac66f77281750dbf8138" +source = "git+https://github.com/hacspec/hax?branch=main#39a2f0aa52a605f68caee8f88fc6c479375becf0" dependencies = [ "bincode", "hax-adt-into", diff --git a/charon/Cargo.toml b/charon/Cargo.toml index 8f51c84b..a1a02887 100644 --- a/charon/Cargo.toml +++ b/charon/Cargo.toml @@ -76,8 +76,6 @@ tracing = { version = "0.1", features = [ "max_level_trace" ] } which = "6.0.1" hax-frontend-exporter = { git = "https://github.com/hacspec/hax", branch = "main", optional = true } -# hax-frontend-exporter = { git = "https://github.com/Nadrieril/hax", branch = "charon", optional = true } -# hax-frontend-exporter = { path = "../../hax/frontend/exporter", optional = true } macros = { path = "./macros" } [features] diff --git a/charon/src/bin/charon-driver/translate/translate_predicates.rs b/charon/src/bin/charon-driver/translate/translate_predicates.rs index eadf3c54..4d2b8cf9 100644 --- a/charon/src/bin/charon-driver/translate/translate_predicates.rs +++ b/charon/src/bin/charon-driver/translate/translate_predicates.rs @@ -436,9 +436,9 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { path, } | ImplExprAtom::LocalBound { - predicate_id: _, r#trait: trait_ref, path, + .. } => { assert!(nested.is_empty()); trace!( diff --git a/charon/tests/ui/generic-associated-types.out b/charon/tests/ui/generic-associated-types.out index ecce0e64..cbc0fe83 100644 --- a/charon/tests/ui/generic-associated-types.out +++ b/charon/tests/ui/generic-associated-types.out @@ -16,8 +16,8 @@ error: Ignoring the following item due to an error: test_crate::{impl#0} 10 | impl<'a, T> LendingIterator for Option<&'a T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -thread 'rustc' panicked at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/compiler/rustc_type_ir/src/binder.rs:783:9: -const parameter `'a/#1` ('a/#1/1) out of range when instantiating args=[Self/#0] +thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/normalize.rs:151:9: +Normalizing <::Item<'a> as std::marker::Sized> without wrapping in a `Binder` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: Thread panicked when extracting item `test_crate::LendingIterator::next`. --> tests/ui/generic-associated-types.rs:7:5 @@ -31,6 +31,20 @@ error: Ignoring the following item due to an error: test_crate::LendingIterator: 7 | fn next<'a>(&'a mut self) -> Option>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: +Error: missing binder when translating lifetime +error: Thread panicked when extracting item `test_crate::{impl#0}::next`. + --> tests/ui/generic-associated-types.rs:13:5 + | +13 | fn next<'b>(&'b mut self) -> Option> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: Ignoring the following item due to an error: test_crate::{impl#0}::next + --> tests/ui/generic-associated-types.rs:13:5 + | +13 | fn next<'b>(&'b mut self) -> Option> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + thread 'rustc' panicked at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/compiler/rustc_type_ir/src/binder.rs:783:9: const parameter `'a/#1` ('a/#1/1) out of range when instantiating args=[I/#0] error: Thread panicked when extracting item `test_crate::for_each`. @@ -53,6 +67,6 @@ warning: unused variable: `x` | = note: `#[warn(unused_variables)]` on by default -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 8 previous errors; 1 warning emitted Error: Charon driver exited with code 101 diff --git a/charon/tests/ui/issue-372-type-param-out-of-range.out b/charon/tests/ui/issue-372-type-param-out-of-range.out index 5a0c74f6..1f4756e4 100644 --- a/charon/tests/ui/issue-372-type-param-out-of-range.out +++ b/charon/tests/ui/issue-372-type-param-out-of-range.out @@ -17,12 +17,6 @@ error: Ignoring the following item due to an error: test_crate::{impl#0}::f 10 | | F: FnMut(&u32), | |_______________________^ -disabled backtrace -warning[E9999]: Could not find a clause for `Binder { value: >, bound_vars: [Region(BrNamed(test_crate::{impl#0}::g::'b, 'b))] }` in the item parameters - | - = note: ⚠️ This is a bug in Hax's frontend. - Please report this error to https://github.com/hacspec/hax/issues with some context (e.g. the current crate)! - thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: Error: missing binder when translating lifetime error: Thread panicked when extracting item `test_crate::{impl#0}::g`. @@ -59,6 +53,6 @@ error: Ignoring the following item due to an error: test_crate::{impl#1}::f 26 | | F: FnMut(&u32), | |_______________________^ -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 6 previous errors Error: Charon driver exited with code 101 diff --git a/charon/tests/ui/quantified-clause.out b/charon/tests/ui/quantified-clause.out index 59528be9..0a83a12b 100644 --- a/charon/tests/ui/quantified-clause.out +++ b/charon/tests/ui/quantified-clause.out @@ -1,9 +1,3 @@ -disabled backtrace -warning[E9999]: Could not find a clause for `Binder { value: >, bound_vars: [Region(BrNamed(test_crate::foo::'a, 'a))] }` in the item parameters - | - = note: ⚠️ This is a bug in Hax's frontend. - Please report this error to https://github.com/hacspec/hax/issues with some context (e.g. the current crate)! - thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: Error: missing binder when translating lifetime note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace @@ -41,6 +35,6 @@ error: Ignoring the following item due to an error: test_crate::bar 11 | | for<'a> &'b T: 'a, | |______________________^ -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 4 previous errors Error: Charon driver exited with code 101 diff --git a/charon/tests/ui/trait-instance-id.out b/charon/tests/ui/trait-instance-id.out index bc17ba84..3c7fa894 100644 --- a/charon/tests/ui/trait-instance-id.out +++ b/charon/tests/ui/trait-instance-id.out @@ -366,7 +366,7 @@ fn core::array::iter::{impl core::iter::traits::iterator::Iterator for core::arr fn core::array::iter::{impl core::iter::traits::iterator::Iterator for core::array::iter::IntoIter}#2::fold(@1: core::array::iter::IntoIter, @2: Acc, @3: Fold) -> Acc where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "Fold" })), Type(Tuple([Param(ParamTy { index: 2, name: "Acc" }), Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::array::iter::IntoIter })] }, bound_vars: [] }, impl: Concrete { id: core::array::iter::{impl#2}, generics: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::array::iter::IntoIter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "Fold" })), Type(Tuple([Param(ParamTy { index: 2, name: "Acc" }), Param(ParamTy { index: 0, name: "T" })]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::array::iter::IntoIter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "Acc" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 3, name: "Fold" }))] }) (context: core::array::iter::{impl#2}::fold)))::[@TraitClause0])::Output = Acc, + (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "Fold" })), Type(Tuple([Param(ParamTy { index: 2, name: "Acc" }), Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::array::iter::IntoIter })] }, bound_vars: [] }, impl: Concrete { id: core::array::iter::{impl#2}, generics: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::array::iter::IntoIter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "Fold" })), Type(Tuple([Param(ParamTy { index: 2, name: "Acc" }), Param(ParamTy { index: 0, name: "T" })]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::array::iter::IntoIter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "Acc" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 3, name: "Fold" }))] }) (context: core::array::iter::{impl#2}::fold)))::[@TraitClause0])::Output = Acc, unsafe fn core::array::iter::{impl core::iter::traits::iterator::Iterator for core::array::iter::IntoIter}#2::__iterator_get_unchecked<'_0, T, const N : usize>(@1: &'_0 mut (core::array::iter::IntoIter), @2: usize) -> core::array::iter::{impl core::iter::traits::iterator::Iterator for core::array::iter::IntoIter}#2::Item @@ -428,32 +428,32 @@ fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::sli fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::for_each<'a, T, F>(@1: core::slice::iter::Iter<'a, T>, @2: F) where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "F" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::for_each)))::[@TraitClause0])::Output = (), + (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "F" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::for_each)))::[@TraitClause0])::Output = (), fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::fold<'a, T, B, F>(@1: core::slice::iter::Iter<'a, T>, @2: B, @3: F) -> B where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Param(ParamTy { index: 2, name: "B" }), Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Param(ParamTy { index: 2, name: "B" }), Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "B" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 3, name: "F" }))] }) (context: core::slice::iter::{impl#182}::fold)))::[@TraitClause0])::Output = B, + (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Param(ParamTy { index: 2, name: "B" }), Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Param(ParamTy { index: 2, name: "B" }), Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "B" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 3, name: "F" }))] }) (context: core::slice::iter::{impl#182}::fold)))::[@TraitClause0])::Output = B, fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::all<'a, '_1, T, F>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: F) -> bool where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "F" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::all)))::[@TraitClause0])::Output = bool, + (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "F" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::all)))::[@TraitClause0])::Output = bool, fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::any<'a, '_1, T, F>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: F) -> bool where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "F" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::any)))::[@TraitClause0])::Output = bool, + (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "F" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::any)))::[@TraitClause0])::Output = bool, fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::find_map<'a, '_1, T, B, F>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: F) -> core::option::Option where [@TraitClause4]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause4]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "B" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 3, name: "F" }))] }; [@TraitClause3]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::find_map)))::[@TraitClause0])::Output = core::option::Option, + (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause4]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "B" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 3, name: "F" }))] }; [@TraitClause3]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::find_map)))::[@TraitClause0])::Output = core::option::Option, fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::position<'a, '_1, T, P>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: P) -> core::option::Option where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "P" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::position)))::[@TraitClause0])::Output = bool, + (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "P" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::position)))::[@TraitClause0])::Output = bool, trait core::iter::traits::exact_size::ExactSizeIterator { @@ -464,10 +464,10 @@ trait core::iter::traits::exact_size::ExactSizeIterator fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::rposition<'a, '_1, T, P>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: P) -> core::option::Option where - [@TraitClause2]: core::ops::function::FnMut, + [@TraitClause2]: core::ops::function::FnMut, [@TraitClause4]: core::iter::traits::exact_size::ExactSizeIterator>, [@TraitClause5]: core::iter::traits::double_ended::DoubleEndedIterator>, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(10147034824531024157), trait: Binder { value: TraitRef { def_id: core::iter::traits::exact_size::ExactSizeIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, path: [Parent { predicate: Binder { value: TraitPredicate { trait_ref: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, is_positive: true }, bound_vars: [] }, predicate_id: PredicateId(14059393054930725987), index: 0 }] }, args: [] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause2]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(10147034824531024157), trait: Binder { value: TraitRef { def_id: core::iter::traits::exact_size::ExactSizeIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, path: [Parent { predicate: Binder { value: TraitPredicate { trait_ref: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, is_positive: true }, bound_vars: [] }, predicate_id: PredicateId(14059393054930725987), index: 0 }] }, args: [] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] }; [@TraitClause5]: TraitRef { def_id: core::iter::traits::double_ended::DoubleEndedIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause4]: TraitRef { def_id: core::iter::traits::exact_size::ExactSizeIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "P" }))] }; [@TraitClause3]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::rposition)))::[@TraitClause0])::Output = bool, + (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(8741807603274333571), index: 4, trait: Binder { value: TraitRef { def_id: core::iter::traits::exact_size::ExactSizeIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, path: [Parent { predicate: Binder { value: TraitPredicate { trait_ref: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, is_positive: true }, bound_vars: [] }, predicate_id: PredicateId(7752569106737159048), index: 0 }] }, args: [] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause2]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(8741807603274333571), index: 4, trait: Binder { value: TraitRef { def_id: core::iter::traits::exact_size::ExactSizeIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, path: [Parent { predicate: Binder { value: TraitPredicate { trait_ref: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, is_positive: true }, bound_vars: [] }, predicate_id: PredicateId(7752569106737159048), index: 0 }] }, args: [] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] }; [@TraitClause5]: TraitRef { def_id: core::iter::traits::double_ended::DoubleEndedIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause4]: TraitRef { def_id: core::iter::traits::exact_size::ExactSizeIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "P" }))] }; [@TraitClause3]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::rposition)))::[@TraitClause0])::Output = bool, unsafe fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::__iterator_get_unchecked<'a, '_1, T>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: usize) -> core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182<'_, T>::Item From 72860f0614df7591a7d322150b7540b94c3a578d Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 20 Sep 2024 10:46:36 +0200 Subject: [PATCH 5/8] Properly bind regions in predicates --- charon/src/ast/types.rs | 32 ++- charon/src/ast/types_utils.rs | 20 ++ .../translate/translate_functions_to_ullbc.rs | 2 +- .../translate/translate_predicates.rs | 207 ++++++++++-------- .../translate/translate_types.rs | 4 +- charon/src/pretty/fmt_with_ctx.rs | 62 +++++- charon/src/transform/hide_marker_traits.rs | 14 +- charon/tests/crate_data.rs | 2 +- charon/tests/ui/generic-associated-types.out | 16 +- .../ui/issue-372-type-param-out-of-range.out | 12 +- charon/tests/ui/quantified-clause.out | 24 +- 11 files changed, 237 insertions(+), 158 deletions(-) diff --git a/charon/src/ast/types.rs b/charon/src/ast/types.rs index cb1ab303..96e006e4 100644 --- a/charon/src/ast/types.rs +++ b/charon/src/ast/types.rs @@ -216,10 +216,10 @@ pub enum TraitRefKind { /// A specific builtin trait implementation like [core::marker::Sized] or /// auto trait implementation like [core::marker::Syn]. - BuiltinOrAuto(TraitDeclRef), + BuiltinOrAuto(PolyTraitDeclRef), /// The automatically-generated implementation for `dyn Trait`. - Dyn(TraitDeclRef), + Dyn(PolyTraitDeclRef), /// The trait ref could not be resolved, likely because the corresponding clause had not been /// registered yet. We will try resolving it again once all clauses are registered. @@ -238,10 +238,10 @@ pub struct TraitRef { #[charon::rename("trait_id")] pub kind: TraitRefKind, /// Not necessary, but useful - pub trait_decl_ref: TraitDeclRef, + pub trait_decl_ref: PolyTraitDeclRef, } -/// Reference to a trait declaration. +/// A predicate of the form `Type: Trait`. /// /// About the generics, if we write: /// ```text @@ -257,6 +257,9 @@ pub struct TraitDeclRef { pub generics: GenericArgs, } +/// A quantified trait predicate, e.g. `for<'a> Type<'a>: Trait<'a, Args>`. +pub type PolyTraitDeclRef = RegionBinder; + /// .0 outlives .1 #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct OutlivesPred(pub T, pub U); @@ -305,6 +308,19 @@ pub struct GenericArgs { pub trait_refs: Vector, } +/// A value of type `T` bound by generic parameters. Used in any context where we're adding generic +/// parameters that aren't on the top-level item, e.g. `for<'a>` clauses, trait methods (TODO), +/// GATs (TODO). +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)] +pub struct RegionBinder { + #[charon::rename("binder_regions")] + pub regions: Vector, + /// Named this way to highlight accesses to the inner value that might be handling parameters + /// incorrectly. Prefer using helper methods. + #[charon::rename("binder_value")] + pub skip_binder: T, +} + /// Generic parameters for a declaration. /// We group the generics which come from the Rust compiler substitutions /// (the regions, types and const generics) as well as the trait clauses. @@ -320,11 +336,11 @@ pub struct GenericParams { // TODO: rename to match [GenericArgs]? pub trait_clauses: Vector, /// The first region in the pair outlives the second region - pub regions_outlive: Vec, + pub regions_outlive: Vec>, /// The type outlives the region - pub types_outlive: Vec, + pub types_outlive: Vec>, /// Constraints over trait associated types - pub trait_type_constraints: Vec, + pub trait_type_constraints: Vec>, } /// A predicate of the form `exists where T: Trait`. @@ -354,7 +370,7 @@ pub struct TraitClause { pub origin: PredicateOrigin, /// The trait that is implemented. #[charon::rename("trait")] - pub trait_: TraitDeclRef, + pub trait_: PolyTraitDeclRef, } impl Eq for TraitClause {} diff --git a/charon/src/ast/types_utils.rs b/charon/src/ast/types_utils.rs index 44aaec5d..37a9e678 100644 --- a/charon/src/ast/types_utils.rs +++ b/charon/src/ast/types_utils.rs @@ -1,6 +1,7 @@ //! This file groups everything which is linked to implementations about [crate::types] use crate::ids::Vector; use crate::types::*; +use derive_visitor::{Drive, DriveMut, Event, Visitor, VisitorMut}; use std::iter::Iterator; impl DeBruijnId { @@ -330,3 +331,22 @@ impl RefKind { } } } + +// The derive macro doesn't handle generics. +impl Drive for RegionBinder { + fn drive(&self, visitor: &mut V) { + visitor.visit(self, Event::Enter); + self.regions.drive(visitor); + self.skip_binder.drive(visitor); + visitor.visit(self, Event::Exit); + } +} + +impl DriveMut for RegionBinder { + fn drive_mut(&mut self, visitor: &mut V) { + visitor.visit(self, Event::Enter); + self.regions.drive_mut(visitor); + self.skip_binder.drive_mut(visitor); + visitor.visit(self, Event::Exit); + } +} diff --git a/charon/src/bin/charon-driver/translate/translate_functions_to_ullbc.rs b/charon/src/bin/charon-driver/translate/translate_functions_to_ullbc.rs index bcb63ef3..92098792 100644 --- a/charon/src/bin/charon-driver/translate/translate_functions_to_ullbc.rs +++ b/charon/src/bin/charon-driver/translate/translate_functions_to_ullbc.rs @@ -1408,7 +1408,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { self.push_generics_for_def(span, &def)?; // Add the *late-bound* parameters (bound in the signature, can only be lifetimes). - let binder = signature.as_ref().map(|_| ()); + let binder = signature.rebind(()); self.set_first_bound_regions_group(span, binder)?; let generics = self.get_generics(); diff --git a/charon/src/bin/charon-driver/translate/translate_predicates.rs b/charon/src/bin/charon-driver/translate/translate_predicates.rs index 4d2b8cf9..463f393f 100644 --- a/charon/src/bin/charon-driver/translate/translate_predicates.rs +++ b/charon/src/bin/charon-driver/translate/translate_predicates.rs @@ -145,20 +145,26 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { &mut self, span: rustc_span::Span, erase_regions: bool, - trait_ref: &hax::Binder, - ) -> Result, Error> { - // TODO: handle binder properly - let trait_ref = trait_ref.as_ref().hax_skip_binder(); - let trait_id = self.register_trait_decl_id(span, &trait_ref.def_id); - let parent_trait_refs = Vec::new(); - let generics = self.translate_substs_and_trait_refs( - span, - erase_regions, - None, - &trait_ref.generic_args, - &parent_trait_refs, - )?; - Ok(Some(TraitDeclRef { trait_id, generics })) + bound_trait_ref: &hax::Binder, + ) -> Result, Error> { + let binder = bound_trait_ref.rebind(()); + self.with_locally_bound_regions_group(span, binder, move |ctx| { + let trait_ref = bound_trait_ref.hax_skip_binder_ref(); + let trait_id = ctx.register_trait_decl_id(span, &trait_ref.def_id); + let parent_trait_refs = Vec::new(); + let generics = ctx.translate_substs_and_trait_refs( + span, + erase_regions, + None, + &trait_ref.generic_args, + &parent_trait_refs, + )?; + + Ok(Some(RegionBinder { + regions: ctx.region_vars[0].clone(), + skip_binder: TraitDeclRef { trait_id, generics }, + })) + }) } /// Returns an [Option] because we may filter clauses about builtin or @@ -175,6 +181,11 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { let span = self.translate_span_from_hax(hspan.clone()); let trait_decl_ref = self.translate_trait_predicate(hspan, trait_pred)?; + let poly_trait_ref = RegionBinder { + // We're under the binder of `hax::Predicate`, we re-wrap it here. + regions: self.region_vars[0].clone(), + skip_binder: trait_decl_ref, + }; let vec = match location { PredicateLocation::Base => &mut self.generic_params.trait_clauses, PredicateLocation::Parent(..) => &mut self.parent_trait_clauses, @@ -187,7 +198,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { clause_id, origin, span: Some(span), - trait_: trait_decl_ref, + trait_: poly_trait_ref, }); let trait_ref_kind = match location { @@ -273,80 +284,90 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { let erase_regions = false; let span = hspan.rust_span_data.unwrap().span(); - // Skip the binder (which lists the quantified variables). - // By doing so, we allow the predicates to contain DeBruijn indices, - // but it is ok because we only do a simple check. - let pred_kind = &pred.kind.value; - use hax::{ClauseKind, PredicateKind}; - - match pred_kind { - PredicateKind::Clause(kind) => { - match kind { - ClauseKind::Trait(trait_pred) => { - self.register_trait_clause(hspan, trait_pred, origin, location)?; - } - ClauseKind::RegionOutlives(p) => { - let r0 = self.translate_region(span, erase_regions, &p.lhs)?; - let r1 = self.translate_region(span, erase_regions, &p.rhs)?; - self.generic_params - .regions_outlive - .push(OutlivesPred(r0, r1)); - } - ClauseKind::TypeOutlives(p) => { - let ty = self.translate_ty(span, erase_regions, &p.lhs)?; - let r = self.translate_region(span, erase_regions, &p.rhs)?; - self.generic_params.types_outlive.push(OutlivesPred(ty, r)); - } - ClauseKind::Projection(p) => { - // This is used to express constraints over associated types. - // For instance: - // ``` - // T : Foo - // ^^^^^^^^^^ - // ``` - let hax::ProjectionPredicate { - impl_expr, - assoc_item, - ty, - } = p; - - let trait_ref = - self.translate_trait_impl_expr(span, erase_regions, impl_expr)?; - // The trait ref should be Some(...): the marker traits (that - // we may filter) don't have associated types. - let trait_ref = trait_ref.unwrap(); - let ty = self.translate_ty(span, erase_regions, ty).unwrap(); - let type_name = TraitItemName(assoc_item.name.clone().into()); - self.generic_params - .trait_type_constraints - .push(TraitTypeConstraint { - trait_ref, - type_name, - ty, + let binder = pred.kind.rebind(()); + self.with_locally_bound_regions_group(span, binder, move |ctx| { + let pred_kind = pred.kind.hax_skip_binder_ref(); + use hax::{ClauseKind, PredicateKind}; + match pred_kind { + PredicateKind::Clause(kind) => { + // We're under the binder of `hax::Predicate`, we re-wrap that binder here + // except in the clause case where this is done already. + let regions = ctx.region_vars[0].clone(); + match kind { + ClauseKind::Trait(trait_pred) => { + ctx.register_trait_clause(hspan, trait_pred, origin, location)?; + } + ClauseKind::RegionOutlives(p) => { + // TODO: we're under a binder, we should re-bind + let r0 = ctx.translate_region(span, erase_regions, &p.lhs)?; + let r1 = ctx.translate_region(span, erase_regions, &p.rhs)?; + ctx.generic_params.regions_outlive.push(RegionBinder { + regions, + skip_binder: OutlivesPred(r0, r1), }); - } - ClauseKind::ConstArgHasType(..) => { - // I don't really understand that one. Why don't they put - // the type information in the const generic parameters - // directly? For now we just ignore it. - } - ClauseKind::WellFormed(_) | ClauseKind::ConstEvaluatable(_) => { - error_or_panic!(self, span, format!("Unsupported clause: {:?}", kind)) + } + ClauseKind::TypeOutlives(p) => { + let ty = ctx.translate_ty(span, erase_regions, &p.lhs)?; + let r = ctx.translate_region(span, erase_regions, &p.rhs)?; + ctx.generic_params.types_outlive.push(RegionBinder { + regions, + skip_binder: OutlivesPred(ty, r), + }); + } + ClauseKind::Projection(p) => { + // TODO: we're under a binder, we should re-bind + // This is used to express constraints over associated types. + // For instance: + // ``` + // T : Foo + // ^^^^^^^^^^ + // ``` + let hax::ProjectionPredicate { + impl_expr, + assoc_item, + ty, + } = p; + + let trait_ref = + ctx.translate_trait_impl_expr(span, erase_regions, impl_expr)?; + // The trait ref should be Some(...): the marker traits (that + // we may filter) don't have associated types. + let trait_ref = trait_ref.unwrap(); + let ty = ctx.translate_ty(span, erase_regions, ty).unwrap(); + let type_name = TraitItemName(assoc_item.name.clone().into()); + ctx.generic_params + .trait_type_constraints + .push(RegionBinder { + regions, + skip_binder: TraitTypeConstraint { + trait_ref, + type_name, + ty, + }, + }); + } + ClauseKind::ConstArgHasType(..) => { + // I don't really understand that one. Why don't they put + // the type information in the const generic parameters + // directly? For now we just ignore it. + } + ClauseKind::WellFormed(_) | ClauseKind::ConstEvaluatable(_) => { + error_or_panic!(ctx, span, format!("Unsupported clause: {:?}", kind)) + } } } + PredicateKind::AliasRelate(..) + | PredicateKind::Ambiguous + | PredicateKind::Coerce(_) + | PredicateKind::ConstEquate(_, _) + | PredicateKind::ObjectSafe(_) + | PredicateKind::NormalizesTo(_) + | PredicateKind::Subtype(_) => { + error_or_panic!(ctx, span, format!("Unsupported predicate: {:?}", pred_kind)) + } } - PredicateKind::AliasRelate(..) - | PredicateKind::Ambiguous - | PredicateKind::Coerce(_) - | PredicateKind::ConstEquate(_, _) - | PredicateKind::ObjectSafe(_) - | PredicateKind::NormalizesTo(_) - | PredicateKind::Subtype(_) => error_or_panic!( - self, - span, - format!("Unsupported predicate: {:?}", pred_kind) - ), - } + Ok(()) + })?; Ok(()) } @@ -405,7 +426,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { span: rustc_span::Span, erase_regions: bool, impl_source: &hax::ImplExpr, - trait_decl_ref: TraitDeclRef, + trait_decl_ref: PolyTraitDeclRef, ) -> Result, Error> { // TODO: in the body of this function: trace!("impl_source: {:?}", impl_source); @@ -447,7 +468,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { path, ); assert!(trait_ref.bound_vars.is_empty()); - let trait_ref = &trait_ref.value; + let trait_ref = trait_ref.hax_skip_binder_ref(); // If we are refering to a trait clause, we need to find the // relevant one. @@ -476,8 +497,10 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { TraitItemName(item.name.clone()), TraitClauseId::new(*index), ); - current_trait_decl_id = self - .register_trait_decl_id(span, &predicate.value.trait_ref.def_id); + current_trait_decl_id = self.register_trait_decl_id( + span, + &predicate.hax_skip_binder_ref().trait_ref.def_id, + ); } Parent { predicate, @@ -489,8 +512,10 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { current_trait_decl_id, TraitClauseId::new(*index), ); - current_trait_decl_id = self - .register_trait_decl_id(span, &predicate.value.trait_ref.def_id); + current_trait_decl_id = self.register_trait_decl_id( + span, + &predicate.hax_skip_binder_ref().trait_ref.def_id, + ); } } } diff --git a/charon/src/bin/charon-driver/translate/translate_types.rs b/charon/src/bin/charon-driver/translate/translate_types.rs index 7bc0decd..ef6b0999 100644 --- a/charon/src/bin/charon-driver/translate/translate_types.rs +++ b/charon/src/bin/charon-driver/translate/translate_types.rs @@ -77,7 +77,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { .get(*id) .expect("Error: missing binder when translating lifetime") .get(br.var) - .unwrap(); + .expect("Error: lifetime not found, binders were handled incorrectly"); let br_id = DeBruijnId::new(*id); Ok(Region::BVar(br_id, *rid)) } @@ -326,7 +326,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { trace!("bound vars: {:?}", sig.bound_vars); let erase_regions = false; - let binder = sig.as_ref().map(|_| ()); + let binder = sig.rebind(()); self.with_locally_bound_regions_group(span, binder, move |ctx| { let regions = ctx.region_vars[0].clone(); let inputs = sig diff --git a/charon/src/pretty/fmt_with_ctx.rs b/charon/src/pretty/fmt_with_ctx.rs index 65d55cdd..dfb893f2 100644 --- a/charon/src/pretty/fmt_with_ctx.rs +++ b/charon/src/pretty/fmt_with_ctx.rs @@ -415,18 +415,12 @@ impl GenericParams { C: AstFormatter, { let trait_clauses = self.trait_clauses.iter().map(|x| x.fmt_with_ctx(ctx)); - let types_outlive = self - .types_outlive - .iter() - .map(|OutlivesPred(x, y)| format!("{} : {}", x.fmt_with_ctx(ctx), y.fmt_with_ctx(ctx))); - let regions_outlive = self - .regions_outlive - .iter() - .map(|OutlivesPred(x, y)| format!("{} : {}", x.fmt_with_ctx(ctx), y.fmt_with_ctx(ctx))); + let types_outlive = self.types_outlive.iter().map(|pred| pred.fmt_as_for(ctx)); + let regions_outlive = self.regions_outlive.iter().map(|pred| pred.fmt_as_for(ctx)); let type_constraints = self .trait_type_constraints .iter() - .map(|x| x.fmt_with_ctx(ctx)); + .map(|pred| pred.fmt_as_for(ctx)); trait_clauses .chain(types_outlive) .chain(regions_outlive) @@ -720,6 +714,20 @@ impl FmtWithCtx for Operand { } } +impl FmtWithCtx for OutlivesPred +where + T: FmtWithCtx, + U: FmtWithCtx, +{ + fn fmt_with_ctx(&self, ctx: &C) -> String { + format!( + "{} : {}", + self.0.fmt_with_ctx(ctx), + self.1.fmt_with_ctx(ctx) + ) + } +} + impl FmtWithCtx for PathElem { fn fmt_with_ctx(&self, ctx: &C) -> String { match self { @@ -810,6 +818,12 @@ impl FmtWithCtx for Place { } } +impl FmtWithCtx for PolyTraitDeclRef { + fn fmt_with_ctx(&self, ctx: &C) -> String { + self.fmt_as_for(ctx) + } +} + impl FmtWithCtx for RawConstantExpr { fn fmt_with_ctx(&self, ctx: &C) -> String { match self { @@ -854,6 +868,36 @@ impl FmtWithCtx for Region { } } +impl RegionBinder { + /// Format the parameters and contents of this binder and returns the resulting strings. + fn fmt_split<'a, C>(&'a self, ctx: &'a C) -> (String, String) + where + C: AstFormatter, + T: FmtWithCtx<>::C>, + { + let ctx = &ctx.push_bound_regions(&self.regions); + ( + self.regions.iter().map(|r| ctx.format_object(r)).join(", "), + self.skip_binder.fmt_with_ctx(ctx), + ) + } + + /// Formats the binder as `for value`. + fn fmt_as_for<'a, C>(&'a self, ctx: &'a C) -> String + where + C: AstFormatter, + T: FmtWithCtx<>::C>, + { + let (regions, value) = self.fmt_split(ctx); + let regions = if regions.is_empty() { + "".to_string() + } else { + format!("for<{regions}> ",) + }; + format!("{regions}{value}",) + } +} + impl FmtWithCtx for Rvalue { fn fmt_with_ctx(&self, ctx: &C) -> String { match self { diff --git a/charon/src/transform/hide_marker_traits.rs b/charon/src/transform/hide_marker_traits.rs index e217cc37..83a822f7 100644 --- a/charon/src/transform/hide_marker_traits.rs +++ b/charon/src/transform/hide_marker_traits.rs @@ -26,7 +26,7 @@ impl Visitor { let trait_clauses = &mut args.trait_clauses; for i in 0..trait_clauses.len() { let clause = &trait_clauses[i]; - if self.exclude.contains(&clause.trait_.trait_id) { + if self.exclude.contains(&clause.trait_.skip_binder.trait_id) { trait_clauses.remove(<_ as Idx>::from_usize(i)); } } @@ -35,7 +35,10 @@ impl Visitor { let trait_refs = &mut args.trait_refs; for i in 0..trait_refs.len() { let tref = &trait_refs[i]; - if self.exclude.contains(&tref.trait_decl_ref.trait_id) { + if self + .exclude + .contains(&tref.trait_decl_ref.skip_binder.trait_id) + { trait_refs.remove(<_ as Idx>::from_usize(i)); } } @@ -44,7 +47,7 @@ impl Visitor { let trait_clauses = &mut tdecl.parent_clauses; for i in 0..trait_clauses.len() { let clause = &trait_clauses[i]; - if self.exclude.contains(&clause.trait_.trait_id) { + if self.exclude.contains(&clause.trait_.skip_binder.trait_id) { trait_clauses.remove(<_ as Idx>::from_usize(i)); } } @@ -53,7 +56,10 @@ impl Visitor { let trait_refs = &mut timpl.parent_trait_refs; for i in 0..trait_refs.len() { let tref = &trait_refs[i]; - if self.exclude.contains(&tref.trait_decl_ref.trait_id) { + if self + .exclude + .contains(&tref.trait_decl_ref.skip_binder.trait_id) + { trait_refs.remove(<_ as Idx>::from_usize(i)); } } diff --git a/charon/tests/crate_data.rs b/charon/tests/crate_data.rs index e52d8c72..0292927e 100644 --- a/charon/tests/crate_data.rs +++ b/charon/tests/crate_data.rs @@ -262,7 +262,7 @@ fn predicate_origins() -> anyhow::Result<()> { let clauses = &item.generics.trait_clauses; assert_eq!(origins.len(), clauses.len(), "failed for {item_name}"); for (clause, (expected_origin, expected_trait_name)) in clauses.iter().zip(origins) { - let trait_name = trait_name(&crate_data, clause.trait_.trait_id); + let trait_name = trait_name(&crate_data, clause.trait_.skip_binder.trait_id); assert_eq!(trait_name, expected_trait_name, "failed for {item_name}"); assert_eq!(&clause.origin, &expected_origin, "failed for {item_name}"); } diff --git a/charon/tests/ui/generic-associated-types.out b/charon/tests/ui/generic-associated-types.out index cbc0fe83..833da9e7 100644 --- a/charon/tests/ui/generic-associated-types.out +++ b/charon/tests/ui/generic-associated-types.out @@ -31,20 +31,6 @@ error: Ignoring the following item due to an error: test_crate::LendingIterator: 7 | fn next<'a>(&'a mut self) -> Option>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: -Error: missing binder when translating lifetime -error: Thread panicked when extracting item `test_crate::{impl#0}::next`. - --> tests/ui/generic-associated-types.rs:13:5 - | -13 | fn next<'b>(&'b mut self) -> Option> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: Ignoring the following item due to an error: test_crate::{impl#0}::next - --> tests/ui/generic-associated-types.rs:13:5 - | -13 | fn next<'b>(&'b mut self) -> Option> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - thread 'rustc' panicked at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/compiler/rustc_type_ir/src/binder.rs:783:9: const parameter `'a/#1` ('a/#1/1) out of range when instantiating args=[I/#0] error: Thread panicked when extracting item `test_crate::for_each`. @@ -67,6 +53,6 @@ warning: unused variable: `x` | = note: `#[warn(unused_variables)]` on by default -error: aborting due to 8 previous errors; 1 warning emitted +error: aborting due to 6 previous errors; 1 warning emitted Error: Charon driver exited with code 101 diff --git a/charon/tests/ui/issue-372-type-param-out-of-range.out b/charon/tests/ui/issue-372-type-param-out-of-range.out index 1f4756e4..065e7fcd 100644 --- a/charon/tests/ui/issue-372-type-param-out-of-range.out +++ b/charon/tests/ui/issue-372-type-param-out-of-range.out @@ -1,5 +1,5 @@ -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: -Error: missing binder when translating lifetime +thread 'rustc' panicked at src/bin/charon-driver/translate/translate_predicates.rs:470:17: +assertion failed: trait_ref.bound_vars.is_empty() note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: Thread panicked when extracting item `test_crate::{impl#0}::f`. --> tests/ui/issue-372-type-param-out-of-range.rs:8:5 @@ -17,8 +17,8 @@ error: Ignoring the following item due to an error: test_crate::{impl#0}::f 10 | | F: FnMut(&u32), | |_______________________^ -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: -Error: missing binder when translating lifetime +thread 'rustc' panicked at src/bin/charon-driver/translate/translate_predicates.rs:470:17: +assertion failed: trait_ref.bound_vars.is_empty() error: Thread panicked when extracting item `test_crate::{impl#0}::g`. --> tests/ui/issue-372-type-param-out-of-range.rs:14:5 | @@ -35,8 +35,8 @@ error: Ignoring the following item due to an error: test_crate::{impl#0}::g 16 | | for<'b> F: FnMut(&'b u32), | |__________________________________^ -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: -Error: missing binder when translating lifetime +thread 'rustc' panicked at src/bin/charon-driver/translate/translate_predicates.rs:470:17: +assertion failed: trait_ref.bound_vars.is_empty() error: Thread panicked when extracting item `test_crate::{impl#1}::f`. --> tests/ui/issue-372-type-param-out-of-range.rs:24:5 | diff --git a/charon/tests/ui/quantified-clause.out b/charon/tests/ui/quantified-clause.out index 0a83a12b..d6cc8471 100644 --- a/charon/tests/ui/quantified-clause.out +++ b/charon/tests/ui/quantified-clause.out @@ -1,5 +1,5 @@ -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: -Error: missing binder when translating lifetime +thread 'rustc' panicked at src/bin/charon-driver/translate/translate_predicates.rs:470:17: +assertion failed: trait_ref.bound_vars.is_empty() note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: Thread panicked when extracting item `test_crate::foo`. --> tests/ui/quantified-clause.rs:3:1 @@ -17,24 +17,6 @@ error: Ignoring the following item due to an error: test_crate::foo 5 | | F: for<'a> FnMut(&'a ()), | |_____________________________^ -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_types.rs:78:26: -Error: missing binder when translating lifetime -error: Thread panicked when extracting item `test_crate::bar`. - --> tests/ui/quantified-clause.rs:9:1 - | -9 | / fn bar<'b, T>() -10 | | where -11 | | for<'a> &'b T: 'a, - | |______________________^ - -error: Ignoring the following item due to an error: test_crate::bar - --> tests/ui/quantified-clause.rs:9:1 - | -9 | / fn bar<'b, T>() -10 | | where -11 | | for<'a> &'b T: 'a, - | |______________________^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors Error: Charon driver exited with code 101 From a3ff0d049aa7bed445e16160d52547010ffc9ec1 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 23 Sep 2024 13:44:31 +0200 Subject: [PATCH 6/8] Resolve traits using hax --- charon/src/ast/types.rs | 7 - .../charon-driver/translate/translate_ctx.rs | 64 -- .../translate/translate_predicates.rs | 145 +-- .../translate/translate_traits.rs | 20 +- .../translate/translate_types.rs | 6 +- charon/src/pretty/fmt_with_ctx.rs | 1 - charon/src/transform/check_generics.rs | 1 - .../ui/issue-372-type-param-out-of-range.out | 130 +-- .../ui/issue-372-type-param-out-of-range.rs | 2 - charon/tests/ui/issue-45-misc.out | 6 +- charon/tests/ui/loops.out | 6 +- charon/tests/ui/quantified-clause.out | 71 +- charon/tests/ui/quantified-clause.rs | 2 - charon/tests/ui/trait-instance-id.out | 38 +- .../ui/unsupported/issue-79-bound-regions.out | 830 ++++++++++++++++++ .../ui/unsupported/issue-79-bound-regions.rs | 2 - 16 files changed, 996 insertions(+), 335 deletions(-) create mode 100644 charon/tests/ui/unsupported/issue-79-bound-regions.out diff --git a/charon/src/ast/types.rs b/charon/src/ast/types.rs index 96e006e4..e5b11b65 100644 --- a/charon/src/ast/types.rs +++ b/charon/src/ast/types.rs @@ -19,7 +19,6 @@ generate_index_type!(FieldId, "Field"); generate_index_type!(RegionId, "Region"); generate_index_type!(ConstGenericVarId, "Const"); generate_index_type!(GlobalDeclId, "Global"); -generate_index_type!(UnsolvedTraitId, "UnsolvedTrait"); /// Type variable. /// We make sure not to mix variables and type variables by having two distinct @@ -221,12 +220,6 @@ pub enum TraitRefKind { /// The automatically-generated implementation for `dyn Trait`. Dyn(PolyTraitDeclRef), - /// The trait ref could not be resolved, likely because the corresponding clause had not been - /// registered yet. We will try resolving it again once all clauses are registered. - #[charon::opaque] - #[drive(skip)] - Unsolved(UnsolvedTraitId), - /// For error reporting. #[charon::rename("UnknownTrait")] Unknown(String), diff --git a/charon/src/bin/charon-driver/translate/translate_ctx.rs b/charon/src/bin/charon-driver/translate/translate_ctx.rs index cc50c9d2..de064ac3 100644 --- a/charon/src/bin/charon-driver/translate/translate_ctx.rs +++ b/charon/src/bin/charon-driver/translate/translate_ctx.rs @@ -1,5 +1,4 @@ //! The translation contexts. -use super::translate_predicates::NonLocalTraitClause; use super::translate_types::translate_bound_region_kind_name; use charon_lib::ast::*; use charon_lib::common::*; @@ -7,10 +6,7 @@ use charon_lib::formatter::{FmtCtx, IntoFormatter}; use charon_lib::ids::{MapGenerator, Vector}; use charon_lib::name_matcher::NamePattern; use charon_lib::options::CliOpts; -use charon_lib::pretty::FmtWithCtx; use charon_lib::ullbc_ast as ast; -use derive_visitor::visitor_enter_fn_mut; -use derive_visitor::DriveMut; use hax_frontend_exporter as hax; use hax_frontend_exporter::SInto; use itertools::Itertools; @@ -280,20 +276,10 @@ pub(crate) struct BodyTransCtx<'tcx, 'ctx, 'ctx1> { /// The map from rust const generic variables to translate const generic /// variable indices. pub const_generic_vars_map: HashMap, - /// Trait refs we couldn't solve at the moment of translating them and will solve in a second - /// pass before extracting the generic params. - pub unsolved_traits: Vector, /// (For traits only) accumulated implied trait clauses. pub parent_trait_clauses: Vector, /// (For traits only) accumulated trait clauses on associated types. pub item_trait_clauses: HashMap>, - /// All the trait clauses accessible from the current environment. When `hax` gives us a - /// `ImplExprAtom::LocalBound`, we use this to recover the specific trait reference it - /// corresponds to. - /// FIXME: hax should take care of this matching up. - /// We use a betreemap to get a consistent output order and `OrdRustId` to get an orderable - /// `DefId` but they're all `OrdRustId::TraitDecl`. - pub trait_clauses_map: BTreeMap>, /// The "regular" variables pub vars: Vector, @@ -924,10 +910,8 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { generic_params: Default::default(), type_vars_map: Default::default(), const_generic_vars_map: Default::default(), - unsolved_traits: Default::default(), parent_trait_clauses: Default::default(), item_trait_clauses: Default::default(), - trait_clauses_map: Default::default(), vars: Default::default(), vars_map: Default::default(), blocks: Default::default(), @@ -1146,54 +1130,6 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { .iter() .enumerate() .all(|(i, c)| c.clause_id.index() == i)); - - // Solve trait refs now that all clauses have been registered. - generic_params.drive_mut(&mut visitor_enter_fn_mut(|tref_kind: &mut TraitRefKind| { - if let TraitRefKind::Unsolved(unsolved_trait_id) = *tref_kind { - let hax_trait_ref = self.unsolved_traits.remove(unsolved_trait_id).unwrap(); - let new_kind = self.find_trait_clause_for_param(&hax_trait_ref); - *tref_kind = if let TraitRefKind::Unsolved(_) = new_kind { - // Could not find a clause. - // Check if we are in the registration process, otherwise report an error. - let fmt_ctx = self.into_fmt(); - let trait_ref = format!("{:?}", hax_trait_ref); - let clauses: Vec = self - .trait_clauses_map - .values() - .flat_map(|x| x) - .map(|x| x.fmt_with_ctx(&fmt_ctx)) - .collect(); - - if !self.t_ctx.continue_on_failure() { - let clauses = clauses.join("\n"); - unreachable!( - "Could not find a clause for parameter:\n- target param: {}\n\ - - available clauses:\n{}\n- context: {:?}", - trait_ref, clauses, self.def_id - ); - } else { - // Return the UNKNOWN clause - tracing::warn!( - "Could not find a clause for parameter:\n- target param: {}\n\ - - available clauses:\n{}\n- context: {:?}", - trait_ref, - clauses.join("\n"), - self.def_id - ); - TraitRefKind::Unknown(format!( - "Could not find a clause for parameter: {} \ - (available clauses: {}) (context: {:?})", - trait_ref, - clauses.join("; "), - self.def_id - )) - } - } else { - new_kind - } - } - })); - trace!("Translated generics: {generic_params:?}"); generic_params } diff --git a/charon/src/bin/charon-driver/translate/translate_predicates.rs b/charon/src/bin/charon-driver/translate/translate_predicates.rs index 463f393f..110f1357 100644 --- a/charon/src/bin/charon-driver/translate/translate_predicates.rs +++ b/charon/src/bin/charon-driver/translate/translate_predicates.rs @@ -1,68 +1,10 @@ use super::translate_ctx::*; use super::translate_traits::PredicateLocation; use charon_lib::common::*; -use charon_lib::formatter::AstFormatter; use charon_lib::gast::*; use charon_lib::ids::Vector; -use charon_lib::pretty::FmtWithCtx; use charon_lib::types::*; use hax_frontend_exporter as hax; -use rustc_span::def_id::DefId; - -/// Same as [TraitClause], but where the clause id is a [TraitInstanceId]. -/// We need this information to solve the provenance of traits coming from -/// where clauses: when translating the where clauses and adding them to the -/// context, we recursively explore their parent/item clauses. -/// -/// We have to do this because of this kind of situations -///```text -/// trait Foo { -/// type W: Bar // Bar contains a method bar -/// } -/// -/// fn f(x : T::W) { -/// x.bar(); // We need to refer to the trait clause declared for Foo::W -/// // and this clause is not immediately accessible. -/// } -/// -/// trait FooChild : Foo {} -/// -/// fn g(x: ::W) { ... } -/// ^^^^^^^^^^^^^ -/// // We need to have access to a clause `FooChild : Foo` to solve this -/// ``` -#[derive(Debug, Clone)] -pub(crate) struct NonLocalTraitClause { - pub hax_trait_ref: hax::TraitRef, - pub trait_ref_kind: TraitRefKind, -} - -impl NonLocalTraitClause { - fn matches(&self, hax_trait_ref: &hax::TraitRef) -> bool { - // We ignore regions. - let skip_lifetimes = |arg: &&hax::GenericArg| match arg { - hax::GenericArg::Lifetime(_) => false, - _ => true, - }; - hax_trait_ref - .generic_args - .iter() - .filter(skip_lifetimes) - .eq(self - .hax_trait_ref - .generic_args - .iter() - .filter(skip_lifetimes)) - } -} - -impl FmtWithCtx for NonLocalTraitClause { - fn fmt_with_ctx(&self, ctx: &C) -> String { - let clause_id = self.trait_ref_kind.fmt_with_ctx(ctx); - let generics_ = &self.hax_trait_ref; - format!("[{clause_id}]: {generics_:?}") - } -} impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { pub fn count_generics( @@ -188,8 +130,8 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { }; let vec = match location { PredicateLocation::Base => &mut self.generic_params.trait_clauses, - PredicateLocation::Parent(..) => &mut self.parent_trait_clauses, - PredicateLocation::Item(.., item_name) => self + PredicateLocation::Parent => &mut self.parent_trait_clauses, + PredicateLocation::Item(item_name) => self .item_trait_clauses .entry(item_name.clone()) .or_default(), @@ -201,53 +143,9 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { trait_: poly_trait_ref, }); - let trait_ref_kind = match location { - PredicateLocation::Base => TraitRefKind::Clause(clause_id), - PredicateLocation::Parent(trait_decl_id) => TraitRefKind::ParentClause( - Box::new(TraitRefKind::SelfId), - *trait_decl_id, - clause_id, - ), - PredicateLocation::Item(trait_decl_id, item_name) => TraitRefKind::ItemClause( - Box::new(TraitRefKind::SelfId), - *trait_decl_id, - item_name.clone(), - clause_id, - ), - }; - let def_id = DefId::from(&trait_pred.trait_ref.def_id); - self.trait_clauses_map - .entry(OrdRustId::TraitDecl(def_id)) - .or_default() - .push(NonLocalTraitClause { - hax_trait_ref: trait_pred.trait_ref.clone(), - trait_ref_kind, - }); - Ok(Some(clause_id)) } - /// Returns an [Option] because we may filter clauses about builtin or - /// auto traits like [core::marker::Sized] and [core::marker::Sync]. - pub(crate) fn translate_self_trait_clause( - &mut self, - span: &hax::Span, - trait_pred: &hax::TraitPredicate, - ) -> Result<(), Error> { - // Save the self clause (and its parent/item clauses) - let _ = self.translate_trait_predicate(span, &trait_pred)?; - let clause = NonLocalTraitClause { - hax_trait_ref: trait_pred.trait_ref.clone(), - trait_ref_kind: TraitRefKind::SelfId, - }; - let def_id = DefId::from(&trait_pred.trait_ref.def_id); - self.trait_clauses_map - .entry(OrdRustId::TraitDecl(def_id)) - .or_default() - .push(clause); - Ok(()) - } - pub(crate) fn translate_trait_predicate( &mut self, hspan: &hax::Span, @@ -467,19 +365,18 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { trait_ref, path, ); - assert!(trait_ref.bound_vars.is_empty()); - let trait_ref = trait_ref.hax_skip_binder_ref(); - // If we are refering to a trait clause, we need to find the // relevant one. let mut trait_id = match &impl_source.r#impl { ImplExprAtom::SelfImpl { .. } => TraitRefKind::SelfId, - ImplExprAtom::LocalBound { .. } => self.find_trait_clause_for_param(trait_ref), + ImplExprAtom::LocalBound { index, .. } => { + TraitRefKind::Clause(TraitClauseId::from_usize(*index)) + } _ => unreachable!(), }; let mut current_trait_decl_id = - self.register_trait_decl_id(span, &trait_ref.def_id); + self.register_trait_decl_id(span, &trait_ref.hax_skip_binder_ref().def_id); // Apply the path for path_elem in path { @@ -550,34 +447,4 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { }; Ok(Some(trait_ref)) } - - /// Find the trait instance fullfilling a trait obligation. - /// TODO: having to do this is very annoying. Isn't there a better way? - #[tracing::instrument(skip(self))] - pub(crate) fn find_trait_clause_for_param( - &mut self, - hax_trait_ref: &hax::TraitRef, - ) -> TraitRefKind { - trace!( - "Inside context of: {:?}\nSpan: {:?}", - self.def_id, - self.t_ctx.tcx.def_ident_span(self.def_id) - ); - - // Simply explore the trait clauses - let def_id = DefId::from(&hax_trait_ref.def_id); - if let Some(clauses_for_this_trait) = - self.trait_clauses_map.get(&OrdRustId::TraitDecl(def_id)) - { - for trait_clause in clauses_for_this_trait { - if trait_clause.matches(hax_trait_ref) { - return trait_clause.trait_ref_kind.clone(); - } - } - }; - - // Try solving it again later, when more clauses are registered. - let id = self.unsolved_traits.push(hax_trait_ref.clone()); - TraitRefKind::Unsolved(id) - } } diff --git a/charon/src/bin/charon-driver/translate/translate_traits.rs b/charon/src/bin/charon-driver/translate/translate_traits.rs index 2575eeec..941ce0a3 100644 --- a/charon/src/bin/charon-driver/translate/translate_traits.rs +++ b/charon/src/bin/charon-driver/translate/translate_traits.rs @@ -17,10 +17,10 @@ use std::sync::Arc; /// The context in which we are translating a clause, used to generate the appropriate ids and /// trait references. pub(crate) enum PredicateLocation { - /// We're translating the parent clauses of a trait. - Parent(TraitDeclId), - /// We're translating the item clauses of a trait. - Item(TraitDeclId, TraitItemName), + /// We're translating the parent clauses of this trait. + Parent, + /// We're translating the item clauses of this trait. + Item(TraitItemName), /// We're translating anything else. Base, } @@ -141,7 +141,7 @@ impl<'tcx, 'ctx> TranslateCtx<'tcx, 'ctx> { bt_ctx.register_predicates( &predicates, PredicateOrigin::TraitItem(name.clone()), - &PredicateLocation::Item(def_id, name.clone()), + &PredicateLocation::Item(name.clone()), )?; if let Some(clauses) = bt_ctx.item_trait_clauses.get(name) { type_clauses.push((name.clone(), clauses.clone())); @@ -225,13 +225,6 @@ impl<'tcx, 'ctx> TranslateCtx<'tcx, 'ctx> { // Debugging: { let ctx = bt_ctx.into_fmt(); - let clauses = bt_ctx - .trait_clauses_map - .values() - .flat_map(|x| x) - .map(|c| c.fmt_with_ctx(&ctx)) - .collect::>() - .join("\n"); let generic_clauses = generics .trait_clauses .iter() @@ -239,9 +232,8 @@ impl<'tcx, 'ctx> TranslateCtx<'tcx, 'ctx> { .collect::>() .join("\n"); trace!( - "Trait decl: {:?}:\n- all clauses:\n{}\n- generic.trait_clauses:\n{}\n", + "Trait decl: {:?}:\n- generic.trait_clauses:\n{}\n", def_id, - clauses, generic_clauses ); } diff --git a/charon/src/bin/charon-driver/translate/translate_types.rs b/charon/src/bin/charon-driver/translate/translate_types.rs index ef6b0999..1ef644e7 100644 --- a/charon/src/bin/charon-driver/translate/translate_types.rs +++ b/charon/src/bin/charon-driver/translate/translate_types.rs @@ -646,7 +646,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { | FullDefKind::Trait { self_predicate, .. } => { self.register_trait_decl_id(span, &self_predicate.trait_ref.def_id); let hax_span = span.sinto(&self.t_ctx.hax_state); - self.translate_self_trait_clause(&hax_span, &self_predicate)?; + let _ = self.translate_trait_predicate(&hax_span, self_predicate)?; } _ => {} } @@ -672,10 +672,10 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { // TODO: distinguish trait where clauses from trait supertraits. Currently we // consider them all as parent clauses. FullDefKind::Trait { .. } => { - let trait_id = self.register_trait_decl_id(span, &def.def_id); + let _ = self.register_trait_decl_id(span, &def.def_id); ( PredicateOrigin::WhereClauseOnTrait, - PredicateLocation::Parent(trait_id), + PredicateLocation::Parent, ) } _ => panic!("Unexpected def: {def:?}"), diff --git a/charon/src/pretty/fmt_with_ctx.rs b/charon/src/pretty/fmt_with_ctx.rs index dfb893f2..46623ab8 100644 --- a/charon/src/pretty/fmt_with_ctx.rs +++ b/charon/src/pretty/fmt_with_ctx.rs @@ -1353,7 +1353,6 @@ impl FmtWithCtx for TraitRefKind { } TraitRefKind::Clause(id) => ctx.format_object(*id), TraitRefKind::BuiltinOrAuto(tr) | TraitRefKind::Dyn(tr) => tr.fmt_with_ctx(ctx), - TraitRefKind::Unsolved(tref) => format!("Unsolved({tref:?})"), TraitRefKind::Unknown(msg) => format!("UNKNOWN({msg})"), } } diff --git a/charon/src/transform/check_generics.rs b/charon/src/transform/check_generics.rs index a0b51829..9c9f8e55 100644 --- a/charon/src/transform/check_generics.rs +++ b/charon/src/transform/check_generics.rs @@ -111,7 +111,6 @@ impl CheckGenericsVisitor<'_, '_> { | TraitRefKind::ParentClause(..) | TraitRefKind::ItemClause(..) | TraitRefKind::SelfId - | TraitRefKind::Unsolved(_) | TraitRefKind::Unknown(_) => {} } } diff --git a/charon/tests/ui/issue-372-type-param-out-of-range.out b/charon/tests/ui/issue-372-type-param-out-of-range.out index 065e7fcd..e2f171a6 100644 --- a/charon/tests/ui/issue-372-type-param-out-of-range.out +++ b/charon/tests/ui/issue-372-type-param-out-of-range.out @@ -1,58 +1,72 @@ -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_predicates.rs:470:17: -assertion failed: trait_ref.bound_vars.is_empty() -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -error: Thread panicked when extracting item `test_crate::{impl#0}::f`. - --> tests/ui/issue-372-type-param-out-of-range.rs:8:5 - | -8 | / pub fn f() -9 | | where -10 | | F: FnMut(&u32), - | |_______________________^ - -error: Ignoring the following item due to an error: test_crate::{impl#0}::f - --> tests/ui/issue-372-type-param-out-of-range.rs:8:5 - | -8 | / pub fn f() -9 | | where -10 | | F: FnMut(&u32), - | |_______________________^ - -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_predicates.rs:470:17: -assertion failed: trait_ref.bound_vars.is_empty() -error: Thread panicked when extracting item `test_crate::{impl#0}::g`. - --> tests/ui/issue-372-type-param-out-of-range.rs:14:5 - | -14 | / pub fn g() -15 | | where -16 | | for<'b> F: FnMut(&'b u32), - | |__________________________________^ - -error: Ignoring the following item due to an error: test_crate::{impl#0}::g - --> tests/ui/issue-372-type-param-out-of-range.rs:14:5 - | -14 | / pub fn g() -15 | | where -16 | | for<'b> F: FnMut(&'b u32), - | |__________________________________^ - -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_predicates.rs:470:17: -assertion failed: trait_ref.bound_vars.is_empty() -error: Thread panicked when extracting item `test_crate::{impl#1}::f`. - --> tests/ui/issue-372-type-param-out-of-range.rs:24:5 - | -24 | / pub fn f() -25 | | where -26 | | F: FnMut(&u32), - | |_______________________^ - -error: Ignoring the following item due to an error: test_crate::{impl#1}::f - --> tests/ui/issue-372-type-param-out-of-range.rs:24:5 - | -24 | / pub fn f() -25 | | where -26 | | F: FnMut(&u32), - | |_______________________^ - -error: aborting due to 6 previous errors - -Error: Charon driver exited with code 101 +# Final LLBC before serialization: + +struct test_crate::S<'a, K> + where + K : 'a, + = +{ + x: &'a (K), +} + +trait core::ops::function::FnOnce +{ + type Output + fn call_once : core::ops::function::FnOnce::call_once +} + +trait core::ops::function::FnMut +{ + parent_clause_0 : [@TraitClause0]: core::ops::function::FnOnce + fn call_mut : core::ops::function::FnMut::call_mut +} + +fn test_crate::{test_crate::S<'a, K>}::f<'a, K, F>() +where + [@TraitClause2]: for<'_1_0> core::ops::function::FnMut, + for<'_1_0> (parents(@TraitClause2)::[@TraitClause0])::Output = (), +{ + let @0: (); // return + let @1: (); // anonymous local + + @1 := () + @0 := move (@1) + @0 := () + return +} + +fn test_crate::{test_crate::S<'a, K>}::g<'a, K, F>() +where + [@TraitClause2]: for<'_1_0> core::ops::function::FnMut, + for<'b> (parents(@TraitClause2)::[@TraitClause0])::Output = (), +{ + let @0: (); // return + let @1: (); // anonymous local + + @1 := () + @0 := move (@1) + @0 := () + return +} + +struct test_crate::T = {} + +fn test_crate::{test_crate::T}#1::f() +where + [@TraitClause1]: for<'_1_0> core::ops::function::FnMut, + for<'_1_0> (parents(@TraitClause1)::[@TraitClause0])::Output = (), +{ + let @0: (); // return + let @1: (); // anonymous local + + @1 := () + @0 := move (@1) + @0 := () + return +} + +fn core::ops::function::FnMut::call_mut<'_0, Self, Args>(@1: &'_0 mut (Self), @2: Args) -> (parents(Self)::[@TraitClause0])::Output + +fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> Self::Output + + + diff --git a/charon/tests/ui/issue-372-type-param-out-of-range.rs b/charon/tests/ui/issue-372-type-param-out-of-range.rs index ef3ea88e..6deb142a 100644 --- a/charon/tests/ui/issue-372-type-param-out-of-range.rs +++ b/charon/tests/ui/issue-372-type-param-out-of-range.rs @@ -1,5 +1,3 @@ -//@ known-failure - pub struct S<'a, K> { x: &'a K, } diff --git a/charon/tests/ui/issue-45-misc.out b/charon/tests/ui/issue-45-misc.out index d3a2c463..8b81329b 100644 --- a/charon/tests/ui/issue-45-misc.out +++ b/charon/tests/ui/issue-45-misc.out @@ -913,21 +913,21 @@ where [@TraitClause6]: core::default::Default, [@TraitClause7]: core::iter::traits::collect::Extend, [@TraitClause9]: core::iter::traits::iterator::Iterator, - Self::Item = (A, B), + @TraitClause9::Item = (A, B), fn core::iter::traits::iterator::Iterator::copied<'a, Self, T>(@1: Self) -> core::iter::adapters::copied::Copied where [@TraitClause2]: core::iter::traits::iterator::Iterator, [@TraitClause3]: core::marker::Copy, T : 'a, - Self::Item = &'a (T), + @TraitClause2::Item = &'a (T), fn core::iter::traits::iterator::Iterator::cloned<'a, Self, T>(@1: Self) -> core::iter::adapters::cloned::Cloned where [@TraitClause2]: core::iter::traits::iterator::Iterator, [@TraitClause3]: core::clone::Clone, T : 'a, - Self::Item = &'a (T), + @TraitClause2::Item = &'a (T), fn core::iter::traits::iterator::Iterator::cycle(@1: Self) -> core::iter::adapters::cycle::Cycle where diff --git a/charon/tests/ui/loops.out b/charon/tests/ui/loops.out index 7c68b8e8..e3ad661a 100644 --- a/charon/tests/ui/loops.out +++ b/charon/tests/ui/loops.out @@ -2191,21 +2191,21 @@ where [@TraitClause6]: core::default::Default, [@TraitClause7]: core::iter::traits::collect::Extend, [@TraitClause9]: core::iter::traits::iterator::Iterator, - Self::Item = (A, B), + @TraitClause9::Item = (A, B), fn core::iter::traits::iterator::Iterator::copied<'a, Self, T>(@1: Self) -> core::iter::adapters::copied::Copied where [@TraitClause2]: core::iter::traits::iterator::Iterator, [@TraitClause3]: core::marker::Copy, T : 'a, - Self::Item = &'a (T), + @TraitClause2::Item = &'a (T), fn core::iter::traits::iterator::Iterator::cloned<'a, Self, T>(@1: Self) -> core::iter::adapters::cloned::Cloned where [@TraitClause2]: core::iter::traits::iterator::Iterator, [@TraitClause3]: core::clone::Clone, T : 'a, - Self::Item = &'a (T), + @TraitClause2::Item = &'a (T), fn core::iter::traits::iterator::Iterator::cycle(@1: Self) -> core::iter::adapters::cycle::Cycle where diff --git a/charon/tests/ui/quantified-clause.out b/charon/tests/ui/quantified-clause.out index d6cc8471..1af7395a 100644 --- a/charon/tests/ui/quantified-clause.out +++ b/charon/tests/ui/quantified-clause.out @@ -1,22 +1,49 @@ -thread 'rustc' panicked at src/bin/charon-driver/translate/translate_predicates.rs:470:17: -assertion failed: trait_ref.bound_vars.is_empty() -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -error: Thread panicked when extracting item `test_crate::foo`. - --> tests/ui/quantified-clause.rs:3:1 - | -3 | / fn foo(_f: F) -4 | | where -5 | | F: for<'a> FnMut(&'a ()), - | |_____________________________^ - -error: Ignoring the following item due to an error: test_crate::foo - --> tests/ui/quantified-clause.rs:3:1 - | -3 | / fn foo(_f: F) -4 | | where -5 | | F: for<'a> FnMut(&'a ()), - | |_____________________________^ - -error: aborting due to 2 previous errors - -Error: Charon driver exited with code 101 +# Final LLBC before serialization: + +trait core::ops::function::FnOnce +{ + type Output + fn call_once : core::ops::function::FnOnce::call_once +} + +trait core::ops::function::FnMut +{ + parent_clause_0 : [@TraitClause0]: core::ops::function::FnOnce + fn call_mut : core::ops::function::FnMut::call_mut +} + +fn test_crate::foo(@1: F) +where + [@TraitClause1]: for<'_1_0> core::ops::function::FnMut, + for<'a> (parents(@TraitClause1)::[@TraitClause0])::Output = (), +{ + let @0: (); // return + let _f@1: F; // arg #1 + let @2: (); // anonymous local + + @2 := () + @0 := move (@2) + drop _f@1 + @0 := () + return +} + +fn test_crate::bar<'b, T>() +where + for<'a> &'b (T) : 'a, +{ + let @0: (); // return + let @1: (); // anonymous local + + @1 := () + @0 := move (@1) + @0 := () + return +} + +fn core::ops::function::FnMut::call_mut<'_0, Self, Args>(@1: &'_0 mut (Self), @2: Args) -> (parents(Self)::[@TraitClause0])::Output + +fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> Self::Output + + + diff --git a/charon/tests/ui/quantified-clause.rs b/charon/tests/ui/quantified-clause.rs index 88bd96e0..46d71a59 100644 --- a/charon/tests/ui/quantified-clause.rs +++ b/charon/tests/ui/quantified-clause.rs @@ -1,5 +1,3 @@ -//@ known-failure - fn foo(_f: F) where F: for<'a> FnMut(&'a ()), diff --git a/charon/tests/ui/trait-instance-id.out b/charon/tests/ui/trait-instance-id.out index 3c7fa894..7c9eec22 100644 --- a/charon/tests/ui/trait-instance-id.out +++ b/charon/tests/ui/trait-instance-id.out @@ -366,7 +366,7 @@ fn core::array::iter::{impl core::iter::traits::iterator::Iterator for core::arr fn core::array::iter::{impl core::iter::traits::iterator::Iterator for core::array::iter::IntoIter}#2::fold(@1: core::array::iter::IntoIter, @2: Acc, @3: Fold) -> Acc where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "Fold" })), Type(Tuple([Param(ParamTy { index: 2, name: "Acc" }), Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::array::iter::IntoIter })] }, bound_vars: [] }, impl: Concrete { id: core::array::iter::{impl#2}, generics: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::array::iter::IntoIter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "Fold" })), Type(Tuple([Param(ParamTy { index: 2, name: "Acc" }), Param(ParamTy { index: 0, name: "T" })]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Type(Param(ParamTy { index: 0, name: "T" })), Const(Decorated { ty: Uint(Usize), span: Span { lo: Loc { line: 1, col: 0 }, hi: Loc { line: 1, col: 0 }, filename: Real(LocalPath("tests/ui/trait-instance-id.rs")), rust_span_data: Some(no-location (#0)) }, contents: ConstRef { id: ParamConst { index: 1, name: "N" } }, hir_id: None, attributes: [] })], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(2260340255824257914), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::array::iter::IntoIter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 0, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "Acc" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 3, name: "Fold" }))] }) (context: core::array::iter::{impl#2}::fold)))::[@TraitClause0])::Output = Acc, + (parents(@TraitClause3)::[@TraitClause0])::Output = Acc, unsafe fn core::array::iter::{impl core::iter::traits::iterator::Iterator for core::array::iter::IntoIter}#2::__iterator_get_unchecked<'_0, T, const N : usize>(@1: &'_0 mut (core::array::iter::IntoIter), @2: usize) -> core::array::iter::{impl core::iter::traits::iterator::Iterator for core::array::iter::IntoIter}#2::Item @@ -428,32 +428,37 @@ fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::sli fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::for_each<'a, T, F>(@1: core::slice::iter::Iter<'a, T>, @2: F) where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "F" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::for_each)))::[@TraitClause0])::Output = (), + (parents(@TraitClause3)::[@TraitClause0])::Output = (), fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::fold<'a, T, B, F>(@1: core::slice::iter::Iter<'a, T>, @2: B, @3: F) -> B where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Param(ParamTy { index: 2, name: "B" }), Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Param(ParamTy { index: 2, name: "B" }), Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "B" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 3, name: "F" }))] }) (context: core::slice::iter::{impl#182}::fold)))::[@TraitClause0])::Output = B, + (parents(@TraitClause3)::[@TraitClause0])::Output = B, fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::all<'a, '_1, T, F>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: F) -> bool where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "F" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::all)))::[@TraitClause0])::Output = bool, + (parents(@TraitClause3)::[@TraitClause0])::Output = bool, fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::any<'a, '_1, T, F>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: F) -> bool where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "F" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::any)))::[@TraitClause0])::Output = bool, + (parents(@TraitClause3)::[@TraitClause0])::Output = bool, + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::find<'a, '_1, T, P>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: P) -> core::option::Option}#182<'_, T>::Item> +where + [@TraitClause3]: for<'_1_0> core::ops::function::FnMut, + for<'_1_0> (parents(@TraitClause3)::[@TraitClause0])::Output = bool, fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::find_map<'a, '_1, T, B, F>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: F) -> core::option::Option where [@TraitClause4]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause4]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 3, name: "F" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "B" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 3, name: "F" }))] }; [@TraitClause3]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::find_map)))::[@TraitClause0])::Output = core::option::Option, + (parents(@TraitClause4)::[@TraitClause0])::Output = core::option::Option, fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::position<'a, '_1, T, P>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: P) -> core::option::Option where [@TraitClause3]: core::ops::function::FnMut, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: Concrete { id: core::slice::iter::{impl#182}, generics: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))] }, args: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause3]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Ref(Region { kind: ReErased }, Param(ParamTy { index: 1, name: "T" }), false)]))] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "P" }))] }; [@TraitClause2]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::position)))::[@TraitClause0])::Output = bool, + (parents(@TraitClause3)::[@TraitClause0])::Output = bool, trait core::iter::traits::exact_size::ExactSizeIterator { @@ -464,10 +469,15 @@ trait core::iter::traits::exact_size::ExactSizeIterator fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::rposition<'a, '_1, T, P>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: P) -> core::option::Option where - [@TraitClause2]: core::ops::function::FnMut, + [@TraitClause2]: core::ops::function::FnMut, [@TraitClause4]: core::iter::traits::exact_size::ExactSizeIterator>, [@TraitClause5]: core::iter::traits::double_ended::DoubleEndedIterator>, - (parents(UNKNOWN(Could not find a clause for parameter: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(8741807603274333571), index: 4, trait: Binder { value: TraitRef { def_id: core::iter::traits::exact_size::ExactSizeIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, path: [Parent { predicate: Binder { value: TraitPredicate { trait_ref: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, is_positive: true }, bound_vars: [] }, predicate_id: PredicateId(7752569106737159048), index: 0 }] }, args: [] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] } (available clauses: [@TraitClause2]: TraitRef { def_id: core::ops::function::FnMut, generic_args: [Type(Param(ParamTy { index: 2, name: "P" })), Type(Tuple([Alias(Alias { kind: Projection { impl_expr: ImplExpr { trait: Binder { value: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(8741807603274333571), index: 4, trait: Binder { value: TraitRef { def_id: core::iter::traits::exact_size::ExactSizeIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, bound_vars: [] }, path: [Parent { predicate: Binder { value: TraitPredicate { trait_ref: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }, is_positive: true }, bound_vars: [] }, predicate_id: PredicateId(7752569106737159048), index: 0 }] }, args: [] }, assoc_item: AssocItem { def_id: core::iter::traits::iterator::Iterator::Item, name: "Item", kind: Type, container: TraitContainer { trait_id: core::iter::traits::iterator::Iterator }, has_value: false, fn_has_self_parameter: false, opt_rpitit_info: None } }, args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })], def_id: core::iter::traits::iterator::Iterator::Item })]))] }; [@TraitClause5]: TraitRef { def_id: core::iter::traits::double_ended::DoubleEndedIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause4]: TraitRef { def_id: core::iter::traits::exact_size::ExactSizeIterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [Self]: TraitRef { def_id: core::iter::traits::iterator::Iterator, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReEarlyParam(EarlyParamRegion { index: 0, name: "'a" }) }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }; [@TraitClause0]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }; [@TraitClause1]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 2, name: "P" }))] }; [@TraitClause3]: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Adt { generic_args: [Lifetime(Region { kind: ReErased }), Type(Param(ParamTy { index: 1, name: "T" }))], trait_refs: [ImplExpr { trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, impl: LocalBound { predicate_id: PredicateId(5936587636626320602), index: 0, trait: Binder { value: TraitRef { def_id: core::marker::Sized, generic_args: [Type(Param(ParamTy { index: 1, name: "T" }))] }, bound_vars: [] }, path: [] }, args: [] }], def_id: core::slice::iter::Iter })] }) (context: core::slice::iter::{impl#182}::rposition)))::[@TraitClause0])::Output = bool, + (parents(@TraitClause2)::[@TraitClause0])::Output = bool, + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::is_sorted_by<'a, T, F>(@1: core::slice::iter::Iter<'a, T>, @2: F) -> bool +where + [@TraitClause3]: for<'_1_0, '_1_1> core::ops::function::FnMut, + for<'_1_0, '_1_1> (parents(@TraitClause3)::[@TraitClause0])::Output = bool, unsafe fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::__iterator_get_unchecked<'a, '_1, T>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: usize) -> core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182<'_, T>::Item @@ -484,11 +494,11 @@ impl<'a, T> core::slice::iter::{impl core::iter::traits::iterator::Iterator for fn fold = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::fold fn all = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::all fn any = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::any - fn find = @Fun99 + fn find = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::find fn find_map = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::find_map fn position = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::position fn rposition = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::rposition - fn is_sorted_by = @Fun104 + fn is_sorted_by = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::is_sorted_by fn __iterator_get_unchecked = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::__iterator_get_unchecked } @@ -1024,21 +1034,21 @@ where [@TraitClause6]: core::default::Default, [@TraitClause7]: core::iter::traits::collect::Extend, [@TraitClause9]: core::iter::traits::iterator::Iterator, - Self::Item = (A, B), + @TraitClause9::Item = (A, B), fn core::iter::traits::iterator::Iterator::copied<'a, Self, T>(@1: Self) -> core::iter::adapters::copied::Copied where [@TraitClause2]: core::iter::traits::iterator::Iterator, [@TraitClause3]: core::marker::Copy, T : 'a, - Self::Item = &'a (T), + @TraitClause2::Item = &'a (T), fn core::iter::traits::iterator::Iterator::cloned<'a, Self, T>(@1: Self) -> core::iter::adapters::cloned::Cloned where [@TraitClause2]: core::iter::traits::iterator::Iterator, [@TraitClause3]: core::clone::Clone, T : 'a, - Self::Item = &'a (T), + @TraitClause2::Item = &'a (T), fn core::iter::traits::iterator::Iterator::cycle(@1: Self) -> core::iter::adapters::cycle::Cycle where diff --git a/charon/tests/ui/unsupported/issue-79-bound-regions.out b/charon/tests/ui/unsupported/issue-79-bound-regions.out new file mode 100644 index 00000000..7d6eac08 --- /dev/null +++ b/charon/tests/ui/unsupported/issue-79-bound-regions.out @@ -0,0 +1,830 @@ +# Final LLBC before serialization: + +enum core::option::Option = +| None() +| Some(T) + + +opaque type core::slice::iter::Iter<'a, T> + where + T : 'a, + T : 'a, + +fn core::slice::{Slice}::iter<'_0, T>(@1: &'_0 (Slice)) -> core::slice::iter::Iter<'_0, T> + +enum core::result::Result = +| Ok(T) +| Err(E) + + +opaque type core::array::iter::IntoIter + +trait core::clone::Clone +{ + fn clone : core::clone::Clone::clone + fn clone_from : core::clone::Clone::clone_from +} + +trait core::marker::Copy +{ + parent_clause_0 : [@TraitClause0]: core::clone::Clone +} + +trait core::num::nonzero::private::Sealed + +trait core::num::nonzero::ZeroablePrimitive +{ + parent_clause_1 : [@TraitClause1]: core::marker::Copy + parent_clause_2 : [@TraitClause2]: core::num::nonzero::private::Sealed + parent_clause_3 : [@TraitClause3]: core::marker::Copy + parent_clause_4 : [@TraitClause4]: core::clone::Clone + type NonZeroInner +} + +opaque type core::num::nonzero::NonZero + where + [@TraitClause1]: core::num::nonzero::ZeroablePrimitive, + +fn core::clone::impls::{impl core::clone::Clone for usize}#5::clone<'_0>(@1: &'_0 (usize)) -> usize + +impl core::clone::impls::{impl core::clone::Clone for usize}#5 : core::clone::Clone +{ + fn clone = core::clone::impls::{impl core::clone::Clone for usize}#5::clone +} + +impl core::marker::{impl core::marker::Copy for usize}#37 : core::marker::Copy +{ + parent_clause0 = core::clone::impls::{impl core::clone::Clone for usize}#5 +} + +impl core::num::nonzero::{impl core::num::nonzero::private::Sealed for usize}#25 : core::num::nonzero::private::Sealed + +opaque type core::num::nonzero::private::NonZeroUsizeInner + +fn core::num::nonzero::private::{impl core::clone::Clone for core::num::nonzero::private::NonZeroUsizeInner}#26::clone<'_0>(@1: &'_0 (core::num::nonzero::private::NonZeroUsizeInner)) -> core::num::nonzero::private::NonZeroUsizeInner + +impl core::num::nonzero::private::{impl core::clone::Clone for core::num::nonzero::private::NonZeroUsizeInner}#26 : core::clone::Clone +{ + fn clone = core::num::nonzero::private::{impl core::clone::Clone for core::num::nonzero::private::NonZeroUsizeInner}#26::clone +} + +impl core::num::nonzero::private::{impl core::marker::Copy for core::num::nonzero::private::NonZeroUsizeInner}#27 : core::marker::Copy +{ + parent_clause0 = core::num::nonzero::private::{impl core::clone::Clone for core::num::nonzero::private::NonZeroUsizeInner}#26 +} + +impl core::num::nonzero::{impl core::num::nonzero::ZeroablePrimitive for usize}#26 : core::num::nonzero::ZeroablePrimitive +{ + parent_clause0 = core::marker::{impl core::marker::Copy for usize}#37 + parent_clause1 = core::num::nonzero::{impl core::num::nonzero::private::Sealed for usize}#25 + parent_clause2 = core::num::nonzero::private::{impl core::marker::Copy for core::num::nonzero::private::NonZeroUsizeInner}#27 + parent_clause3 = core::num::nonzero::private::{impl core::clone::Clone for core::num::nonzero::private::NonZeroUsizeInner}#26 + type NonZeroInner = core::num::nonzero::private::NonZeroUsizeInner +} + +opaque type core::iter::adapters::step_by::StepBy + +opaque type core::iter::adapters::chain::Chain + +opaque type core::iter::adapters::zip::Zip + +trait core::ops::function::FnOnce +{ + type Output + fn call_once : core::ops::function::FnOnce::call_once +} + +trait core::ops::function::FnMut +{ + parent_clause_0 : [@TraitClause0]: core::ops::function::FnOnce + fn call_mut : core::ops::function::FnMut::call_mut +} + +opaque type core::iter::adapters::map::Map + +opaque type core::iter::adapters::filter_map::FilterMap + +opaque type core::iter::adapters::enumerate::Enumerate + +opaque type core::iter::adapters::map_while::MapWhile + +opaque type core::iter::adapters::skip::Skip + +opaque type core::iter::adapters::take::Take + +opaque type core::iter::adapters::fuse::Fuse + +trait core::ops::try_trait::FromResidual +{ + fn from_residual : core::ops::try_trait::FromResidual::from_residual +} + +enum core::ops::control_flow::ControlFlow = +| Continue(C) +| Break(B) + + +trait core::ops::try_trait::Try +{ + parent_clause_0 : [@TraitClause0]: core::ops::try_trait::FromResidual + type Output + type Residual + fn from_output : core::ops::try_trait::Try::from_output + fn branch : core::ops::try_trait::Try::branch +} + +trait core::ops::try_trait::Residual +where + (parents(Self)::[@TraitClause1])::Residual = Self, + (parents(Self)::[@TraitClause1])::Output = O, +{ + parent_clause_1 : [@TraitClause1]: core::ops::try_trait::Try + parent_clause_2 : [@TraitClause2]: core::ops::try_trait::FromResidual + type TryType +} + +trait core::cmp::PartialEq +{ + fn eq : core::cmp::PartialEq::eq + fn ne : core::cmp::PartialEq::ne +} + +trait core::cmp::Eq +{ + parent_clause_0 : [@TraitClause0]: core::cmp::PartialEq + fn assert_receiver_is_total_eq : core::cmp::Eq::assert_receiver_is_total_eq +} + +enum core::cmp::Ordering = +| Less() +| Equal() +| Greater() + + +trait core::cmp::PartialOrd +{ + parent_clause_0 : [@TraitClause0]: core::cmp::PartialEq + fn partial_cmp : core::cmp::PartialOrd::partial_cmp + fn lt : core::cmp::PartialOrd::lt + fn le : core::cmp::PartialOrd::le + fn gt : core::cmp::PartialOrd::gt + fn ge : core::cmp::PartialOrd::ge +} + +trait core::cmp::Ord +{ + parent_clause_0 : [@TraitClause0]: core::cmp::Eq + parent_clause_1 : [@TraitClause1]: core::cmp::PartialOrd + fn cmp : core::cmp::Ord::cmp + fn max : core::cmp::Ord::max + fn min : core::cmp::Ord::min + fn clamp : core::cmp::Ord::clamp +} + +opaque type core::iter::adapters::rev::Rev + +trait core::default::Default +{ + fn default : core::default::Default::default +} + +opaque type core::iter::adapters::copied::Copied + +opaque type core::iter::adapters::cloned::Cloned + +opaque type core::iter::adapters::cycle::Cycle + +trait core::iter::traits::iterator::Iterator +{ + type Item + fn next : core::iter::traits::iterator::Iterator::next + fn next_chunk : core::iter::traits::iterator::Iterator::next_chunk + fn size_hint : core::iter::traits::iterator::Iterator::size_hint + fn count : core::iter::traits::iterator::Iterator::count + fn last : core::iter::traits::iterator::Iterator::last + fn advance_by : core::iter::traits::iterator::Iterator::advance_by + fn nth : core::iter::traits::iterator::Iterator::nth + fn step_by : core::iter::traits::iterator::Iterator::step_by + fn chain : core::iter::traits::iterator::Iterator::chain + fn zip : core::iter::traits::iterator::Iterator::zip + fn intersperse : core::iter::traits::iterator::Iterator::intersperse + fn intersperse_with : core::iter::traits::iterator::Iterator::intersperse_with + fn map : core::iter::traits::iterator::Iterator::map + fn for_each : core::iter::traits::iterator::Iterator::for_each + fn filter_map : core::iter::traits::iterator::Iterator::filter_map + fn enumerate : core::iter::traits::iterator::Iterator::enumerate + fn peekable : core::iter::traits::iterator::Iterator::peekable + fn map_while : core::iter::traits::iterator::Iterator::map_while + fn skip : core::iter::traits::iterator::Iterator::skip + fn take : core::iter::traits::iterator::Iterator::take + fn flat_map : core::iter::traits::iterator::Iterator::flat_map + fn flatten : core::iter::traits::iterator::Iterator::flatten + fn fuse : core::iter::traits::iterator::Iterator::fuse + fn by_ref : core::iter::traits::iterator::Iterator::by_ref + fn collect : core::iter::traits::iterator::Iterator::collect + fn try_collect : core::iter::traits::iterator::Iterator::try_collect + fn collect_into : core::iter::traits::iterator::Iterator::collect_into + fn is_partitioned : core::iter::traits::iterator::Iterator::is_partitioned + fn try_fold : core::iter::traits::iterator::Iterator::try_fold + fn try_for_each : core::iter::traits::iterator::Iterator::try_for_each + fn fold : core::iter::traits::iterator::Iterator::fold + fn reduce : core::iter::traits::iterator::Iterator::reduce + fn try_reduce : core::iter::traits::iterator::Iterator::try_reduce + fn all : core::iter::traits::iterator::Iterator::all + fn any : core::iter::traits::iterator::Iterator::any + fn find_map : core::iter::traits::iterator::Iterator::find_map + fn position : core::iter::traits::iterator::Iterator::position + fn max : core::iter::traits::iterator::Iterator::max + fn min : core::iter::traits::iterator::Iterator::min + fn rev : core::iter::traits::iterator::Iterator::rev + fn unzip : core::iter::traits::iterator::Iterator::unzip + fn copied : core::iter::traits::iterator::Iterator::copied + fn cloned : core::iter::traits::iterator::Iterator::cloned + fn cycle : core::iter::traits::iterator::Iterator::cycle + fn array_chunks : core::iter::traits::iterator::Iterator::array_chunks + fn sum : core::iter::traits::iterator::Iterator::sum + fn product : core::iter::traits::iterator::Iterator::product + fn cmp : core::iter::traits::iterator::Iterator::cmp + fn cmp_by : core::iter::traits::iterator::Iterator::cmp_by + fn partial_cmp : core::iter::traits::iterator::Iterator::partial_cmp + fn partial_cmp_by : core::iter::traits::iterator::Iterator::partial_cmp_by + fn eq : core::iter::traits::iterator::Iterator::eq + fn eq_by : core::iter::traits::iterator::Iterator::eq_by + fn ne : core::iter::traits::iterator::Iterator::ne + fn lt : core::iter::traits::iterator::Iterator::lt + fn le : core::iter::traits::iterator::Iterator::le + fn gt : core::iter::traits::iterator::Iterator::gt + fn ge : core::iter::traits::iterator::Iterator::ge + fn is_sorted : core::iter::traits::iterator::Iterator::is_sorted + fn is_sorted_by_key : core::iter::traits::iterator::Iterator::is_sorted_by_key + fn __iterator_get_unchecked : core::iter::traits::iterator::Iterator::__iterator_get_unchecked +} + +trait core::iter::traits::collect::IntoIterator +where + (parents(Self)::[@TraitClause1])::Item = Self::Item, +{ + parent_clause_1 : [@TraitClause1]: core::iter::traits::iterator::Iterator + type Item + type IntoIter + fn into_iter : core::iter::traits::collect::IntoIterator::into_iter +} + +opaque type core::iter::adapters::intersperse::Intersperse + where + [@TraitClause1]: core::iter::traits::iterator::Iterator, + [@TraitClause2]: core::clone::Clone<@TraitClause1::Item>, + +opaque type core::iter::adapters::intersperse::IntersperseWith + where + [@TraitClause2]: core::iter::traits::iterator::Iterator, + +opaque type core::iter::adapters::peekable::Peekable + where + [@TraitClause1]: core::iter::traits::iterator::Iterator, + +opaque type core::iter::adapters::flatten::FlatMap + where + [@TraitClause3]: core::iter::traits::collect::IntoIterator, + +opaque type core::iter::adapters::flatten::Flatten + where + [@TraitClause1]: core::iter::traits::iterator::Iterator, + [@TraitClause2]: core::iter::traits::collect::IntoIterator<@TraitClause1::Item>, + +trait core::iter::traits::collect::FromIterator +{ + fn from_iter : core::iter::traits::collect::FromIterator::from_iter +} + +trait core::iter::traits::collect::Extend +{ + fn extend : core::iter::traits::collect::Extend::extend + fn extend_one : core::iter::traits::collect::Extend::extend_one + fn extend_reserve : core::iter::traits::collect::Extend::extend_reserve + fn extend_one_unchecked : core::iter::traits::collect::Extend::extend_one_unchecked +} + +trait core::iter::traits::double_ended::DoubleEndedIterator +{ + parent_clause_0 : [@TraitClause0]: core::iter::traits::iterator::Iterator + fn next_back : core::iter::traits::double_ended::DoubleEndedIterator::next_back + fn advance_back_by : core::iter::traits::double_ended::DoubleEndedIterator::advance_back_by + fn nth_back : core::iter::traits::double_ended::DoubleEndedIterator::nth_back + fn try_rfold : core::iter::traits::double_ended::DoubleEndedIterator::try_rfold + fn rfold : core::iter::traits::double_ended::DoubleEndedIterator::rfold +} + +opaque type core::iter::adapters::array_chunks::ArrayChunks + where + [@TraitClause1]: core::iter::traits::iterator::Iterator, + +trait core::iter::traits::accum::Sum +{ + fn sum : core::iter::traits::accum::Sum::sum +} + +trait core::iter::traits::accum::Product +{ + fn product : core::iter::traits::accum::Product::product +} + +trait core::iter::adapters::zip::TrustedRandomAccessNoCoerce +{ + const MAY_HAVE_SIDE_EFFECT : bool + fn size : core::iter::adapters::zip::TrustedRandomAccessNoCoerce::size +} + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::next<'a, '_1, T>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>)) -> core::option::Option<&'a (T)> + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::size_hint<'a, '_1, T>(@1: &'_1 (core::slice::iter::Iter<'a, T>)) -> (usize, core::option::Option) + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::count<'a, T>(@1: core::slice::iter::Iter<'a, T>) -> usize + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::last<'a, T>(@1: core::slice::iter::Iter<'a, T>) -> core::option::Option<&'a (T)> + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::advance_by<'a, '_1, T>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: usize) -> core::result::Result<(), core::num::nonzero::NonZero> + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::nth<'a, '_1, T>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: usize) -> core::option::Option<&'a (T)> + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::for_each<'a, T, F>(@1: core::slice::iter::Iter<'a, T>, @2: F) +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = (), + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::fold<'a, T, B, F>(@1: core::slice::iter::Iter<'a, T>, @2: B, @3: F) -> B +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = B, + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::all<'a, '_1, T, F>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: F) -> bool +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = bool, + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::any<'a, '_1, T, F>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: F) -> bool +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = bool, + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::find<'a, '_1, T, P>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: P) -> core::option::Option}#182<'_, T>::Item> +where + [@TraitClause3]: for<'_1_0> core::ops::function::FnMut, + for<'_1_0> (parents(@TraitClause3)::[@TraitClause0])::Output = bool, + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::find_map<'a, '_1, T, B, F>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: F) -> core::option::Option +where + [@TraitClause4]: core::ops::function::FnMut, + (parents(@TraitClause4)::[@TraitClause0])::Output = core::option::Option, + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::position<'a, '_1, T, P>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: P) -> core::option::Option +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = bool, + +trait core::iter::traits::exact_size::ExactSizeIterator +{ + parent_clause_0 : [@TraitClause0]: core::iter::traits::iterator::Iterator + fn len : core::iter::traits::exact_size::ExactSizeIterator::len + fn is_empty : core::iter::traits::exact_size::ExactSizeIterator::is_empty +} + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::rposition<'a, '_1, T, P>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: P) -> core::option::Option +where + [@TraitClause2]: core::ops::function::FnMut, + [@TraitClause4]: core::iter::traits::exact_size::ExactSizeIterator>, + [@TraitClause5]: core::iter::traits::double_ended::DoubleEndedIterator>, + (parents(@TraitClause2)::[@TraitClause0])::Output = bool, + +fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::is_sorted_by<'a, T, F>(@1: core::slice::iter::Iter<'a, T>, @2: F) -> bool +where + [@TraitClause3]: for<'_1_0, '_1_1> core::ops::function::FnMut, + for<'_1_0, '_1_1> (parents(@TraitClause3)::[@TraitClause0])::Output = bool, + +unsafe fn core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::__iterator_get_unchecked<'a, '_1, T>(@1: &'_1 mut (core::slice::iter::Iter<'a, T>), @2: usize) -> core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182<'_, T>::Item + +impl<'a, T> core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182<'a, T> : core::iter::traits::iterator::Iterator> +{ + type Item = &'a (T) + fn next = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::next + fn size_hint = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::size_hint + fn count = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::count + fn last = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::last + fn advance_by = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::advance_by + fn nth = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::nth + fn for_each = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::for_each + fn fold = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::fold + fn all = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::all + fn any = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::any + fn find = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::find + fn find_map = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::find_map + fn position = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::position + fn rposition = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::rposition + fn is_sorted_by = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::is_sorted_by + fn __iterator_get_unchecked = core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182::__iterator_get_unchecked +} + +fn core::iter::traits::iterator::Iterator::next<'_0, Self>(@1: &'_0 mut (Self)) -> core::option::Option + +fn test_crate::main() +{ + let @0: (); // return + let slice@1: &'_ (Slice); // local + let @2: &'_ (Array); // anonymous local + let @3: &'_ (Array); // anonymous local + let @4: Array; // anonymous local + let @5: core::option::Option<&'_ (i32)>; // anonymous local + let @6: &'_ mut (core::slice::iter::Iter<'_, i32>); // anonymous local + let @7: core::slice::iter::Iter<'_, i32>; // anonymous local + let @8: &'_ (Slice); // anonymous local + let @9: (); // anonymous local + + @4 := [const (0 : i32); 1 : usize] + @3 := &@4 + @2 := &*(@3) + slice@1 := @ArrayToSliceShared<'_, i32, 1 : usize>(move (@2)) + drop @2 + @fake_read(slice@1) + drop @3 + @8 := &*(slice@1) + @7 := core::slice::{Slice}::iter(move (@8)) + @6 := &two-phase-mut @7 + drop @8 + @5 := core::slice::iter::{impl core::iter::traits::iterator::Iterator for core::slice::iter::Iter<'a, T>}#182<'_, i32>::next(move (@6)) + drop @6 + @fake_read(@5) + drop @7 + drop @5 + @9 := () + @0 := move (@9) + drop @4 + drop slice@1 + @0 := () + return +} + +fn core::iter::traits::iterator::Iterator::next_chunk<'_0, Self, const N : usize>(@1: &'_0 mut (Self)) -> core::result::Result, core::array::iter::IntoIter> + +fn core::iter::traits::iterator::Iterator::size_hint<'_0, Self>(@1: &'_0 (Self)) -> (usize, core::option::Option) + +fn core::iter::traits::iterator::Iterator::count(@1: Self) -> usize + +fn core::iter::traits::iterator::Iterator::last(@1: Self) -> core::option::Option + +fn core::iter::traits::iterator::Iterator::advance_by<'_0, Self>(@1: &'_0 mut (Self), @2: usize) -> core::result::Result<(), core::num::nonzero::NonZero> + +fn core::iter::traits::iterator::Iterator::nth<'_0, Self>(@1: &'_0 mut (Self), @2: usize) -> core::option::Option + +fn core::iter::traits::iterator::Iterator::step_by(@1: Self, @2: usize) -> core::iter::adapters::step_by::StepBy + +fn core::iter::traits::iterator::Iterator::chain(@1: Self, @2: U) -> core::iter::adapters::chain::Chain +where + [@TraitClause2]: core::iter::traits::collect::IntoIterator, + @TraitClause2::Item = Self::Item, + +fn core::iter::traits::iterator::Iterator::zip(@1: Self, @2: U) -> core::iter::adapters::zip::Zip +where + [@TraitClause2]: core::iter::traits::collect::IntoIterator, + +fn core::iter::traits::iterator::Iterator::intersperse(@1: Self, @2: Self::Item) -> core::iter::adapters::intersperse::Intersperse +where + [@TraitClause1]: core::clone::Clone, + +fn core::iter::traits::iterator::Iterator::intersperse_with(@1: Self, @2: G) -> core::iter::adapters::intersperse::IntersperseWith +where + [@TraitClause2]: core::ops::function::FnMut, + (parents(@TraitClause2)::[@TraitClause0])::Output = Self::Item, + +fn core::iter::traits::iterator::Iterator::map(@1: Self, @2: F) -> core::iter::adapters::map::Map +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = B, + +fn core::iter::traits::iterator::Iterator::for_each(@1: Self, @2: F) +where + [@TraitClause2]: core::ops::function::FnMut, + (parents(@TraitClause2)::[@TraitClause0])::Output = (), + +fn core::iter::traits::iterator::Iterator::filter_map(@1: Self, @2: F) -> core::iter::adapters::filter_map::FilterMap +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = core::option::Option, + +fn core::iter::traits::iterator::Iterator::enumerate(@1: Self) -> core::iter::adapters::enumerate::Enumerate + +fn core::iter::traits::iterator::Iterator::peekable(@1: Self) -> core::iter::adapters::peekable::Peekable + +fn core::iter::traits::iterator::Iterator::map_while(@1: Self, @2: P) -> core::iter::adapters::map_while::MapWhile +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = core::option::Option, + +fn core::iter::traits::iterator::Iterator::skip(@1: Self, @2: usize) -> core::iter::adapters::skip::Skip + +fn core::iter::traits::iterator::Iterator::take(@1: Self, @2: usize) -> core::iter::adapters::take::Take + +fn core::iter::traits::iterator::Iterator::flat_map(@1: Self, @2: F) -> core::iter::adapters::flatten::FlatMap +where + [@TraitClause3]: core::iter::traits::collect::IntoIterator, + [@TraitClause4]: core::ops::function::FnMut, + (parents(@TraitClause4)::[@TraitClause0])::Output = U, + +fn core::iter::traits::iterator::Iterator::flatten(@1: Self) -> core::iter::adapters::flatten::Flatten +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + +fn core::iter::traits::iterator::Iterator::fuse(@1: Self) -> core::iter::adapters::fuse::Fuse + +fn core::iter::traits::iterator::Iterator::by_ref<'_0, Self>(@1: &'_0 mut (Self)) -> &'_0 mut (Self) + +fn core::iter::traits::iterator::Iterator::collect(@1: Self) -> B +where + [@TraitClause1]: core::iter::traits::collect::FromIterator, + +fn core::iter::traits::iterator::Iterator::try_collect<'_0, Self, B>(@1: &'_0 mut (Self)) -> @TraitClause3::TryType +where + [@TraitClause2]: core::ops::try_trait::Try, + [@TraitClause3]: core::ops::try_trait::Residual<@TraitClause2::Residual, B>, + [@TraitClause4]: core::iter::traits::collect::FromIterator, + +fn core::iter::traits::iterator::Iterator::collect_into<'_0, Self, E>(@1: Self, @2: &'_0 mut (E)) -> &'_0 mut (E) +where + [@TraitClause1]: core::iter::traits::collect::Extend, + +fn core::iter::traits::iterator::Iterator::is_partitioned(@1: Self, @2: P) -> bool +where + [@TraitClause2]: core::ops::function::FnMut, + (parents(@TraitClause2)::[@TraitClause0])::Output = bool, + +fn core::iter::traits::iterator::Iterator::try_fold<'_0, Self, B, F, R>(@1: &'_0 mut (Self), @2: B, @3: F) -> R +where + [@TraitClause4]: core::ops::function::FnMut, + [@TraitClause5]: core::ops::try_trait::Try, + (parents(@TraitClause4)::[@TraitClause0])::Output = R, + @TraitClause5::Output = B, + +fn core::iter::traits::iterator::Iterator::try_for_each<'_0, Self, F, R>(@1: &'_0 mut (Self), @2: F) -> R +where + [@TraitClause3]: core::ops::function::FnMut, + [@TraitClause4]: core::ops::try_trait::Try, + (parents(@TraitClause3)::[@TraitClause0])::Output = R, + @TraitClause4::Output = (), + +fn core::iter::traits::iterator::Iterator::fold(@1: Self, @2: B, @3: F) -> B +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = B, + +fn core::iter::traits::iterator::Iterator::reduce(@1: Self, @2: F) -> core::option::Option +where + [@TraitClause2]: core::ops::function::FnMut, + (parents(@TraitClause2)::[@TraitClause0])::Output = Self::Item, + +fn core::iter::traits::iterator::Iterator::try_reduce<'_0, Self, R, impl FnMut(Self::Item, Self::Item) -> R>(@1: &'_0 mut (Self), @2: impl FnMut(Self::Item, Self::Item) -> R) -> @TraitClause4::TryType +where + [@TraitClause3]: core::ops::try_trait::Try, + [@TraitClause4]: core::ops::try_trait::Residual<@TraitClause3::Residual, core::option::Option>, + [@TraitClause5]: core::ops::function::FnMut R, (Self::Item, Self::Item)>, + @TraitClause3::Output = Self::Item, + (parents(@TraitClause5)::[@TraitClause0])::Output = R, + +fn core::iter::traits::iterator::Iterator::all<'_0, Self, F>(@1: &'_0 mut (Self), @2: F) -> bool +where + [@TraitClause2]: core::ops::function::FnMut, + (parents(@TraitClause2)::[@TraitClause0])::Output = bool, + +fn core::iter::traits::iterator::Iterator::any<'_0, Self, F>(@1: &'_0 mut (Self), @2: F) -> bool +where + [@TraitClause2]: core::ops::function::FnMut, + (parents(@TraitClause2)::[@TraitClause0])::Output = bool, + +fn core::iter::traits::iterator::Iterator::find_map<'_0, Self, B, F>(@1: &'_0 mut (Self), @2: F) -> core::option::Option +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = core::option::Option, + +fn core::iter::traits::iterator::Iterator::position<'_0, Self, P>(@1: &'_0 mut (Self), @2: P) -> core::option::Option +where + [@TraitClause2]: core::ops::function::FnMut, + (parents(@TraitClause2)::[@TraitClause0])::Output = bool, + +fn core::iter::traits::iterator::Iterator::max(@1: Self) -> core::option::Option +where + [@TraitClause1]: core::cmp::Ord, + +fn core::iter::traits::iterator::Iterator::min(@1: Self) -> core::option::Option +where + [@TraitClause1]: core::cmp::Ord, + +fn core::iter::traits::iterator::Iterator::rev(@1: Self) -> core::iter::adapters::rev::Rev +where + [@TraitClause1]: core::iter::traits::double_ended::DoubleEndedIterator, + +fn core::iter::traits::iterator::Iterator::unzip(@1: Self) -> (FromA, FromB) +where + [@TraitClause4]: core::default::Default, + [@TraitClause5]: core::iter::traits::collect::Extend, + [@TraitClause6]: core::default::Default, + [@TraitClause7]: core::iter::traits::collect::Extend, + [@TraitClause9]: core::iter::traits::iterator::Iterator, + @TraitClause9::Item = (A, B), + +fn core::iter::traits::iterator::Iterator::copied<'a, Self, T>(@1: Self) -> core::iter::adapters::copied::Copied +where + [@TraitClause2]: core::iter::traits::iterator::Iterator, + [@TraitClause3]: core::marker::Copy, + T : 'a, + @TraitClause2::Item = &'a (T), + +fn core::iter::traits::iterator::Iterator::cloned<'a, Self, T>(@1: Self) -> core::iter::adapters::cloned::Cloned +where + [@TraitClause2]: core::iter::traits::iterator::Iterator, + [@TraitClause3]: core::clone::Clone, + T : 'a, + @TraitClause2::Item = &'a (T), + +fn core::iter::traits::iterator::Iterator::cycle(@1: Self) -> core::iter::adapters::cycle::Cycle +where + [@TraitClause1]: core::clone::Clone, + +fn core::iter::traits::iterator::Iterator::array_chunks(@1: Self) -> core::iter::adapters::array_chunks::ArrayChunks + +fn core::iter::traits::iterator::Iterator::sum(@1: Self) -> S +where + [@TraitClause2]: core::iter::traits::accum::Sum, + +fn core::iter::traits::iterator::Iterator::product(@1: Self) -> P +where + [@TraitClause2]: core::iter::traits::accum::Product, + +fn core::iter::traits::iterator::Iterator::cmp(@1: Self, @2: I) -> core::cmp::Ordering +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + [@TraitClause2]: core::cmp::Ord, + @TraitClause1::Item = Self::Item, + +fn core::iter::traits::iterator::Iterator::cmp_by(@1: Self, @2: I, @3: F) -> core::cmp::Ordering +where + [@TraitClause3]: core::iter::traits::collect::IntoIterator, + [@TraitClause4]: core::ops::function::FnMut, + (parents(@TraitClause4)::[@TraitClause0])::Output = core::cmp::Ordering, + +fn core::iter::traits::iterator::Iterator::partial_cmp(@1: Self, @2: I) -> core::option::Option +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + [@TraitClause2]: core::cmp::PartialOrd, + +fn core::iter::traits::iterator::Iterator::partial_cmp_by(@1: Self, @2: I, @3: F) -> core::option::Option +where + [@TraitClause3]: core::iter::traits::collect::IntoIterator, + [@TraitClause4]: core::ops::function::FnMut, + (parents(@TraitClause4)::[@TraitClause0])::Output = core::option::Option, + +fn core::iter::traits::iterator::Iterator::eq(@1: Self, @2: I) -> bool +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + [@TraitClause2]: core::cmp::PartialEq, + +fn core::iter::traits::iterator::Iterator::eq_by(@1: Self, @2: I, @3: F) -> bool +where + [@TraitClause3]: core::iter::traits::collect::IntoIterator, + [@TraitClause4]: core::ops::function::FnMut, + (parents(@TraitClause4)::[@TraitClause0])::Output = bool, + +fn core::iter::traits::iterator::Iterator::ne(@1: Self, @2: I) -> bool +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + [@TraitClause2]: core::cmp::PartialEq, + +fn core::iter::traits::iterator::Iterator::lt(@1: Self, @2: I) -> bool +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + [@TraitClause2]: core::cmp::PartialOrd, + +fn core::iter::traits::iterator::Iterator::le(@1: Self, @2: I) -> bool +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + [@TraitClause2]: core::cmp::PartialOrd, + +fn core::iter::traits::iterator::Iterator::gt(@1: Self, @2: I) -> bool +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + [@TraitClause2]: core::cmp::PartialOrd, + +fn core::iter::traits::iterator::Iterator::ge(@1: Self, @2: I) -> bool +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + [@TraitClause2]: core::cmp::PartialOrd, + +fn core::iter::traits::iterator::Iterator::is_sorted(@1: Self) -> bool +where + [@TraitClause1]: core::cmp::PartialOrd, + +fn core::iter::traits::iterator::Iterator::is_sorted_by_key(@1: Self, @2: F) -> bool +where + [@TraitClause3]: core::ops::function::FnMut, + [@TraitClause4]: core::cmp::PartialOrd, + (parents(@TraitClause3)::[@TraitClause0])::Output = K, + +unsafe fn core::iter::traits::iterator::Iterator::__iterator_get_unchecked<'_0, Self>(@1: &'_0 mut (Self), @2: usize) -> Self::Item +where + [@TraitClause0]: core::iter::adapters::zip::TrustedRandomAccessNoCoerce, + +fn core::clone::Clone::clone<'_0, Self>(@1: &'_0 (Self)) -> Self + +fn core::clone::Clone::clone_from<'_0, '_1, Self>(@1: &'_0 mut (Self), @2: &'_1 (Self)) + +fn core::iter::traits::collect::IntoIterator::into_iter(@1: Self) -> Self::IntoIter + +fn core::ops::function::FnMut::call_mut<'_0, Self, Args>(@1: &'_0 mut (Self), @2: Args) -> (parents(Self)::[@TraitClause0])::Output + +fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> Self::Output + +fn core::iter::traits::collect::FromIterator::from_iter(@1: T) -> Self +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + @TraitClause1::Item = A, + +fn core::ops::try_trait::Try::from_output(@1: Self::Output) -> Self + +fn core::ops::try_trait::Try::branch(@1: Self) -> core::ops::control_flow::ControlFlow + +fn core::ops::try_trait::FromResidual::from_residual(@1: R) -> Self + +fn core::iter::traits::collect::Extend::extend<'_0, Self, A, T>(@1: &'_0 mut (Self), @2: T) +where + [@TraitClause1]: core::iter::traits::collect::IntoIterator, + @TraitClause1::Item = A, + +fn core::iter::traits::collect::Extend::extend_one<'_0, Self, A>(@1: &'_0 mut (Self), @2: A) + +fn core::iter::traits::collect::Extend::extend_reserve<'_0, Self, A>(@1: &'_0 mut (Self), @2: usize) + +unsafe fn core::iter::traits::collect::Extend::extend_one_unchecked<'_0, Self, A>(@1: &'_0 mut (Self), @2: A) + +fn core::cmp::Ord::cmp<'_0, '_1, Self>(@1: &'_0 (Self), @2: &'_1 (Self)) -> core::cmp::Ordering + +fn core::cmp::Ord::max(@1: Self, @2: Self) -> Self + +fn core::cmp::Ord::min(@1: Self, @2: Self) -> Self + +fn core::cmp::Ord::clamp(@1: Self, @2: Self, @3: Self) -> Self +where + [@TraitClause1]: core::cmp::PartialOrd, + +fn core::cmp::Eq::assert_receiver_is_total_eq<'_0, Self>(@1: &'_0 (Self)) + +fn core::cmp::PartialEq::eq<'_0, '_1, Self, Rhs>(@1: &'_0 (Self), @2: &'_1 (Rhs)) -> bool + +fn core::cmp::PartialEq::ne<'_0, '_1, Self, Rhs>(@1: &'_0 (Self), @2: &'_1 (Rhs)) -> bool + +fn core::cmp::PartialOrd::partial_cmp<'_0, '_1, Self, Rhs>(@1: &'_0 (Self), @2: &'_1 (Rhs)) -> core::option::Option + +fn core::cmp::PartialOrd::lt<'_0, '_1, Self, Rhs>(@1: &'_0 (Self), @2: &'_1 (Rhs)) -> bool + +fn core::cmp::PartialOrd::le<'_0, '_1, Self, Rhs>(@1: &'_0 (Self), @2: &'_1 (Rhs)) -> bool + +fn core::cmp::PartialOrd::gt<'_0, '_1, Self, Rhs>(@1: &'_0 (Self), @2: &'_1 (Rhs)) -> bool + +fn core::cmp::PartialOrd::ge<'_0, '_1, Self, Rhs>(@1: &'_0 (Self), @2: &'_1 (Rhs)) -> bool + +fn core::iter::traits::double_ended::DoubleEndedIterator::next_back<'_0, Self>(@1: &'_0 mut (Self)) -> core::option::Option<(parents(Self)::[@TraitClause0])::Item> + +fn core::iter::traits::double_ended::DoubleEndedIterator::advance_back_by<'_0, Self>(@1: &'_0 mut (Self), @2: usize) -> core::result::Result<(), core::num::nonzero::NonZero> + +fn core::iter::traits::double_ended::DoubleEndedIterator::nth_back<'_0, Self>(@1: &'_0 mut (Self), @2: usize) -> core::option::Option<(parents(Self)::[@TraitClause0])::Item> + +fn core::iter::traits::double_ended::DoubleEndedIterator::try_rfold<'_0, Self, B, F, R>(@1: &'_0 mut (Self), @2: B, @3: F) -> R +where + [@TraitClause4]: core::ops::function::FnMut, + [@TraitClause5]: core::ops::try_trait::Try, + (parents(@TraitClause4)::[@TraitClause0])::Output = R, + @TraitClause5::Output = B, + +fn core::iter::traits::double_ended::DoubleEndedIterator::rfold(@1: Self, @2: B, @3: F) -> B +where + [@TraitClause3]: core::ops::function::FnMut, + (parents(@TraitClause3)::[@TraitClause0])::Output = B, + +fn core::default::Default::default() -> Self + +fn core::iter::traits::accum::Sum::sum(@1: I) -> Self +where + [@TraitClause1]: core::iter::traits::iterator::Iterator, + @TraitClause1::Item = A, + +fn core::iter::traits::accum::Product::product(@1: I) -> Self +where + [@TraitClause1]: core::iter::traits::iterator::Iterator, + @TraitClause1::Item = A, + +fn core::iter::adapters::zip::TrustedRandomAccessNoCoerce::size<'_0, Self>(@1: &'_0 (Self)) -> usize +where + [@TraitClause0]: core::iter::traits::iterator::Iterator, + +fn core::iter::traits::exact_size::ExactSizeIterator::len<'_0, Self>(@1: &'_0 (Self)) -> usize + +fn core::iter::traits::exact_size::ExactSizeIterator::is_empty<'_0, Self>(@1: &'_0 (Self)) -> bool + + + diff --git a/charon/tests/ui/unsupported/issue-79-bound-regions.rs b/charon/tests/ui/unsupported/issue-79-bound-regions.rs index 90aa16fc..8261a893 100644 --- a/charon/tests/ui/unsupported/issue-79-bound-regions.rs +++ b/charon/tests/ui/unsupported/issue-79-bound-regions.rs @@ -1,5 +1,3 @@ -//@ known-failure -//@ no-check-output fn main() { let slice: &[i32] = &[0]; let _ = slice.iter().next(); From f2e3300c13aa3facd286d92abfab2e5c8921abe8 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 23 Sep 2024 17:24:48 +0200 Subject: [PATCH 7/8] Don't crash on type aliases that lack the right trait bounds --- .../charon-driver/translate/translate_ctx.rs | 4 ++++ .../translate/translate_predicates.rs | 18 ++++++++++-------- .../charon-driver/translate/translate_types.rs | 2 ++ charon/tests/ui/type_alias.out | 2 ++ charon/tests/ui/type_alias.rs | 1 + 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/charon/src/bin/charon-driver/translate/translate_ctx.rs b/charon/src/bin/charon-driver/translate/translate_ctx.rs index de064ac3..a54fb058 100644 --- a/charon/src/bin/charon-driver/translate/translate_ctx.rs +++ b/charon/src/bin/charon-driver/translate/translate_ctx.rs @@ -237,6 +237,9 @@ pub(crate) struct BodyTransCtx<'tcx, 'ctx, 'ctx1> { pub t_ctx: &'ctx mut TranslateCtx<'tcx, 'ctx1>, /// A hax state with an owner id pub hax_state: hax::StateWithOwner<'tcx>, + /// Whether to consider a `ImplExprAtom::Error` as an error for us. True except inside type + /// aliases, because rust does not enforce correct trait bounds on type aliases. + pub error_on_impl_expr_error: bool, /// The regions. /// We use DeBruijn indices, so we have a stack of regions. @@ -904,6 +907,7 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { def_id, t_ctx, hax_state, + error_on_impl_expr_error: true, region_vars: [Vector::new()].into(), free_region_vars: Default::default(), bound_region_vars: Default::default(), diff --git a/charon/src/bin/charon-driver/translate/translate_predicates.rs b/charon/src/bin/charon-driver/translate/translate_predicates.rs index 110f1357..84b17ddd 100644 --- a/charon/src/bin/charon-driver/translate/translate_predicates.rs +++ b/charon/src/bin/charon-driver/translate/translate_predicates.rs @@ -433,16 +433,18 @@ impl<'tcx, 'ctx, 'ctx1> BodyTransCtx<'tcx, 'ctx, 'ctx1> { trait_decl_ref, }, ImplExprAtom::Error(msg) => { - let error = format!("Error during trait resolution: {}", msg); - self.span_err(span, &error); - if !self.t_ctx.continue_on_failure() { - panic!("{}", error) - } else { - TraitRef { - kind: TraitRefKind::Unknown(msg.clone()), - trait_decl_ref, + let trait_ref = TraitRef { + kind: TraitRefKind::Unknown(msg.clone()), + trait_decl_ref, + }; + if self.error_on_impl_expr_error { + let error = format!("Error during trait resolution: {}", msg); + self.span_err(span, &error); + if !self.t_ctx.continue_on_failure() { + panic!("{}", error) } } + trait_ref } }; Ok(Some(trait_ref)) diff --git a/charon/src/bin/charon-driver/translate/translate_types.rs b/charon/src/bin/charon-driver/translate/translate_types.rs index 1ef644e7..b318a41c 100644 --- a/charon/src/bin/charon-driver/translate/translate_types.rs +++ b/charon/src/bin/charon-driver/translate/translate_types.rs @@ -755,6 +755,8 @@ impl<'tcx, 'ctx> TranslateCtx<'tcx, 'ctx> { _ if item_meta.opacity.is_opaque() => Ok(TypeDeclKind::Opaque), hax::FullDefKind::OpaqueTy | hax::FullDefKind::ForeignTy => Ok(TypeDeclKind::Opaque), hax::FullDefKind::TyAlias { ty, .. } => { + // Don't error on missing trait refs. + bt_ctx.error_on_impl_expr_error = false; // We only translate crate-local type aliases so the `unwrap` is ok. let ty = ty.as_ref().unwrap(); bt_ctx diff --git a/charon/tests/ui/type_alias.out b/charon/tests/ui/type_alias.out index ed7617cb..c07211aa 100644 --- a/charon/tests/ui/type_alias.out +++ b/charon/tests/ui/type_alias.out @@ -68,6 +68,8 @@ type test_crate::Generic2<'a, T> where [@TraitClause1]: core::clone::Clone, = alloc::borrow::Cow<'a, Slice, alloc::slice::{impl alloc::borrow::ToOwned for Slice}#9[@TraitClause1]> +type test_crate::GenericWithoutBound<'a, T> = alloc::borrow::Cow<'a, Slice, UNKNOWN(Could not find a clause for `Binder { value: <[T] as std::borrow::ToOwned>, bound_vars: [] }` in the current context: `Unimplemented`)> + fn alloc::borrow::ToOwned::to_owned<'_0, Self>(@1: &'_0 (Self)) -> Self::Owned fn alloc::borrow::ToOwned::clone_into<'_0, '_1, Self>(@1: &'_0 (Self), @2: &'_1 mut (Self::Owned)) diff --git a/charon/tests/ui/type_alias.rs b/charon/tests/ui/type_alias.rs index 27970b1f..e08f21d8 100644 --- a/charon/tests/ui/type_alias.rs +++ b/charon/tests/ui/type_alias.rs @@ -2,3 +2,4 @@ use std::borrow::Cow; type Foo = usize; type Generic<'a, T> = &'a T; type Generic2<'a, T: Clone> = Cow<'a, [T]>; +type GenericWithoutBound<'a, T> = Cow<'a, [T]>; From aec7312164f5f9d68ac432053f35e293de52ef01 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Mon, 30 Sep 2024 17:36:13 +0200 Subject: [PATCH 8/8] Update charon-ml --- charon-ml/src/CharonVersion.ml | 2 +- charon-ml/src/GAstOfJson.ml | 42 +++++++++---- charon-ml/src/NameMatcher.ml | 62 ++++++++++++++----- charon-ml/src/PrintTypes.ml | 32 ++++++++-- charon-ml/src/Substitute.ml | 25 +++++++- charon-ml/src/Types.ml | 57 +++++++++++++---- charon/Cargo.lock | 2 +- charon/Cargo.toml | 2 +- charon/src/bin/generate-ml/main.rs | 8 +-- charon/src/bin/generate-ml/templates/Types.ml | 38 +++++++++++- 10 files changed, 211 insertions(+), 59 deletions(-) diff --git a/charon-ml/src/CharonVersion.ml b/charon-ml/src/CharonVersion.ml index d55e2e36..6b3e4886 100644 --- a/charon-ml/src/CharonVersion.ml +++ b/charon-ml/src/CharonVersion.ml @@ -1,3 +1,3 @@ (* This is an automatically generated file, generated from `charon/Cargo.toml`. *) (* To re-generate this file, rune `make` in the root directory *) -let supported_charon_version = "0.1.42" +let supported_charon_version = "0.1.43" diff --git a/charon-ml/src/GAstOfJson.ml b/charon-ml/src/GAstOfJson.ml index ff6576f6..e7bd45c0 100644 --- a/charon-ml/src/GAstOfJson.ml +++ b/charon-ml/src/GAstOfJson.ml @@ -770,10 +770,6 @@ and global_decl_id_of_json (js : json) : (global_decl_id, string) result = combine_error_msgs js __FUNCTION__ (match js with x -> GlobalDeclId.id_of_json x | _ -> Error "") -and unsolved_trait_id_of_json (js : json) : (unsolved_trait_id, string) result = - combine_error_msgs js __FUNCTION__ - (match js with x -> UnsolvedTraitId.id_of_json x | _ -> Error "") - and type_var_of_json (js : json) : (type_var, string) result = combine_error_msgs js __FUNCTION__ (match js with @@ -830,10 +826,12 @@ and trait_instance_id_of_json (js : json) : (trait_instance_id, string) result = Ok (ParentClause (x_0, x_1, x_2)) | `String "SelfId" -> Ok Self | `Assoc [ ("BuiltinOrAuto", builtin_or_auto) ] -> - let* builtin_or_auto = trait_decl_ref_of_json builtin_or_auto in + let* builtin_or_auto = + region_binder_of_json trait_decl_ref_of_json builtin_or_auto + in Ok (BuiltinOrAuto builtin_or_auto) | `Assoc [ ("Dyn", dyn) ] -> - let* dyn = trait_decl_ref_of_json dyn in + let* dyn = region_binder_of_json trait_decl_ref_of_json dyn in Ok (Dyn dyn) | `Assoc [ ("Unknown", unknown) ] -> let* unknown = string_of_json unknown in @@ -845,7 +843,9 @@ and trait_ref_of_json (js : json) : (trait_ref, string) result = (match js with | `Assoc [ ("kind", kind); ("trait_decl_ref", trait_decl_ref) ] -> let* trait_id = trait_instance_id_of_json kind in - let* trait_decl_ref = trait_decl_ref_of_json trait_decl_ref in + let* trait_decl_ref = + region_binder_of_json trait_decl_ref_of_json trait_decl_ref + in Ok ({ trait_id; trait_decl_ref } : trait_ref) | _ -> Error "") @@ -909,6 +909,22 @@ and generic_args_of_json (js : json) : (generic_args, string) result = Ok ({ regions; types; const_generics; trait_refs } : generic_args) | _ -> Error "") +and region_binder_of_json : + 'a0. + (json -> ('a0, string) result) -> + json -> + ('a0 region_binder, string) result = + fun arg0_of_json js -> + combine_error_msgs js __FUNCTION__ + (match js with + | `Assoc [ ("regions", regions); ("skip_binder", skip_binder) ] -> + let* binder_regions = + vector_of_json region_id_of_json region_var_of_json regions + in + let* binder_value = arg0_of_json skip_binder in + Ok ({ binder_regions; binder_value } : _ region_binder) + | _ -> Error "") + and generic_params_of_json (id_to_file : id_to_file_map) (js : json) : (generic_params, string) result = combine_error_msgs js __FUNCTION__ @@ -940,16 +956,20 @@ and generic_params_of_json (id_to_file : id_to_file_map) (js : json) : in let* regions_outlive = list_of_json - (outlives_pred_of_json region_of_json region_of_json) + (region_binder_of_json + (outlives_pred_of_json region_of_json region_of_json)) regions_outlive in let* types_outlive = list_of_json - (outlives_pred_of_json ty_of_json region_of_json) + (region_binder_of_json + (outlives_pred_of_json ty_of_json region_of_json)) types_outlive in let* trait_type_constraints = - list_of_json trait_type_constraint_of_json trait_type_constraints + list_of_json + (region_binder_of_json trait_type_constraint_of_json) + trait_type_constraints in Ok ({ @@ -994,7 +1014,7 @@ and trait_clause_of_json (id_to_file : id_to_file_map) (js : json) : ] -> let* clause_id = trait_clause_id_of_json clause_id in let* span = option_of_json (span_of_json id_to_file) span in - let* trait = trait_decl_ref_of_json trait in + let* trait = region_binder_of_json trait_decl_ref_of_json trait in Ok ({ clause_id; span; trait } : trait_clause) | _ -> Error "") diff --git a/charon-ml/src/NameMatcher.ml b/charon-ml/src/NameMatcher.ml index 24f0e6ee..ed315b3b 100644 --- a/charon-ml/src/NameMatcher.ml +++ b/charon-ml/src/NameMatcher.ml @@ -295,6 +295,12 @@ let maps_push_bound_regions_group (m : maps) : maps = in { m with rmap } +(** Push a group of bound regions if the group is non-empty - TODO: make this + more precise *) +let maps_push_bound_regions_group_if_nonempty (m : maps) (regions : 'a list) : + maps = + match regions with [] -> m | _ -> maps_push_bound_regions_group m + (** Update a map and check that there are no incompatible constraints at the same time. *) let update_map (find_opt : 'a -> 'm -> 'b option) (add : 'a -> 'b -> 'm -> 'm) @@ -500,10 +506,10 @@ and match_expr_with_ty (ctx : ctx) (c : match_config) (m : maps) (pty : expr) && match_ref_kind prk rk | EVar v, _ -> opt_update_tmap c m v ty | EComp pid, TTraitType (trait_ref, type_name) -> - match_trait_type ctx c pid trait_ref type_name - | EArrow (pinputs, pout), TArrow (_, inputs, out) -> ( - (* Push a region group in the map *) - let m = maps_push_bound_regions_group m in + match_trait_type ctx c m pid trait_ref type_name + | EArrow (pinputs, pout), TArrow (regions, inputs, out) -> ( + (* Push a region group in the map, if necessary - TODO: make this more precise *) + let m = maps_push_bound_regions_group_if_nonempty m regions in (* Match *) List.for_all2 (match_expr_with_ty ctx c m) pinputs inputs && @@ -530,24 +536,30 @@ and match_expr_with_trait_impl_id (ctx : ctx) (c : match_config) (ptr : expr) impl.impl_trait.decl_generics | EPrimAdt _ | ERef _ | EVar _ | EArrow _ | ERawPtr _ -> false -and match_trait_ref (ctx : ctx) (c : match_config) (pid : pattern) +and match_trait_ref (ctx : ctx) (c : match_config) (m : maps) (pid : pattern) (tr : T.trait_ref) : bool = (* Lookup the trait declaration *) let d = - T.TraitDeclId.Map.find tr.trait_decl_ref.trait_decl_id ctx.trait_decls + T.TraitDeclId.Map.find tr.trait_decl_ref.binder_value.trait_decl_id + ctx.trait_decls + in + (* Push a region group in the map, if necessary - TODO: make this more precise *) + let m = + maps_push_bound_regions_group_if_nonempty m tr.trait_decl_ref.binder_regions in (* Match the trait decl ref *) - match_name_with_generics ctx c pid d.item_meta.name - tr.trait_decl_ref.decl_generics + match_name_with_generics ctx c ~m pid d.item_meta.name + tr.trait_decl_ref.binder_value.decl_generics -and match_trait_ref_item (ctx : ctx) (c : match_config) (pid : pattern) - (tr : T.trait_ref) (item_name : string) (generics : T.generic_args) : bool = +and match_trait_ref_item (ctx : ctx) (c : match_config) (m : maps) + (pid : pattern) (tr : T.trait_ref) (item_name : string) + (generics : T.generic_args) : bool = if c.match_with_trait_decl_refs then (* We match the trait decl ref *) (* We split the pattern between the trait decl ref and the associated item name *) let pid, pitem_name = Collections.List.pop_last pid in (* Match the trait ref *) - match_trait_ref ctx c pid tr + match_trait_ref ctx c m pid tr && (* Match the item name *) match pitem_name with @@ -557,9 +569,9 @@ and match_trait_ref_item (ctx : ctx) (c : match_config) (pid : pattern) | _ -> false else raise (Failure "Unimplemented") -and match_trait_type (ctx : ctx) (c : match_config) (pid : pattern) +and match_trait_type (ctx : ctx) (c : match_config) (m : maps) (pid : pattern) (tr : T.trait_ref) (type_name : string) : bool = - match_trait_ref_item ctx c pid tr type_name TypesUtils.empty_generic_args + match_trait_ref_item ctx c m pid tr type_name TypesUtils.empty_generic_args and match_generic_args (ctx : ctx) (c : match_config) (m : maps) (pgenerics : generic_args) (generics : T.generic_args) : bool = @@ -662,7 +674,8 @@ let match_fn_ptr (ctx : ctx) (c : match_config) (p : pattern) (func : E.fn_ptr) let d = A.FunDeclId.Map.find fid ctx.fun_decls in match_name_with_generics ctx c p d.item_meta.name func.generics | TraitMethod (tr, method_name, _) -> - match_trait_ref_item ctx c p tr method_name func.generics + match_trait_ref_item ctx c (mk_empty_maps ()) p tr method_name + func.generics let mk_name_with_generics_matcher (ctx : ctx) (c : match_config) (pat : string) : T.name -> T.generic_args -> bool = @@ -773,6 +786,12 @@ let constraints_map_push_regions_map (m : constraints) let rmap = constraints_map_compute_regions_map regions in { m with rmap = rmap :: m.rmap } +(** Push a regions map to the constraints map, if the group of regions + is non-empty - TODO: do something more precise *) +let constraints_map_push_regions_map_if_nonempty (m : constraints) + (regions : T.region_var list) : constraints = + match regions with [] -> m | _ -> constraints_map_push_regions_map m regions + type to_pat_config = { tgt : target_kind; use_trait_decl_refs : bool; (** See {!match_with_trait_decl_refs} *) @@ -868,7 +887,8 @@ and ty_to_pattern_aux (ctx : ctx) (c : to_pat_config) (m : constraints) in EComp name | TArrow (regions, inputs, out) -> - let m = constraints_map_push_regions_map m regions in + (* Push a regions map if necessary - TODO: make this more precise *) + let m = constraints_map_push_regions_map_if_nonempty m regions in let inputs = List.map (ty_to_pattern_aux ctx c m) inputs in let out = if out = TypesUtils.mk_unit_ty then None @@ -886,9 +906,17 @@ and trait_ref_item_with_generics_to_pattern (ctx : ctx) (c : to_pat_config) if c.use_trait_decl_refs then let trait_decl_ref = trait_ref.trait_decl_ref in let d = - T.TraitDeclId.Map.find trait_decl_ref.trait_decl_id ctx.trait_decls + T.TraitDeclId.Map.find trait_decl_ref.binder_value.trait_decl_id + ctx.trait_decls + in + (* Push a regions map if necessary - TODO: make this more precise *) + let m = + constraints_map_push_regions_map_if_nonempty m + trait_decl_ref.binder_regions + in + let g = + generic_args_to_pattern ctx c m trait_decl_ref.binder_value.decl_generics in - let g = generic_args_to_pattern ctx c m trait_decl_ref.decl_generics in let name = name_with_generic_args_to_pattern_aux ctx c d.item_meta.name (Some g) in diff --git a/charon-ml/src/PrintTypes.ml b/charon-ml/src/PrintTypes.ml index cd030fb6..f05f66b0 100644 --- a/charon-ml/src/PrintTypes.ml +++ b/charon-ml/src/PrintTypes.ml @@ -95,6 +95,17 @@ let region_to_string (env : ('a, 'b) fmt_env) (r : region) : string = let trait_clause_id_to_string _ id = trait_clause_id_to_pretty_string id +let region_binder_to_string (value_to_string : ('a, 'b) fmt_env -> 'c -> string) + (env : ('a, 'b) fmt_env) (rb : 'c region_binder) : string = + let env = fmt_env_push_regions env rb.binder_regions in + let value = value_to_string env rb.binder_value in + match rb.binder_regions with + | [] -> value + | _ -> + "for <" + ^ String.concat "," (List.map region_var_to_string rb.binder_regions) + ^ "> " ^ value + let rec type_id_to_string (env : ('a, 'b) fmt_env) (id : type_id) : string = match id with | TAdtId id -> type_decl_id_to_string env id @@ -231,7 +242,8 @@ and trait_instance_id_to_string (env : ('a, 'b) fmt_env) let impl = trait_impl_id_to_string env id in let generics = generic_args_to_string env generics in impl ^ generics - | BuiltinOrAuto trait -> trait_decl_ref_to_string env trait + | BuiltinOrAuto trait -> + region_binder_to_string trait_decl_ref_to_string env trait | Clause id -> trait_clause_id_to_string env id | ParentClause (inst_id, _decl_id, clause_id) -> let inst_id = trait_instance_id_to_string env inst_id in @@ -244,7 +256,7 @@ and trait_instance_id_to_string (env : ('a, 'b) fmt_env) ^ generic_args_to_string env generics ^ ")" | Dyn trait -> - let trait = trait_decl_ref_to_string env trait in + let trait = region_binder_to_string trait_decl_ref_to_string env trait in "dyn(" ^ trait ^ ")" | Unsolved (decl_id, generics) -> "unsolved(" @@ -302,7 +314,9 @@ and raw_attribute_to_string (attr : raw_attribute) : string = let trait_clause_to_string (env : ('a, 'b) fmt_env) (clause : trait_clause) : string = let clause_id = trait_clause_id_to_string env clause.clause_id in - let trait = trait_decl_ref_to_string env clause.trait in + let trait = + region_binder_to_string trait_decl_ref_to_string env clause.trait + in "[" ^ clause_id ^ "]: " ^ trait let generic_params_to_strings (env : ('a, 'b) fmt_env) @@ -363,18 +377,24 @@ let predicates_and_trait_clauses_to_string (env : ('a, 'b) fmt_env) let params, trait_clauses = generic_params_to_strings env generics in let region_to_string = region_to_string env in let regions_outlive = + let outlive_to_string _ (x, y) = + region_to_string x ^ " : " ^ region_to_string y + in List.map - (fun (x, y) -> region_to_string x ^ " : " ^ region_to_string y) + (region_binder_to_string outlive_to_string env) generics.regions_outlive in let types_outlive = + let outlive_to_string _ (x, y) = + ty_to_string env x ^ " : " ^ region_to_string y + in List.map - (fun (x, y) -> ty_to_string env x ^ " : " ^ region_to_string y) + (region_binder_to_string outlive_to_string env) generics.types_outlive in let trait_type_constraints = List.map - (trait_type_constraint_to_string env) + (region_binder_to_string trait_type_constraint_to_string env) generics.trait_type_constraints in (* Split between the inherited clauses and the local clauses *) diff --git a/charon-ml/src/Substitute.ml b/charon-ml/src/Substitute.ml index e1ddead8..1f3b834d 100644 --- a/charon-ml/src/Substitute.ml +++ b/charon-ml/src/Substitute.ml @@ -48,6 +48,20 @@ let st_substitute_visitor (subst : subst) = let output = self#visit_ty subst output in TArrow (regions, inputs, output) + (** We need to properly handle the DeBruijn indices *) + method! visit_region_binder visit_value subst x = + (* Decrement the DeBruijn indices before calling the substitution *) + let r_subst r = + match r with + | RBVar (db, rid) -> subst.r_subst (RBVar (db - 1, rid)) + | _ -> subst.r_subst r + in + let subst = { subst with r_subst } in + (* Note that we ignore the bound regions variables *) + let { binder_regions; binder_value } = x in + let binder_value = visit_value subst binder_value in + { binder_regions; binder_value } + method! visit_TVar (subst : subst) id = subst.ty_subst id method! visit_CgVar _ id = subst.cg_subst id method! visit_Clause (subst : subst) id = subst.tr_subst id @@ -111,11 +125,16 @@ let predicates_substitute (subst : subst) (p : generic_params) : generic_params const_generics; trait_clauses = List.map (visitor#visit_trait_clause subst) trait_clauses; regions_outlive = - List.map (visitor#visit_region_outlives subst) regions_outlive; - types_outlive = List.map (visitor#visit_type_outlives subst) types_outlive; + List.map + (visitor#visit_region_binder visitor#visit_region_outlives subst) + regions_outlive; + types_outlive = + List.map + (visitor#visit_region_binder visitor#visit_type_outlives subst) + types_outlive; trait_type_constraints = List.map - (visitor#visit_trait_type_constraint subst) + (visitor#visit_region_binder visitor#visit_trait_type_constraint subst) trait_type_constraints; } diff --git a/charon-ml/src/Types.ml b/charon-ml/src/Types.ml index 0c89f80d..bb926118 100644 --- a/charon-ml/src/Types.ml +++ b/charon-ml/src/Types.ml @@ -57,7 +57,6 @@ and field_id = FieldId.id and region_id = RegionId.id and const_generic_var_id = ConstGenericVarId.id and global_decl_id = GlobalDeclId.id -and unsolved_trait_id = UnsolvedTraitId.id and trait_clause_id = TraitClauseId.id and trait_decl_id = TraitDeclId.id and trait_impl_id = TraitImplId.id [@@deriving show, ord] @@ -244,6 +243,14 @@ type const_generic = nude = true (* Don't inherit VisitorsRuntime *); }] +(** Region variable. *) +type region_var = (region_var_id, string option) indexed_var +[@@deriving show, ord] + +(** A value of type `'a` bound by generic parameters. *) +type 'a region_binder = { binder_regions : region_var list; binder_value : 'a } +[@@deriving show, ord] + (** Ancestor for iter visitor for {!type: Types.ty} *) class ['self] iter_ty_base_base = object (self : 'self) @@ -272,6 +279,18 @@ class ['self] iter_ty_base_base = let left, right = x in visit_left env left; visit_right env right + + method visit_region_var env (x : region_var) = + self#visit_indexed_var self#visit_region_var_id + (self#visit_option self#visit_string) + env x + + method visit_region_binder + : 'a. ('env -> 'a -> unit) -> 'env -> 'a region_binder -> unit = + fun visit_binder_value env x -> + let { binder_regions; binder_value } = x in + self#visit_list self#visit_region_var env binder_regions; + visit_binder_value env binder_value end (** Ancestor for map visitor for {!type: Types.ty} *) @@ -304,6 +323,22 @@ class virtual ['self] map_ty_base_base = let left = visit_left env left in let right = visit_right env right in (left, right) + + method visit_region_var env (x : region_var) = + self#visit_indexed_var self#visit_region_var_id + (self#visit_option self#visit_string) + env x + + method visit_region_binder + : 'a. ('env -> 'a -> 'a) -> 'env -> 'a region_binder -> 'a region_binder + = + fun visit_binder_value env x -> + let { binder_regions; binder_value } = x in + let binder_regions = + self#visit_list self#visit_region_var env binder_regions + in + let binder_value = visit_binder_value env binder_value in + { binder_regions; binder_value } end (** Reference to a global declaration. *) @@ -314,9 +349,6 @@ type global_decl_ref = { and trait_item_name = string -(** Region variable. *) -and region_var = (region_var_id, string option) indexed_var - and region = | RStatic (** Static region *) | RBVar of region_db_id * region_var_id @@ -337,22 +369,23 @@ and trait_instance_id = | Self (** Reference to *self*, in case of trait declarations/implementations *) | TraitImpl of trait_impl_id * generic_args (** A specific implementation *) - | BuiltinOrAuto of trait_decl_ref + | BuiltinOrAuto of trait_decl_ref region_binder | Clause of trait_clause_id | ParentClause of trait_instance_id * trait_decl_id * trait_clause_id | FnPointer of ty | Closure of fun_decl_id * generic_args - | Dyn of trait_decl_ref + | Dyn of trait_decl_ref region_binder | Unsolved of trait_decl_id * generic_args | UnknownTrait of string (** A reference to a trait *) and trait_ref = { trait_id : trait_instance_id; - trait_decl_ref : trait_decl_ref; (** Not necessary, but useful *) + trait_decl_ref : trait_decl_ref region_binder; + (** Not necessary, but useful *) } -(** Reference to a trait declaration. +(** A predicate of the form `Type: Trait`. About the generics, if we write: ```text @@ -553,11 +586,11 @@ and generic_params = { types : type_var list; const_generics : const_generic_var list; trait_clauses : trait_clause list; - regions_outlive : (region, region) outlives_pred list; + regions_outlive : (region, region) outlives_pred region_binder list; (** The first region in the pair outlives the second region *) - types_outlive : (ty, region) outlives_pred list; + types_outlive : (ty, region) outlives_pred region_binder list; (** The type outlives the region *) - trait_type_constraints : trait_type_constraint list; + trait_type_constraints : trait_type_constraint region_binder list; (** Constraints over trait associated types *) } @@ -569,7 +602,7 @@ and trait_clause = { to a parameter. *) span : span option; - trait : trait_decl_ref; (** The trait that is implemented. *) + trait : trait_decl_ref region_binder; (** The trait that is implemented. *) } [@@deriving show, diff --git a/charon/Cargo.lock b/charon/Cargo.lock index e36f9a58..5e643627 100644 --- a/charon/Cargo.lock +++ b/charon/Cargo.lock @@ -179,7 +179,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "charon" -version = "0.1.42" +version = "0.1.43" dependencies = [ "anyhow", "assert_cmd", diff --git a/charon/Cargo.toml b/charon/Cargo.toml index a1a02887..2e0cc414 100644 --- a/charon/Cargo.toml +++ b/charon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "charon" -version = "0.1.42" +version = "0.1.43" authors = ["Son Ho "] edition = "2021" license = "Apache-2.0" diff --git a/charon/src/bin/generate-ml/main.rs b/charon/src/bin/generate-ml/main.rs index 2e72db04..ff804b7c 100644 --- a/charon/src/bin/generate-ml/main.rs +++ b/charon/src/bin/generate-ml/main.rs @@ -1041,12 +1041,12 @@ fn generate_ml(crate_data: TranslatedCrate, output_dir: PathBuf) -> anyhow::Resu | Self (** Reference to *self*, in case of trait declarations/implementations *) | TraitImpl of trait_impl_id * generic_args (** A specific implementation *) - | BuiltinOrAuto of trait_decl_ref + | BuiltinOrAuto of trait_decl_ref region_binder | Clause of trait_clause_id | ParentClause of trait_instance_id * trait_decl_id * trait_clause_id | FnPointer of ty | Closure of fun_decl_id * generic_args - | Dyn of trait_decl_ref + | Dyn of trait_decl_ref region_binder | Unsolved of trait_decl_id * generic_args | UnknownTrait of string " @@ -1347,7 +1347,6 @@ fn generate_ml(crate_data: TranslatedCrate, output_dir: PathBuf) -> anyhow::Resu "TraitImplId", "TypeDeclId", "TypeVarId", - "UnsolvedTraitId", "VariantId", ]), (GenerationKind::TypeDecl(Some(DeriveVisitors { @@ -1370,7 +1369,7 @@ fn generate_ml(crate_data: TranslatedCrate, output_dir: PathBuf) -> anyhow::Resu })), &[ "ConstGeneric", ]), - // Can't merge into aboce because aeneas uses the above alongside their own partial + // Can't merge into above because aeneas uses the above alongside their own partial // copy of `ty`, which causes method type clashes. (GenerationKind::TypeDecl(Some(DeriveVisitors { name: "ty", @@ -1382,7 +1381,6 @@ fn generate_ml(crate_data: TranslatedCrate, output_dir: PathBuf) -> anyhow::Resu "BuiltinTy", "TypeId", "ExistentialPredicate", - "RegionVar", "RefKind", "Ty", "Region", diff --git a/charon/src/bin/generate-ml/templates/Types.ml b/charon/src/bin/generate-ml/templates/Types.ml index 7f07233e..637e9f49 100644 --- a/charon/src/bin/generate-ml/templates/Types.ml +++ b/charon/src/bin/generate-ml/templates/Types.ml @@ -64,6 +64,14 @@ let option_some_id = VariantId.of_int 1 (* __REPLACE1__ *) +(** Region variable. *) +type region_var = (region_var_id, string option) indexed_var +[@@deriving show, ord] + +(** A value of type `'a` bound by generic parameters. *) +type 'a region_binder = { binder_regions : region_var list; binder_value : 'a } +[@@deriving show, ord] + (** Ancestor for iter visitor for {!type: Types.ty} *) class ['self] iter_ty_base_base = object (self : 'self) @@ -89,9 +97,21 @@ class ['self] iter_ty_base_base = ('l, 'r) outlives_pred -> unit = fun visit_left visit_right env x -> - let (left, right) = x in + let left, right = x in visit_left env left; visit_right env right + + method visit_region_var env (x : region_var) = + self#visit_indexed_var self#visit_region_var_id + (self#visit_option self#visit_string) + env x + + method visit_region_binder + : 'a. ('env -> 'a -> unit) -> 'env -> 'a region_binder -> unit = + fun visit_binder_value env x -> + let { binder_regions; binder_value } = x in + self#visit_list self#visit_region_var env binder_regions; + visit_binder_value env binder_value end (** Ancestor for map visitor for {!type: Types.ty} *) @@ -120,10 +140,24 @@ class virtual ['self] map_ty_base_base = ('l, 'r) outlives_pred -> ('l, 'r) outlives_pred = fun visit_left visit_right env x -> - let (left, right) = x in + let left, right = x in let left = visit_left env left in let right = visit_right env right in (left, right) + + method visit_region_var env (x : region_var) = + self#visit_indexed_var self#visit_region_var_id + (self#visit_option self#visit_string) + env x + + method visit_region_binder + : 'a. ('env -> 'a -> 'a) -> 'env -> 'a region_binder -> 'a region_binder + = + fun visit_binder_value env x -> + let { binder_regions; binder_value } = x in + let binder_regions = self#visit_list self#visit_region_var env binder_regions in + let binder_value = visit_binder_value env binder_value in + { binder_regions; binder_value } end (* __REPLACE2__ *)