diff options
| author | David Tolnay <dtolnay@gmail.com> | 2023-07-21 22:35:57 -0700 | 
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2023-07-21 22:35:57 -0700 | 
| commit | 5bbf0a8306340f849ee732c5caf3decd1db24d44 (patch) | |
| tree | 402dbdf6836df5950480006290af3baa80996fb8 /compiler/rustc_trait_selection | |
| parent | a5e2eca40ec17f17b6641bcc7c069380ac395acf (diff) | |
| download | rust-5bbf0a8306340f849ee732c5caf3decd1db24d44.tar.gz rust-5bbf0a8306340f849ee732c5caf3decd1db24d44.zip | |
Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"
This reverts commit 557359f92512ca88b62a602ebda291f17a953002, reversing changes made to 1e6c09a803fd543a98bfbe1624d697a55300a786.
Diffstat (limited to 'compiler/rustc_trait_selection')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/trait_goals.rs | 17 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs | 17 | 
2 files changed, 6 insertions, 28 deletions
| diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs index 761f5327f6d..930e62d6388 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs @@ -223,20 +223,9 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { return ecx.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS); } - // First, try computing an exact naive layout in case the type is generic. - let is_pointer_like = if let Ok(layout) = tcx.naive_layout_of(key) { - layout.is_pointer_like(&tcx.data_layout).unwrap_or_else(|| { - // Second, we fall back to full layout computation. - tcx.layout_of(key) - .ok() - .filter(|l| l.layout.is_pointer_like(&tcx.data_layout)) - .is_some() - }) - } else { - false - }; - - if is_pointer_like { + if let Ok(layout) = tcx.layout_of(key) + && layout.layout.is_pointer_like(&tcx.data_layout) + { // FIXME: We could make this faster by making a no-constraints response ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) } else { diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index f1d870269a6..aa195d70a9f 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -979,20 +979,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { return; } - // First, try computing an exact naive layout in case the type is generic. - let is_pointer_like = if let Ok(layout) = tcx.naive_layout_of(key) { - layout.is_pointer_like(&tcx.data_layout).unwrap_or_else(|| { - // Second, we fall back to full layout computation. - tcx.layout_of(key) - .ok() - .filter(|l| l.layout.is_pointer_like(&tcx.data_layout)) - .is_some() - }) - } else { - false - }; - - if is_pointer_like { + if let Ok(layout) = tcx.layout_of(key) + && layout.layout.is_pointer_like(&tcx.data_layout) + { candidates.vec.push(BuiltinCandidate { has_nested: false }); } } | 
