Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
912963b
Remove legacy InnoSetup GUI installer
ChrisDenton May 25, 2020
144206e
Don't implement Fn* traits for #[target_feature] functions
calebzulawski Jun 13, 2020
c98b4c8
Add error note when trying fn as Fn trait
calebzulawski Jun 13, 2020
765bd47
Recover extra trailing angle brackets in struct definition
Aaron1011 Jun 27, 2020
8e899b1
Don't implement Fn* for unsafe #[target_feature] functions
calebzulawski Jun 27, 2020
7055c23
ast_pretty: Pass some token streams and trees by reference
petrochenkov Jun 24, 2020
14d0370
Remove defunct `-Z print-region-graph`
tmiasko Jun 28, 2020
e8f5785
Split and expand nonstandard-style lints unicode unit test.
crlf0710 Jun 28, 2020
49c1018
Fix markdown rendering in librustc_lexer docs
pierwill Jun 28, 2020
dd34698
Fix Zulip topic format
LeSeulArtichaut Jun 29, 2020
844dc31
ci: fix wasm32 broken due to a NodeJS version bump
pietroalbini Jun 30, 2020
f74a7d3
Clean up E0712 explanation
GuillaumeGomez Jun 30, 2020
c225e5c
Provide more information on duplicate lang item error.
ehuss Jun 17, 2020
1b3ef66
Switch crate_extern_paths to a query, and tweak wording.
ehuss Jun 27, 2020
0889d79
remove duplicate tests
lcnr Jun 30, 2020
e3cbb62
Rename TypeckTables to TypeckResults.
Lezzz Jun 4, 2020
51858da
Make #[target_feature] Fn trait error message less confusing
calebzulawski Jun 30, 2020
47425e4
Rewrite a few manual index loops with while-let
cuviper Jul 1, 2020
7616cd9
`#[deny(unsafe_op_in_unsafe_fn)]` in libstd/fs.rs
eltonlaw Jul 1, 2020
b438811
enable unsafe_op_in_unsafe_fn lint
eltonlaw Jul 1, 2020
a5764de
expand: Stop using nonterminals for passing tokens to attribute and d…
petrochenkov Jun 14, 2020
b37434e
Remove `token::FlattenGroup`
petrochenkov Jul 1, 2020
9ce1d19
Fix comment typo
kraai Jul 1, 2020
eb4ba55
Add an issue number for the pretty_printing_compatibility_hack FIXME
petrochenkov Jul 1, 2020
8f540c2
Rollup merge of #72569 - ChrisDenton:remove-innosetup, r=nikomatsakis
Manishearth Jul 2, 2020
13faeea
Rollup merge of #72983 - Lezzz:rename-typeck, r=nikomatsakis
Manishearth Jul 2, 2020
aacf886
Rollup merge of #73306 - calebzulawski:target-feature-11-fn-trait-sou…
Manishearth Jul 2, 2020
f228679
Rollup merge of #73345 - petrochenkov:nointerp, r=Aaron1011
Manishearth Jul 2, 2020
5c3f879
Rollup merge of #73449 - ehuss:duplicate-lang-item, r=matthewjasper
Manishearth Jul 2, 2020
fa2a99a
Rollup merge of #73803 - Aaron1011:feature/angle-field-recovery, r=ma…
Manishearth Jul 2, 2020
42005ab
Rollup merge of #73812 - petrochenkov:prettyref, r=varkor
Manishearth Jul 2, 2020
15c01a4
Rollup merge of #73839 - crlf0710:snapshot_the_reality, r=Manishearth
Manishearth Jul 2, 2020
bdda063
Rollup merge of #73841 - tmiasko:print-region-graph, r=Mark-Simulacrum
Manishearth Jul 2, 2020
80e6489
Rollup merge of #73848 - pierwill:pierwill-lexer-block-doc, r=jonas-s…
Manishearth Jul 2, 2020
187a6f4
Rollup merge of #73865 - LeSeulArtichaut:patch-1, r=Dylan-DPC
Manishearth Jul 2, 2020
7927a05
Rollup merge of #73885 - pietroalbini:ci-fix-wasm32, r=kennytm
Manishearth Jul 2, 2020
e4475fd
Rollup merge of #73892 - GuillaumeGomez:cleanup-e0712, r=Dylan-DPC
Manishearth Jul 2, 2020
e2f84f3
Rollup merge of #73898 - lcnr:issue61383, r=jonas-schievink
Manishearth Jul 2, 2020
c0cd0b9
Rollup merge of #73909 - eltonlaw:unsafe-libstd-fs-rs, r=sfackler
Manishearth Jul 2, 2020
385fa6b
Rollup merge of #73910 - cuviper:while-indexing, r=oli-obk
Manishearth Jul 2, 2020
b5c5382
Rollup merge of #73929 - kraai:fix-comment-typo, r=jonas-schievink
Manishearth Jul 2, 2020
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
Next Next commit
Rename TypeckTables to TypeckResults.
  • Loading branch information
