diff options
| author | bors <bors@rust-lang.org> | 2020-03-23 06:02:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-03-23 06:02:34 +0000 |
| commit | 8ff785011be6625e32afceee3a08e5cff7470feb (patch) | |
| tree | f9a842b8f8e390c261192943061f48d6754f65da /src/librustc | |
| parent | 37c945dd6178cb520eb1e450a795f8c3b3cc5a3b (diff) | |
| parent | 5f91f30b0ace8a687e1acd2e057e27d4b57ad364 (diff) | |
Auto merge of #70296 - Centril:rollup-wvfmb3n, r=Centril
Rollup of 9 pull requests Successful merges: - #69251 (#[track_caller] in traits) - #69880 (miri engine: turn error sanity checks into assertions) - #70207 (Use getentropy(2) on macos) - #70227 (Only display definition when suggesting a typo) - #70236 (resolve: Avoid "self-confirming" import resolutions in one more case) - #70248 (parser: simplify & remove unused field) - #70249 (handle ConstKind::Unresolved after monomorphizing) - #70269 (remove redundant closures (clippy::redundant_closure)) - #70270 (Clean up E0449 explanation) Failed merges: r? @ghost
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/dep_graph/graph.rs | 2 | ||||
| -rw-r--r-- | src/librustc/lib.rs | 1 | ||||
| -rw-r--r-- | src/librustc/mir/interpret/allocation.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ty/mod.rs | 18 |
4 files changed, 7 insertions, 16 deletions
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index dcb53a4fdef..36edf0f0fc2 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -245,7 +245,7 @@ impl DepGraph { C: DepGraphSafe + StableHashingContextProvider<'a>, { if let Some(ref data) = self.data { - let task_deps = create_task(key).map(|deps| Lock::new(deps)); + let task_deps = create_task(key).map(Lock::new); // In incremental mode, hash the result of the task. We don't // do anything with the hash yet, but we are computing it diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 8d0f604de6d..6f18560a02d 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -38,6 +38,7 @@ #![feature(extern_types)] #![feature(nll)] #![feature(option_expect_none)] +#![feature(or_patterns)] #![feature(range_is_empty)] #![feature(specialization)] #![feature(trusted_len)] diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 9474f05b55d..dd2a3f6c29a 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -796,7 +796,7 @@ impl UndefMask { } // FIXME(oli-obk): optimize this for allocations larger than a block. - let idx = (start.bytes()..end.bytes()).map(|i| Size::from_bytes(i)).find(|&i| !self.get(i)); + let idx = (start.bytes()..end.bytes()).map(Size::from_bytes).find(|&i| !self.get(i)); match idx { Some(idx) => Err(idx), diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index eeacd6a6d83..e7316ea763e 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -35,7 +35,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::{self, par_iter, Lrc, ParallelIterator}; use rustc_hir as hir; use rustc_hir::def::{CtorKind, CtorOf, DefKind, Namespace, Res}; -use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX}; use rustc_hir::{Constness, GlobMap, Node, TraitMap}; use rustc_index::vec::{Idx, IndexVec}; use rustc_macros::HashStable; @@ -2875,8 +2875,8 @@ impl<'tcx> TyCtxt<'tcx> { _ => false, } } else { - match self.def_kind(def_id).expect("no def for `DefId`") { - DefKind::AssocConst | DefKind::AssocFn | DefKind::AssocTy => true, + match self.def_kind(def_id) { + Some(DefKind::AssocConst | DefKind::AssocFn | DefKind::AssocTy) => true, _ => false, } }; @@ -3054,17 +3054,7 @@ impl<'tcx> TyCtxt<'tcx> { /// If the given defid describes a method belonging to an impl, returns the /// `DefId` of the impl that the method belongs to; otherwise, returns `None`. pub fn impl_of_method(self, def_id: DefId) -> Option<DefId> { - let item = if def_id.krate != LOCAL_CRATE { - if let Some(DefKind::AssocFn) = self.def_kind(def_id) { - Some(self.associated_item(def_id)) - } else { - None - } - } else { - self.opt_associated_item(def_id) - }; - - item.and_then(|trait_item| match trait_item.container { + self.opt_associated_item(def_id).and_then(|trait_item| match trait_item.container { TraitContainer(_) => None, ImplContainer(def_id) => Some(def_id), }) |
