Skip to content

Commit 695f938

Browse files
committed
Auto merge of rust-lang#134269 - matthiaskrgr:rollup-fkshwux, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#133900 (Advent of `tests/ui` (misc cleanups and improvements) [1/N]) - rust-lang#133937 (Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them) - rust-lang#133938 (`rustc_mir_dataflow` cleanups, including some renamings) - rust-lang#134058 (interpret: reduce usage of TypingEnv::fully_monomorphized) - rust-lang#134130 (Stop using driver queries in the public API) - rust-lang#134140 (Add AST support for unsafe binders) - rust-lang#134229 (Fix typos in docs on provenance) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8a09650 + 9ce2645 commit 695f938

File tree

10 files changed

+31
-7
lines changed

10 files changed

+31
-7
lines changed

clippy_lints/src/dereference.rs

+1
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ impl TyCoercionStability {
819819
| TyKind::TraitObject(..)
820820
| TyKind::InferDelegation(..)
821821
| TyKind::Err(_) => Self::Reborrow,
822+
TyKind::UnsafeBinder(..) => Self::None,
822823
};
823824
}
824825
}

clippy_lints/src/duplicate_mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl_lint_pass!(DuplicateMod => [DUPLICATE_MOD]);
6363

6464
impl EarlyLintPass for DuplicateMod {
6565
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
66-
if let ItemKind::Mod(_, ModKind::Loaded(_, Inline::No, mod_spans)) = &item.kind
66+
if let ItemKind::Mod(_, ModKind::Loaded(_, Inline::No, mod_spans, _)) = &item.kind
6767
&& let FileName::Real(real) = cx.sess().source_map().span_to_filename(mod_spans.inner_span)
6868
&& let Some(local_path) = real.into_local_path()
6969
&& let Ok(absolute_path) = local_path.canonicalize()

clippy_lints/src/excessive_nesting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl Visitor<'_> for NestingVisitor<'_, '_> {
163163
}
164164

