Skip to content

Commit

Permalink
Rollup merge of rust-lang#123103 - compiler-errors:inherited-is-a-wei…
Browse files Browse the repository at this point in the history
…rd-name, r=oli-obk

Rename `Inherited` -> `TypeckRootCtxt`

`Inherited` is a confusing name. Rename it to `TypeckRootCtxt`.

I don't think this needs a type MCP or anything since it's not nearly as pervasive as `FnCtxt` , for example.

r? `@lcnr` `@oli-obk`
  • Loading branch information
matthiaskrgr authored Mar 26, 2024
2 parents 57627d2 + a6a1f78 commit 4b10cb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions clippy_lints/src/methods/unnecessary_to_owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_errors::Applicability;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::{BorrowKind, Expr, ExprKind, ItemKind, LangItem, Node};
use rustc_hir_typeck::{FnCtxt, Inherited};
use rustc_hir_typeck::{FnCtxt, TypeckRootCtxt};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_lint::LateContext;
use rustc_middle::mir::Mutability;
Expand Down Expand Up @@ -438,8 +438,8 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
Node::Item(item) => {
if let ItemKind::Fn(_, _, body_id) = &item.kind
&& let output_ty = return_ty(cx, item.owner_id)
&& let inherited = Inherited::new(cx.tcx, item.owner_id.def_id)
&& let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, item.owner_id.def_id)
&& let root_ctxt = TypeckRootCtxt::new(cx.tcx, item.owner_id.def_id)
&& let fn_ctxt = FnCtxt::new(&root_ctxt, cx.param_env, item.owner_id.def_id)
&& fn_ctxt.can_coerce(ty, output_ty)
{
if has_lifetime(output_ty) && has_lifetime(ty) {
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/transmute/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc_hir as hir;
use rustc_hir::Expr;
use rustc_hir_typeck::{cast, FnCtxt, Inherited};
use rustc_hir_typeck::{cast, FnCtxt, TypeckRootCtxt};
use rustc_lint::LateContext;
use rustc_middle::ty::cast::CastKind;
use rustc_middle::ty::Ty;
Expand Down Expand Up @@ -34,8 +34,8 @@ pub(super) fn check_cast<'tcx>(
let hir_id = e.hir_id;
let local_def_id = hir_id.owner.def_id;

let inherited = Inherited::new(cx.tcx, local_def_id);
let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, local_def_id);
let root_ctxt = TypeckRootCtxt::new(cx.tcx, local_def_id);
let fn_ctxt = FnCtxt::new(&root_ctxt, cx.param_env, local_def_id);

if let Ok(check) = cast::CastCheck::new(
&fn_ctxt,
Expand Down

0 comments on commit 4b10cb2

Please sign in to comment.