Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/flux-infer/src/projections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}")
Expand Down Expand Up @@ -368,7 +368,7 @@ impl<'a, 'infcx, 'genv, 'tcx> Normalizer<'a, 'infcx, 'genv, 'tcx> {
candidates: &mut Vec<Candidate>,
) -> 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(),
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion crates/flux-middle/src/rty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}")
Expand Down
23 changes: 1 addition & 22 deletions crates/flux-refineck/src/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<Ty> {
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,
Expand Down
3 changes: 0 additions & 3 deletions crates/flux-refineck/src/ghost_statements/fold_unfold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,6 @@ impl<M: Mode> 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();
Expand Down
22 changes: 12 additions & 10 deletions crates/flux-rustc-bridge/src/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:?}`"))
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -1020,19 +1019,22 @@ impl<'tcx> Lower<'tcx> for rustc_middle::ty::Region<'tcx> {
type R = Result<Region, UnsupportedReason>;

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:?}`")))
}
}
Expand Down
2 changes: 0 additions & 2 deletions crates/flux-rustc-bridge/src/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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:?})"),
Expand Down
2 changes: 1 addition & 1 deletion crates/flux-rustc-bridge/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}`")
Expand Down
1 change: 0 additions & 1 deletion crates/flux-syntax/src/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ symbols! {
Symbols {
Map,
Set,
hide,
int,
real,
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-09-09"
channel = "nightly-2025-10-07"
components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt", "clippy"]