mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-07 12:48:30 +00:00
Auto merge of #89158 - the8472:rollup-3e4ijth, r=the8472
Rollup of 12 pull requests Successful merges: - #88795 (Print a note if a character literal contains a variation selector) - #89015 (core::ascii::escape_default: reduce struct size) - #89078 (Cleanup: Remove needless reference in ParentHirIterator) - #89086 (Stabilize `Iterator::map_while`) - #89096 ([bootstrap] Improve the error message when `ninja` is not found to link to installation instructions) - #89113 (dont `.ensure()` the `thir_abstract_const` query call in `mir_build`) - #89114 (Fixes a technicality regarding the size of C's `char` type) - #89115 (⬆️ rust-analyzer) - #89126 (Fix ICE when `indirect_structural_match` is allowed) - #89141 (Impl `Error` for `FromSecsError` without foreign type) - #89142 (Fix match for placeholder region) - #89147 (add case for checking const refs in check_const_value_eq) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
b51b17288e
@ -105,8 +105,7 @@ impl<'hir> IfLet<'hir> {
|
|||||||
if_else,
|
if_else,
|
||||||
) = expr.kind
|
) = expr.kind
|
||||||
{
|
{
|
||||||
let hir = cx.tcx.hir();
|
let mut iter = cx.tcx.hir().parent_iter(expr.hir_id);
|
||||||
let mut iter = hir.parent_iter(expr.hir_id);
|
|
||||||
if let Some((_, Node::Block(Block { stmts: [], .. }))) = iter.next() {
|
if let Some((_, Node::Block(Block { stmts: [], .. }))) = iter.next() {
|
||||||
if let Some((
|
if let Some((
|
||||||
_,
|
_,
|
||||||
|
@ -833,12 +833,11 @@ pub fn capture_local_usage(cx: &LateContext<'tcx>, e: &Expr<'_>) -> CaptureKind
|
|||||||
ExprKind::Path(QPath::Resolved(None, Path { res: Res::Local(_), .. }))
|
ExprKind::Path(QPath::Resolved(None, Path { res: Res::Local(_), .. }))
|
||||||
));
|
));
|
||||||
|
|
||||||
let map = cx.tcx.hir();
|
|
||||||
let mut child_id = e.hir_id;
|
let mut child_id = e.hir_id;
|
||||||
let mut capture = CaptureKind::Value;
|
let mut capture = CaptureKind::Value;
|
||||||
let mut capture_expr_ty = e;
|
let mut capture_expr_ty = e;
|
||||||
|
|
||||||
for (parent_id, parent) in map.parent_iter(e.hir_id) {
|
for (parent_id, parent) in cx.tcx.hir().parent_iter(e.hir_id) {
|
||||||
if let [Adjustment {
|
if let [Adjustment {
|
||||||
kind: Adjust::Deref(_) | Adjust::Borrow(AutoBorrow::Ref(..)),
|
kind: Adjust::Deref(_) | Adjust::Borrow(AutoBorrow::Ref(..)),
|
||||||
target,
|
target,
|
||||||
@ -1224,8 +1223,7 @@ pub fn get_enclosing_block<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Optio
|
|||||||
|
|
||||||
/// Gets the loop or closure enclosing the given expression, if any.
|
/// Gets the loop or closure enclosing the given expression, if any.
|
||||||
pub fn get_enclosing_loop_or_closure(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
|
pub fn get_enclosing_loop_or_closure(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
|
||||||
let map = tcx.hir();
|
for (_, node) in tcx.hir().parent_iter(expr.hir_id) {
|
||||||
for (_, node) in map.parent_iter(expr.hir_id) {
|
|
||||||
match node {
|
match node {
|
||||||
Node::Expr(
|
Node::Expr(
|
||||||
e
|
e
|
||||||
@ -1244,8 +1242,7 @@ pub fn get_enclosing_loop_or_closure(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Opti
|
|||||||
|
|
||||||
/// Gets the parent node if it's an impl block.
|
/// Gets the parent node if it's an impl block.
|
||||||
pub fn get_parent_as_impl(tcx: TyCtxt<'_>, id: HirId) -> Option<&Impl<'_>> {
|
pub fn get_parent_as_impl(tcx: TyCtxt<'_>, id: HirId) -> Option<&Impl<'_>> {
|
||||||
let map = tcx.hir();
|
match tcx.hir().parent_iter(id).next() {
|
||||||
match map.parent_iter(id).next() {
|
|
||||||
Some((
|
Some((
|
||||||
_,
|
_,
|
||||||
Node::Item(Item {
|
Node::Item(Item {
|
||||||
@ -1259,8 +1256,7 @@ pub fn get_parent_as_impl(tcx: TyCtxt<'_>, id: HirId) -> Option<&Impl<'_>> {
|
|||||||
|
|
||||||
/// Checks if the given expression is the else clause of either an `if` or `if let` expression.
|
/// Checks if the given expression is the else clause of either an `if` or `if let` expression.
|
||||||
pub fn is_else_clause(tcx: TyCtxt<'_>, expr: &Expr<'_>) -> bool {
|
pub fn is_else_clause(tcx: TyCtxt<'_>, expr: &Expr<'_>) -> bool {
|
||||||
let map = tcx.hir();
|
let mut iter = tcx.hir().parent_iter(expr.hir_id);
|
||||||
let mut iter = map.parent_iter(expr.hir_id);
|
|
||||||
match iter.next() {
|
match iter.next() {
|
||||||
Some((
|
Some((
|
||||||
_,
|
_,
|
||||||
@ -1794,9 +1790,8 @@ pub fn is_expr_identity_function(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool
|
|||||||
|
|
||||||
/// Gets the node where an expression is either used, or it's type is unified with another branch.
|
/// Gets the node where an expression is either used, or it's type is unified with another branch.
|
||||||
pub fn get_expr_use_or_unification_node(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Option<Node<'tcx>> {
|
pub fn get_expr_use_or_unification_node(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Option<Node<'tcx>> {
|
||||||
let map = tcx.hir();
|
|
||||||
let mut child_id = expr.hir_id;
|
let mut child_id = expr.hir_id;
|
||||||
let mut iter = map.parent_iter(child_id);
|
let mut iter = tcx.hir().parent_iter(child_id);
|
||||||
loop {
|
loop {
|
||||||
match iter.next() {
|
match iter.next() {
|
||||||
None => break None,
|
None => break None,
|
||||||
|
Loading…
Reference in New Issue
Block a user