Skip to content

Reduce false positives of tail-expr-drop-order from consumed values #129864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from 1 commit
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
Prev Previous commit
clean up the previous implementation
  • Loading branch information
dingxiangfei2009 committed Sep 24, 2024
commit 2457860bbb405ab8610ab54bf46c74a17d94ab33
45 changes: 0 additions & 45 deletions compiler/rustc_hir_typeck/src/expr_use_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,51 +150,6 @@ pub trait TypeInformationCtxt<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx>;
}

impl<'tcx> TypeInformationCtxt<'tcx> for (TyCtxt<'tcx>, LocalDefId) {
type TypeckResults<'a>
= &'tcx ty::TypeckResults<'tcx>
where
Self: 'a;

type Error = !;

fn typeck_results(&self) -> Self::TypeckResults<'_> {
self.0.typeck(self.1)
}

fn resolve_vars_if_possible<T: TypeFoldable<TyCtxt<'tcx>>>(&self, t: T) -> T {
t
}

fn try_structurally_resolve_type(&self, _span: Span, ty: Ty<'tcx>) -> Ty<'tcx> {
ty
}

fn report_error(&self, span: Span, msg: impl ToString) -> Self::Error {
span_bug!(span, "{}", msg.to_string())
}

fn error_reported_in_ty(&self, _ty: Ty<'tcx>) -> Result<(), Self::Error> {
Ok(())
}

fn tainted_by_errors(&self) -> Result<(), Self::Error> {
Ok(())
}

fn type_is_copy_modulo_regions(&self, ty: Ty<'tcx>) -> bool {
ty.is_copy_modulo_regions(self.0, self.0.param_env(self.1))
}

fn body_owner_def_id(&self) -> LocalDefId {
self.1
}

fn tcx(&self) -> TyCtxt<'tcx> {
self.0
}
}

impl<'tcx> TypeInformationCtxt<'tcx> for &FnCtxt<'_, 'tcx> {
type TypeckResults<'a>
= Ref<'a, ty::TypeckResults<'tcx>>
Expand Down
Loading