165165
match &item.kind {
166-
ItemKind::Trait(_) | ItemKind::Impl(_) | ItemKind::Mod(.., ModKind::Loaded(_, Inline::Yes, _)) => {
166+
ItemKind::Trait(_) | ItemKind::Impl(_) | ItemKind::Mod(.., ModKind::Loaded(_, Inline::Yes, _, _)) => {
167167
self.nest_level += 1;
168168

169169
if !self.check_indent(item.span, item.id) {

clippy_lints/src/loops/never_loop.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ fn never_loop_expr<'tcx>(
156156
| ExprKind::Field(e, _)
157157
| ExprKind::AddrOf(_, _, e)
158158
| ExprKind::Repeat(e, _)
159-
| ExprKind::DropTemps(e) => never_loop_expr(cx, e, local_labels, main_loop_id),
159+
| ExprKind::DropTemps(e)
160+
| ExprKind::UnsafeBinderCast(_, e, _) => never_loop_expr(cx, e, local_labels, main_loop_id),
160161
ExprKind::Let(let_expr) => never_loop_expr(cx, let_expr.init, local_labels, main_loop_id),
161162
ExprKind::Array(es) | ExprKind::Tup(es) => never_loop_expr_all(cx, es.iter(), local_labels, main_loop_id),
162163
ExprKind::MethodCall(_, receiver, es, _) => {

clippy_lints/src/utils/author.rs

+3
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,9 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
623623
kind!("DropTemps({expr})");
624624
self.expr(expr);
625625
},
626+
ExprKind::UnsafeBinderCast(..) => {
627+
unimplemented!("unsafe binders are not implemented yet");
628+
}
626629
}
627630
}
628631

clippy_utils/src/ast_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
379379
(Mod(lu, lmk), Mod(ru, rmk)) => {
380380
lu == ru
381381
&& match (lmk, rmk) {
382-
(ModKind::Loaded(litems, linline, _), ModKind::Loaded(ritems, rinline, _)) => {
382+
(ModKind::Loaded(litems, linline, _, _), ModKind::Loaded(ritems, rinline, _, _)) => {
383383
linline == rinline && over(litems, ritems, |l, r| eq_item(l, r, eq_item_kind))
384384
},
385385
(ModKind::Unloaded, ModKind::Unloaded) => true,

clippy_utils/src/eager_or_lazy.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ fn expr_eagerness<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> EagernessS
303303
| ExprKind::AddrOf(..)
304304
| ExprKind::Repeat(..)
305305
| ExprKind::Block(Block { stmts: [], .. }, _)
306-
| ExprKind::OffsetOf(..) => (),
306+
| ExprKind::OffsetOf(..)
307+
| ExprKind::UnsafeBinderCast(..) => (),
307308

308309
// Assignment might be to a local defined earlier, so don't eagerly evaluate.
309310
// Blocks with multiple statements might be expensive, so don't eagerly evaluate.

clippy_utils/src/hir_utils.rs

+15
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@ impl HirEqInterExpr<'_, '_, '_> {
370370
&& self.eq_expr(l_receiver, r_receiver)
371371
&& self.eq_exprs(l_args, r_args)
372372
},
373+
(&ExprKind::UnsafeBinderCast(lkind, le, None), &ExprKind::UnsafeBinderCast(rkind, re, None)) =>
374+
lkind == rkind && self.eq_expr(le, re),
375+
(&ExprKind::UnsafeBinderCast(lkind, le, Some(lt)), &ExprKind::UnsafeBinderCast(rkind, re, Some(rt))) =>
376+
lkind == rkind && self.eq_expr(le, re) && self.eq_ty(lt, rt),
373377
(&ExprKind::OffsetOf(l_container, l_fields), &ExprKind::OffsetOf(r_container, r_fields)) => {
374378
self.eq_ty(l_container, r_container) && over(l_fields, r_fields, |l, r| l.name == r.name)
375379
},
@@ -424,6 +428,7 @@ impl HirEqInterExpr<'_, '_, '_> {
424428
| &ExprKind::Type(..)
425429
| &ExprKind::Unary(..)
426430
| &ExprKind::Yield(..)
431+
| &ExprKind::UnsafeBinderCast(..)
427432

428433
// --- Special cases that do not have a positive branch.
429434

@@ -1032,6 +1037,13 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
10321037
std::mem::discriminant(&lop).hash(&mut self.s);
10331038
self.hash_expr(le);
10341039
},
1040+
ExprKind::UnsafeBinderCast(kind, expr, ty) => {
1041+
std::mem::discriminant(&kind).hash(&mut self.s);
1042+
self.hash_expr(expr);
1043+
if let Some(ty) = ty {
1044+
self.hash_ty(ty);
1045+
}
1046+
}
10351047
ExprKind::Err(_) => {},
10361048
}
10371049
}
@@ -1241,6 +1253,9 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12411253
TyKind::Typeof(anon_const) => {
12421254
self.hash_body(anon_const.body);
12431255
},
1256+
TyKind::UnsafeBinder(binder) => {
1257+
self.hash_ty(binder.inner_ty);
1258+
}
12441259
TyKind::Err(_)
12451260
| TyKind::Infer
12461261
| TyKind::Never

clippy_utils/src/sugg.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ impl<'a> Sugg<'a> {
151151
| ExprKind::Become(..)
152152
| ExprKind::Struct(..)
153153
| ExprKind::Tup(..)
154-
| ExprKind::Err(_) => Sugg::NonParen(get_snippet(expr.span)),
154+
| ExprKind::Err(_)
155+
| ExprKind::UnsafeBinderCast(..) => Sugg::NonParen(get_snippet(expr.span)),
155156
ExprKind::DropTemps(inner) => Self::hir_from_snippet(inner, get_snippet),
156157
ExprKind::Assign(lhs, rhs, _) => {
157158
Sugg::BinOp(AssocOp::Assign, get_snippet(lhs.span), get_snippet(rhs.span))
@@ -226,7 +227,8 @@ impl<'a> Sugg<'a> {
226227
| ast::ExprKind::While(..)
227228
| ast::ExprKind::Await(..)
228229
| ast::ExprKind::Err(_)
229-
| ast::ExprKind::Dummy => Sugg::NonParen(snippet(expr.span)),
230+
| ast::ExprKind::Dummy
231+
| ast::ExprKind::UnsafeBinderCast(..) => Sugg::NonParen(snippet(expr.span)),
230232
ast::ExprKind::Range(ref lhs, ref rhs, RangeLimits::HalfOpen) => Sugg::BinOp(
231233
AssocOp::DotDot,
232234
lhs.as_ref().map_or("".into(), |lhs| snippet(lhs.span)),

clippy_utils/src/visitors.rs

+1
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ pub fn for_each_unconsumed_temporary<'tcx, B>(
694694
| ExprKind::Continue(_)
695695
| ExprKind::InlineAsm(_)
696696
| ExprKind::OffsetOf(..)
697+
| ExprKind::UnsafeBinderCast(..)
697698
| ExprKind::Err(_) => (),
698699
}
699700
ControlFlow::Continue(())

0 commit comments

Comments
 (0)