diff --git a/crates/flux-infer/src/projections.rs b/crates/flux-infer/src/projections.rs index 24fa03dc5b6..18293ba5838 100644 --- a/crates/flux-infer/src/projections.rs +++ b/crates/flux-infer/src/projections.rs @@ -223,7 +223,7 @@ impl<'a, 'infcx, 'genv, 'tcx> Normalizer<'a, 'infcx, 'genv, 'tcx> { let assoc_type_id = tcx .associated_items(impl_def_id) .in_definition_order() - .find(|item| item.trait_item_def_id == Some(obligation.def_id)) + .find(|item| item.trait_item_def_id() == Some(obligation.def_id)) .map(|item| item.def_id) .ok_or_else(|| { query_bug!("no associated type for {obligation:?} in impl {impl_def_id:?}") @@ -368,7 +368,7 @@ impl<'a, 'infcx, 'genv, 'tcx> Normalizer<'a, 'infcx, 'genv, 'tcx> { candidates: &mut Vec, ) -> QueryResult { let trait_ref = obligation.to_rustc(self.tcx()).trait_ref(self.tcx()); - let trait_ref = self.tcx().erase_regions(trait_ref); + let trait_ref = self.tcx().erase_and_anonymize_regions(trait_ref); let trait_pred = Obligation::new( self.tcx(), ObligationCause::dummy(), @@ -727,7 +727,7 @@ fn normalize_projection_ty_with_rustc<'tcx>( ) -> QueryResult<(bool, SubsetTyCtor)> { let tcx = genv.tcx(); let projection_ty = obligation.to_rustc(tcx); - let projection_ty = tcx.erase_regions(projection_ty); + let projection_ty = tcx.erase_and_anonymize_regions(projection_ty); let cause = ObligationCause::dummy(); let param_env = tcx.param_env(def_id); @@ -813,7 +813,7 @@ fn get_impl_data_for_alias_reft<'tcx>( let tcx = infcx.tcx; let mut selcx = SelectionContext::new(infcx); let trait_ref = alias_reft.to_rustc_trait_ref(tcx); - let trait_ref = tcx.erase_regions(trait_ref); + let trait_ref = tcx.erase_and_anonymize_regions(trait_ref); let trait_pred = Obligation::new(tcx, ObligationCause::dummy(), tcx.param_env(def_id), trait_ref); match selcx.select(&trait_pred) { diff --git a/crates/flux-middle/src/rty/mod.rs b/crates/flux-middle/src/rty/mod.rs index 0cfd3d18bac..d9366475a99 100644 --- a/crates/flux-middle/src/rty/mod.rs +++ b/crates/flux-middle/src/rty/mod.rs @@ -2006,7 +2006,7 @@ impl<'tcx> ToRustc<'tcx> for BaseTy { .map(|pred| pred.to_rustc(tcx)) .collect_vec(); let preds = tcx.mk_poly_existential_predicates(&preds); - ty::Ty::new_dynamic(tcx, preds, re.to_rustc(tcx), rustc_middle::ty::DynKind::Dyn) + ty::Ty::new_dynamic(tcx, preds, re.to_rustc(tcx)) } BaseTy::Coroutine(def_id, resume_ty, upvars) => { bug!("TODO: Generator {def_id:?} {resume_ty:?} {upvars:?}") diff --git a/crates/flux-refineck/src/checker.rs b/crates/flux-refineck/src/checker.rs index 44b2a850351..4ca7d0ed623 100644 --- a/crates/flux-refineck/src/checker.rs +++ b/crates/flux-refineck/src/checker.rs @@ -400,7 +400,7 @@ fn find_trait_item( && let Some(impl_trait_ref) = genv.impl_trait_ref(impl_id)? { let impl_trait_ref = impl_trait_ref.instantiate_identity(); - let trait_item_id = tcx.associated_item(def_id).trait_item_def_id.unwrap(); + let trait_item_id = tcx.associated_item(def_id).trait_item_def_id().unwrap(); return Ok(Some((impl_trait_ref, trait_item_id))); } Ok(None) @@ -1266,7 +1266,6 @@ impl<'ck, 'genv, 'tcx, M: Mode> Checker<'ck, 'genv, 'tcx, M> { .with_span(stmt_span) } Rvalue::NullaryOp(null_op, ty) => Ok(self.check_nullary_op(*null_op, ty)), - Rvalue::Len(place) => self.check_len(infcx, env, stmt_span, place), Rvalue::UnaryOp(UnOp::PtrMetadata, Operand::Copy(place)) | Rvalue::UnaryOp(UnOp::PtrMetadata, Operand::Move(place)) => { self.check_raw_ptr_metadata(infcx, env, stmt_span, place) @@ -1366,26 +1365,6 @@ impl<'ck, 'genv, 'tcx, M: Mode> Checker<'ck, 'genv, 'tcx, M> { } } - fn check_len( - &mut self, - infcx: &mut InferCtxt, - env: &mut TypeEnv, - stmt_span: Span, - place: &Place, - ) -> Result { - let ty = env - .lookup_place(&mut infcx.at(stmt_span), place) - .with_span(stmt_span)?; - - let idx = match ty.kind() { - TyKind::Indexed(BaseTy::Array(_, len), _) => Expr::from_const(self.genv.tcx(), len), - TyKind::Indexed(BaseTy::Slice(_), idx) => idx.clone(), - _ => tracked_span_bug!("check_len: expected array or slice type found `{ty:?}`"), - }; - - Ok(Ty::indexed(BaseTy::Uint(UintTy::Usize), idx)) - } - fn check_binary_op( &mut self, infcx: &mut InferCtxt, diff --git a/crates/flux-refineck/src/ghost_statements/fold_unfold.rs b/crates/flux-refineck/src/ghost_statements/fold_unfold.rs index 20cf1eeeff9..73a11bcbe90 100644 --- a/crates/flux-refineck/src/ghost_statements/fold_unfold.rs +++ b/crates/flux-refineck/src/ghost_statements/fold_unfold.rs @@ -298,9 +298,6 @@ impl FoldUnfoldAnalysis<'_, '_, '_, M> { } StatementKind::Assign(place, rvalue) => { match rvalue { - Rvalue::Len(place) => { - M::projection(self, env, place)?; - } Rvalue::UnaryOp(UnOp::PtrMetadata, Operand::Copy(place)) | Rvalue::UnaryOp(UnOp::PtrMetadata, Operand::Move(place)) => { let deref_place = place.deref(); diff --git a/crates/flux-rustc-bridge/src/lowering.rs b/crates/flux-rustc-bridge/src/lowering.rs index d302a88d7f9..5ea1a5ef075 100644 --- a/crates/flux-rustc-bridge/src/lowering.rs +++ b/crates/flux-rustc-bridge/src/lowering.rs @@ -92,7 +92,7 @@ fn trait_ref_impl_id<'tcx>( param_env: ParamEnv<'tcx>, trait_ref: rustc_ty::TraitRef<'tcx>, ) -> Option<(DefId, rustc_middle::ty::GenericArgsRef<'tcx>)> { - let trait_ref = tcx.erase_regions(trait_ref); + let trait_ref = tcx.erase_and_anonymize_regions(trait_ref); let obligation = Obligation::new(tcx, ObligationCause::dummy(), param_env, trait_ref); let impl_source = selcx.select(&obligation).ok()??; let impl_source = selcx.infcx.resolve_vars_if_possible(impl_source); @@ -455,7 +455,6 @@ impl<'sess, 'tcx> MirLoweringCtxt<'_, 'sess, 'tcx> { rustc_mir::Rvalue::RawPtr(kind, place) => { Ok(Rvalue::RawPtr(*kind, lower_place(self.tcx, place)?)) } - rustc_mir::Rvalue::Len(place) => Ok(Rvalue::Len(lower_place(self.tcx, place)?)), rustc_mir::Rvalue::Cast(kind, op, ty) => { let kind = self.lower_cast_kind(*kind).ok_or_else(|| { UnsupportedReason::new(format!("unsupported cast `{kind:?}`")) @@ -897,7 +896,7 @@ impl<'tcx> Lower<'tcx> for rustc_ty::Ty<'tcx> { let args = args.lower(tcx)?; Ok(Ty::mk_generator_witness(*did, args)) } - rustc_ty::Dynamic(predicates, region, rustc_ty::DynKind::Dyn) => { + rustc_ty::Dynamic(predicates, region) => { let region = region.lower(tcx)?; let exi_preds = List::from_vec( @@ -1020,19 +1019,22 @@ impl<'tcx> Lower<'tcx> for rustc_middle::ty::Region<'tcx> { type R = Result; fn lower(self, _tcx: TyCtxt<'tcx>) -> Self::R { - use rustc_middle::ty::RegionKind; + use rustc_middle::ty; match self.kind() { - RegionKind::ReVar(rvid) => Ok(Region::ReVar(rvid)), - RegionKind::ReBound(debruijn, bregion) => { + ty::ReVar(rvid) => Ok(Region::ReVar(rvid)), + ty::ReBound(ty::BoundVarIndexKind::Bound(debruijn), bregion) => { Ok(Region::ReBound( debruijn, Ok(BoundRegion { kind: bregion.kind, var: bregion.var })?, )) } - RegionKind::ReEarlyParam(bregion) => Ok(Region::ReEarlyParam(bregion)), - RegionKind::ReStatic => Ok(Region::ReStatic), - RegionKind::ReErased => Ok(Region::ReErased), - RegionKind::ReLateParam(_) | RegionKind::RePlaceholder(_) | RegionKind::ReError(_) => { + ty::ReEarlyParam(bregion) => Ok(Region::ReEarlyParam(bregion)), + ty::ReStatic => Ok(Region::ReStatic), + ty::ReErased => Ok(Region::ReErased), + ty::ReBound(ty::BoundVarIndexKind::Canonical, _) + | ty::ReLateParam(_) + | ty::RePlaceholder(_) + | ty::ReError(_) => { Err(UnsupportedReason::new(format!("unsupported region `{self:?}`"))) } } diff --git a/crates/flux-rustc-bridge/src/mir.rs b/crates/flux-rustc-bridge/src/mir.rs index e63a5ac15cc..55e8e04071d 100644 --- a/crates/flux-rustc-bridge/src/mir.rs +++ b/crates/flux-rustc-bridge/src/mir.rs @@ -207,7 +207,6 @@ pub enum Rvalue { Repeat(Operand, Const), Ref(Region, BorrowKind, Place), RawPtr(RawPtrKind, Place), - Len(Place), Cast(CastKind, Operand, Ty), BinaryOp(BinOp, Operand, Operand), NullaryOp(NullOp, Ty), @@ -721,7 +720,6 @@ impl fmt::Debug for Rvalue { Rvalue::Aggregate(AggregateKind::Tuple, args) => { write!(f, "({:?})", args.iter().format(", ")) } - Rvalue::Len(place) => write!(f, "Len({place:?})"), Rvalue::Cast(kind, op, ty) => write!(f, "{op:?} as {ty:?} [{kind:?}]"), Rvalue::Repeat(op, c) => write!(f, "[{op:?}; {c:?}]"), Rvalue::ShallowInitBox(op, ty) => write!(f, "ShallowInitBox({op:?}, {ty:?})"), diff --git a/crates/flux-rustc-bridge/src/ty/mod.rs b/crates/flux-rustc-bridge/src/ty/mod.rs index 7ab4fede185..4a63f153863 100644 --- a/crates/flux-rustc-bridge/src/ty/mod.rs +++ b/crates/flux-rustc-bridge/src/ty/mod.rs @@ -963,7 +963,7 @@ impl<'tcx> ToRustc<'tcx> for Ty { .collect_vec(); let preds = tcx.mk_poly_existential_predicates(&preds); - rustc_ty::Ty::new_dynamic(tcx, preds, re.to_rustc(tcx), rustc_ty::DynKind::Dyn) + rustc_ty::Ty::new_dynamic(tcx, preds, re.to_rustc(tcx)) } TyKind::Coroutine(_, _) | TyKind::CoroutineWitness(_, _) => { bug!("TODO: to_rustc for `{self:?}`") diff --git a/crates/flux-syntax/src/symbols.rs b/crates/flux-syntax/src/symbols.rs index 030dbd735bc..bb3e5ecdf2c 100644 --- a/crates/flux-syntax/src/symbols.rs +++ b/crates/flux-syntax/src/symbols.rs @@ -23,7 +23,6 @@ symbols! { Symbols { Map, Set, - hide, int, real, } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 969a0a4c1da..5c83bd63d63 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2025-09-09" +channel = "nightly-2025-10-09" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"]