Lezzz committed Jun 30, 2020
commit e3cbb626250b815fb0cdd3c0c2f16db96ec0c4dd
15 changes: 8 additions & 7 deletions src/librustc_driver/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ where
PpmTyped => {
abort_on_err(tcx.analysis(LOCAL_CRATE), tcx.sess);

let empty_tables = ty::TypeckTables::empty(None);
let annotation = TypedAnnotation { tcx, tables: Cell::new(&empty_tables) };
let empty_typeck_results = ty::TypeckResults::empty(None);
let annotation =
TypedAnnotation { tcx, typeck_results: Cell::new(&empty_typeck_results) };
tcx.dep_graph.with_ignore(|| f(&annotation, tcx.hir().krate()))
}
_ => panic!("Should use call_with_pp_support"),
Expand Down Expand Up @@ -306,7 +307,7 @@ impl<'a> pprust::PpAnn for HygieneAnnotation<'a> {

struct TypedAnnotation<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
tables: Cell<&'a ty::TypeckTables<'tcx>>,
typeck_results: Cell<&'a ty::TypeckResults<'tcx>>,
}

impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
Expand All @@ -329,13 +330,13 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {

impl<'a, 'tcx> pprust_hir::PpAnn for TypedAnnotation<'a, 'tcx> {
fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
let old_tables = self.tables.get();
let old_typeck_results = self.typeck_results.get();
if let pprust_hir::Nested::Body(id) = nested {
self.tables.set(self.tcx.body_tables(id));
self.typeck_results.set(self.tcx.typeck_body(id));
}
let pp_ann = &(&self.tcx.hir() as &dyn hir::intravisit::Map<'_>);
pprust_hir::PpAnn::nested(pp_ann, state, nested);
self.tables.set(old_tables);
self.typeck_results.set(old_typeck_results);
}
fn pre(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) {
if let pprust_hir::AnnNode::Expr(_) = node {
Expand All @@ -347,7 +348,7 @@ impl<'a, 'tcx> pprust_hir::PpAnn for TypedAnnotation<'a, 'tcx> {
s.s.space();
s.s.word("as");
s.s.space();
s.s.word(self.tables.get().expr_ty(expr).to_string());
s.s.word(self.typeck_results.get().expr_ty(expr).to_string());
s.pclose();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_hir/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ pub enum ExprKind<'hir> {
/// To resolve the called method to a `DefId`, call [`type_dependent_def_id`] with
/// the `hir_id` of the `MethodCall` node itself.
///
/// [`type_dependent_def_id`]: ../ty/struct.TypeckTables.html#method.type_dependent_def_id
/// [`type_dependent_def_id`]: ../ty/struct.TypeckResults.html#method.type_dependent_def_id
MethodCall(&'hir PathSegment<'hir>, Span, &'hir [Expr<'hir>], Span),
/// A tuple (e.g., `(a, b, c, d)`).
Tup(&'hir [Expr<'hir>]),
Expand Down Expand Up @@ -1659,7 +1659,7 @@ pub enum ExprKind<'hir> {
///
/// To resolve the path to a `DefId`, call [`qpath_res`].
///
/// [`qpath_res`]: ../rustc_middle/ty/struct.TypeckTables.html#method.qpath_res
/// [`qpath_res`]: ../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable_Generic)]
pub enum QPath<'hir> {
/// Path to a definition, optionally "fully-qualified" with a `Self`
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_incremental/persist/dirty_clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
//! we will compare the fingerprint from the current and from the previous
//! compilation session as appropriate:
//!
//! - `#[rustc_clean(cfg="rev2", except="typeck_tables_of")]` if we are
//! - `#[rustc_clean(cfg="rev2", except="typeck")]` if we are
//! in `#[cfg(rev2)]`, then the fingerprints associated with
//! `DepNode::typeck_tables_of(X)` must be DIFFERENT (`X` is the `DefId` of the
//! `DepNode::typeck(X)` must be DIFFERENT (`X` is the `DefId` of the
//! current node).
//! - `#[rustc_clean(cfg="rev2")]` same as above, except that the
//! fingerprints must be the SAME (along with all other fingerprints).
Expand Down Expand Up @@ -48,7 +48,7 @@ const BASE_FN: &[&str] = &[
label_strs::type_of,
// And a big part of compilation (that we eventually want to cache) is type inference
// information:
label_strs::typeck_tables_of,
label_strs::typeck,
];

/// DepNodes for Hir, which is pretty much everything
Expand Down
11 changes: 7 additions & 4 deletions src/librustc_infer/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
let scrut_expr = self.tcx.hir().expect_expr(scrut_hir_id);
let scrut_ty = if let hir::ExprKind::Call(_, args) = &scrut_expr.kind {
let arg_expr = args.first().expect("try desugaring call w/out arg");
self.in_progress_tables
.and_then(|tables| tables.borrow().expr_ty_opt(arg_expr))
self.in_progress_typeck_results.and_then(|typeck_results| {
typeck_results.borrow().expr_ty_opt(arg_expr)
})
} else {
bug!("try desugaring w/out call expr as scrutinee");
};
Expand Down Expand Up @@ -1683,8 +1684,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
let hir = &self.tcx.hir();
// Attempt to obtain the span of the parameter so we can
// suggest adding an explicit lifetime bound to it.
let generics =
self.in_progress_tables.and_then(|table| table.borrow().hir_owner).map(|table_owner| {
let generics = self
.in_progress_typeck_results
.and_then(|table| table.borrow().hir_owner)
.map(|table_owner| {
let hir_id = hir.as_local_hir_id(table_owner);
let parent_id = hir.get_parent_item(hir_id);
(
Expand Down
17 changes: 11 additions & 6 deletions src/librustc_infer/infer/error_reporting/need_type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ impl<'a, 'tcx> FindHirNodeVisitor<'a, 'tcx> {
}

fn node_ty_contains_target(&mut self, hir_id: HirId) -> Option<Ty<'tcx>> {
let ty_opt =
self.infcx.in_progress_tables.and_then(|tables| tables.borrow().node_type_opt(hir_id));
let ty_opt = self
.infcx
.in_progress_typeck_results
.and_then(|typeck_results| typeck_results.borrow().node_type_opt(hir_id));
match ty_opt {
Some(ty) => {
let ty = self.infcx.resolve_vars_if_possible(&ty);
Expand Down Expand Up @@ -123,8 +125,11 @@ impl<'a, 'tcx> Visitor<'tcx> for FindHirNodeVisitor<'a, 'tcx> {
if let ExprKind::MethodCall(_, call_span, exprs, _) = expr.kind {
if call_span == self.target_span
&& Some(self.target)
== self.infcx.in_progress_tables.and_then(|tables| {
tables.borrow().node_type_opt(exprs.first().unwrap().hir_id).map(Into::into)
== self.infcx.in_progress_typeck_results.and_then(|typeck_results| {
typeck_results
.borrow()
.node_type_opt(exprs.first().unwrap().hir_id)
.map(Into::into)
})
{
self.found_exact_method_call = Some(&expr);
Expand Down Expand Up @@ -580,8 +585,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
e: &Expr<'_>,
err: &mut DiagnosticBuilder<'_>,
) {
if let (Some(tables), None) = (self.in_progress_tables, &segment.args) {
let borrow = tables.borrow();
if let (Some(typeck_results), None) = (self.in_progress_typeck_results, &segment.args) {
let borrow = typeck_results.borrow();
if let Some((DefKind::AssocFn, did)) = borrow.type_dependent_def(e.hir_id) {
let generics = self.tcx.generics_of(did);
if !generics.params.is_empty() {
Expand Down
34 changes: 18 additions & 16 deletions src/librustc_infer/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ impl<'tcx> InferCtxtInner<'tcx> {
pub struct InferCtxt<'a, 'tcx> {
pub tcx: TyCtxt<'tcx>,

/// During type-checking/inference of a body, `in_progress_tables`
/// contains a reference to the tables being built up, which are
/// During type-checking/inference of a body, `in_progress_typeck_results`
/// contains a reference to the typeck_results being built up, which are
/// used for reading closure kinds/signatures as they are inferred,
/// and for error reporting logic to read arbitrary node types.
pub in_progress_tables: Option<&'a RefCell<ty::TypeckTables<'tcx>>>,
pub in_progress_typeck_results: Option<&'a RefCell<ty::TypeckResults<'tcx>>>,

pub inner: RefCell<InferCtxtInner<'tcx>>,

Expand Down Expand Up @@ -571,7 +571,7 @@ impl<'tcx> fmt::Display for FixupError<'tcx> {
/// `F: for<'b, 'tcx> where 'tcx FnOnce(InferCtxt<'b, 'tcx>)`.
pub struct InferCtxtBuilder<'tcx> {
tcx: TyCtxt<'tcx>,
fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>,
fresh_typeck_results: Option<RefCell<ty::TypeckResults<'tcx>>>,
}

pub trait TyCtxtInferExt<'tcx> {
Expand All @@ -580,15 +580,15 @@ pub trait TyCtxtInferExt<'tcx> {

impl TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
fn infer_ctxt(self) -> InferCtxtBuilder<'tcx> {
InferCtxtBuilder { tcx: self, fresh_tables: None }
InferCtxtBuilder { tcx: self, fresh_typeck_results: None }
}
}

impl<'tcx> InferCtxtBuilder<'tcx> {
/// Used only by `rustc_typeck` during body type-checking/inference,
/// will initialize `in_progress_tables` with fresh `TypeckTables`.
pub fn with_fresh_in_progress_tables(mut self, table_owner: LocalDefId) -> Self {
self.fresh_tables = Some(RefCell::new(ty::TypeckTables::empty(Some(table_owner))));
/// will initialize `in_progress_typeck_results` with fresh `TypeckResults`.
pub fn with_fresh_in_progress_typeck_results(mut self, hir_owner: LocalDefId) -> Self {
self.fresh_typeck_results = Some(RefCell::new(ty::TypeckResults::empty(Some(hir_owner))));
self
}

Expand Down Expand Up @@ -616,11 +616,11 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
}

pub fn enter<R>(&mut self, f: impl for<'a> FnOnce(InferCtxt<'a, 'tcx>) -> R) -> R {
let InferCtxtBuilder { tcx, ref fresh_tables } = *self;
let in_progress_tables = fresh_tables.as_ref();
let InferCtxtBuilder { tcx, ref fresh_typeck_results } = *self;
let in_progress_typeck_results = fresh_typeck_results.as_ref();
f(InferCtxt {
tcx,
in_progress_tables,
in_progress_typeck_results,
inner: RefCell::new(InferCtxtInner::new()),
lexical_region_resolutions: RefCell::new(None),
selection_cache: Default::default(),
Expand Down Expand Up @@ -667,7 +667,7 @@ pub struct CombinedSnapshot<'a, 'tcx> {
region_constraints_snapshot: RegionSnapshot,
universe: ty::UniverseIndex,
was_in_snapshot: bool,
_in_progress_tables: Option<Ref<'a, ty::TypeckTables<'tcx>>>,
_in_progress_typeck_results: Option<Ref<'a, ty::TypeckResults<'tcx>>>,
}

impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
Expand Down Expand Up @@ -789,9 +789,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
region_constraints_snapshot: inner.unwrap_region_constraints().start_snapshot(),
universe: self.universe(),
was_in_snapshot: in_snapshot,
// Borrow tables "in progress" (i.e., during typeck)
// Borrow typeck_results "in progress" (i.e., during typeck)
// to ban writes from within a snapshot to them.
_in_progress_tables: self.in_progress_tables.map(|tables| tables.borrow()),
_in_progress_typeck_results: self
.in_progress_typeck_results
.map(|typeck_results| typeck_results.borrow()),
}
}

Expand All @@ -802,7 +804,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
region_constraints_snapshot,
universe,
was_in_snapshot,
_in_progress_tables,
_in_progress_typeck_results,
} = snapshot;

self.in_snapshot.set(was_in_snapshot);
Expand All @@ -820,7 +822,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
region_constraints_snapshot: _,
universe: _,
was_in_snapshot,
_in_progress_tables,
_in_progress_typeck_results,
} = snapshot;

self.in_snapshot.set(was_in_snapshot);
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_lint/array_into_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIntoIter {

// Check if the method call actually calls the libcore
// `IntoIterator::into_iter`.
let def_id = cx.tables().type_dependent_def_id(expr.hir_id).unwrap();
let def_id = cx.typeck_results().type_dependent_def_id(expr.hir_id).unwrap();
match cx.tcx.trait_of_item(def_id) {
Some(trait_id) if cx.tcx.is_diagnostic_item(sym::IntoIterator, trait_id) => {}
_ => return,
Expand All @@ -45,7 +45,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIntoIter {
// `Box` is the only thing that values can be moved out of via
// method call. `Box::new([1]).into_iter()` should trigger this
// lint.
let mut recv_ty = cx.tables().expr_ty(receiver_arg);
let mut recv_ty = cx.typeck_results().expr_ty(receiver_arg);
let mut num_box_derefs = 0;
while recv_ty.is_box() {
num_box_derefs += 1;
Expand All @@ -60,13 +60,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIntoIter {
// Make sure that there is an autoref coercion at the expected
// position. The first `num_box_derefs` adjustments are the derefs
// of the box.
match cx.tables().expr_adjustments(receiver_arg).get(num_box_derefs) {
match cx.typeck_results().expr_adjustments(receiver_arg).get(num_box_derefs) {
Some(Adjustment { kind: Adjust::Borrow(_), .. }) => {}
_ => return,
}

// Emit lint diagnostic.
let target = match cx.tables().expr_ty_adjusted(receiver_arg).kind {
let target = match cx.typeck_results().expr_ty_adjusted(receiver_arg).kind {
ty::Ref(_, ty::TyS { kind: ty::Array(..), .. }, _) => "[T; N]",
ty::Ref(_, ty::TyS { kind: ty::Slice(..), .. }, _) => "[T]",

Expand Down
25 changes: 14 additions & 11 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers {
}

fn check_expr(&mut self, cx: &LateContext<'_, '_>, e: &hir::Expr<'_>) {
let ty = cx.tables().node_type(e.hir_id);
let ty = cx.typeck_results().node_type(e.hir_id);
self.check_heap_type(cx, e.span, ty);
}
}
Expand All @@ -161,11 +161,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
fn check_pat(&mut self, cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>) {
if let PatKind::Struct(ref qpath, field_pats, _) = pat.kind {
let variant = cx
.tables()
.typeck_results()
.pat_ty(pat)
.ty_adt_def()
.expect("struct pattern type is not an ADT")
.variant_of_res(cx.tables().qpath_res(qpath, pat.hir_id));
.variant_of_res(cx.typeck_results().qpath_res(qpath, pat.hir_id));
for fieldpat in field_pats {
if fieldpat.is_shorthand {
continue;
Expand All @@ -178,7 +178,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
}
if let PatKind::Binding(binding_annot, _, ident, None) = fieldpat.pat.kind {
if cx.tcx.find_field_index(ident, &variant)
== Some(cx.tcx.field_index(fieldpat.hir_id, cx.tables()))
== Some(cx.tcx.field_index(fieldpat.hir_id, cx.typeck_results()))
{
cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS, fieldpat.span, |lint| {
let mut err = lint
Expand Down Expand Up @@ -901,15 +901,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
expr: &hir::Expr<'_>,
) -> Option<(Ty<'tcx>, Ty<'tcx>)> {
let def = if let hir::ExprKind::Path(ref qpath) = expr.kind {
cx.tables().qpath_res(qpath, expr.hir_id)
cx.typeck_results().qpath_res(qpath, expr.hir_id)
} else {
return None;
};
if let Res::Def(DefKind::Fn, did) = def {
if !def_id_is_transmute(cx, did) {
return None;
}
let sig = cx.tables().node_type(expr.hir_id).fn_sig(cx.tcx);
let sig = cx.typeck_results().node_type(expr.hir_id).fn_sig(cx.tcx);
let from = sig.inputs().skip_binder()[0];
let to = *sig.output().skip_binder();
return Some((from, to));
Expand Down Expand Up @@ -1891,7 +1891,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
if let hir::ExprKind::Call(ref path_expr, ref args) = expr.kind {
// Find calls to `mem::{uninitialized,zeroed}` methods.
if let hir::ExprKind::Path(ref qpath) = path_expr.kind {
let def_id = cx.tables().qpath_res(qpath, path_expr.hir_id).opt_def_id()?;
let def_id =
cx.typeck_results().qpath_res(qpath, path_expr.hir_id).opt_def_id()?;

if cx.tcx.is_diagnostic_item(sym::mem_zeroed, def_id) {
return Some(InitKind::Zeroed);
Expand All @@ -1905,14 +1906,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
}
} else if let hir::ExprKind::MethodCall(_, _, ref args, _) = expr.kind {
// Find problematic calls to `MaybeUninit::assume_init`.
let def_id = cx.tables().type_dependent_def_id(expr.hir_id)?;
let def_id = cx.typeck_results().type_dependent_def_id(expr.hir_id)?;
if cx.tcx.is_diagnostic_item(sym::assume_init, def_id) {
// This is a call to *some* method named `assume_init`.
// See if the `self` parameter is one of the dangerous constructors.
if let hir::ExprKind::Call(ref path_expr, _) = args[0].kind {
if let hir::ExprKind::Path(ref qpath) = path_expr.kind {
let def_id =
cx.tables().qpath_res(qpath, path_expr.hir_id).opt_def_id()?;
let def_id = cx
.typeck_results()
.qpath_res(qpath, path_expr.hir_id)
.opt_def_id()?;

if cx.tcx.is_diagnostic_item(sym::maybe_uninit_zeroed, def_id) {
return Some(InitKind::Zeroed);
Expand Down Expand Up @@ -2025,7 +2028,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
// This conjures an instance of a type out of nothing,
// using zeroed or uninitialized memory.
// We are extremely conservative with what we warn about.
let conjured_ty = cx.tables().expr_ty(expr);
let conjured_ty = cx.typeck_results().expr_ty(expr);
if let Some((msg, span)) = ty_find_init_error(cx.tcx, conjured_ty, init) {
cx.struct_span_lint(INVALID_VALUE, expr.span, |lint| {
let mut err = lint.build(&format!(
Expand Down
Loading