= (A, fn(A));
/// type MetaFuncTuple = for<'a> fn(FuncTuple<&'a i32>);
/// ```
///
diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs
index d93aab04e9921..d1f437d9eaf9b 100644
--- a/compiler/rustc_middle/src/ty/util.rs
+++ b/compiler/rustc_middle/src/ty/util.rs
@@ -1108,7 +1108,6 @@ impl<'tcx> ExplicitSelf<'tcx> {
/// fn method_err3(self: &&T) // ExplicitSelf::ByReference
/// }
/// ```
- ///
pub fn determine(self_arg_ty: Ty<'tcx>, is_self_ty: P) -> ExplicitSelf<'tcx>
where
P: Fn(Ty<'tcx>) -> bool,
@@ -1227,7 +1226,7 @@ pub fn is_trivially_const_drop<'tcx>(ty: Ty<'tcx>) -> bool {
// Does the equivalent of
// ```
// let v = self.iter().map(|p| p.fold_with(folder)).collect::>();
-// folder.tcx().intern_*(&v)
+// folder.tcx().intern_ * (&v)
// ```
pub fn fold_list<'tcx, F, T>(
list: &'tcx ty::List,
diff --git a/compiler/rustc_mir_build/src/build/expr/as_operand.rs b/compiler/rustc_mir_build/src/build/expr/as_operand.rs
index e707c373f0dde..0b21b576a8211 100644
--- a/compiler/rustc_mir_build/src/build/expr/as_operand.rs
+++ b/compiler/rustc_mir_build/src/build/expr/as_operand.rs
@@ -45,9 +45,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
/// ```
/// #![feature(unsized_locals, unsized_fn_params)]
/// # use core::fmt::Debug;
- /// fn foo(p: dyn Debug) { dbg!(p); }
+ /// fn foo(p: dyn Debug) {
+ /// dbg!(p);
+ /// }
///
- /// fn bar(box_p: Box) { foo(*box_p); }
+ /// fn bar(box_p: Box) {
+ /// foo(*box_p);
+ /// }
/// ```
///
/// Ordinarily, for sized types, we would compile the call `foo(*p)` like so:
diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs
index 4fddc24301aba..bec7474d4ef0a 100644
--- a/compiler/rustc_mir_build/src/build/matches/mod.rs
+++ b/compiler/rustc_mir_build/src/build/matches/mod.rs
@@ -611,7 +611,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// ```
// let foo = (0, 1);
// let c = || {
- // let (v1, v2) = foo;
+ // let (v1, v2) = foo;
// };
// ```
if let Ok(match_pair_resolved) = initializer.clone().try_upvars_resolved(self) {
@@ -1487,10 +1487,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
/// ```
/// # let (x, y, z) = (true, true, true);
/// match (x, y, z) {
- /// (true , _ , true ) => true, // (0)
- /// (_ , true , _ ) => true, // (1)
- /// (false, false, _ ) => false, // (2)
- /// (true , _ , false) => false, // (3)
+ /// (true, _, true) => true, // (0)
+ /// (_, true, _) => true, // (1)
+ /// (false, false, _) => false, // (2)
+ /// (true, _, false) => false, // (3)
/// }
/// # ;
/// ```
@@ -1909,7 +1909,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// => { let tmp2 = place; feed(tmp2) }, ... }
//
// And an input like:
- //
// ```
// let place = Foo::new();
// match place { ref mut foo if inspect(foo)
@@ -1917,7 +1916,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// ```
//
// will be treated as if it were really something like:
- //
// ```
// let place = Foo::new();
// match place { Foo { .. } if { let tmp1 = & &mut place; inspect(*tmp1) }
@@ -2047,9 +2045,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// would yield an `arm_block` something like:
//
// ```
- // StorageLive(_4); // _4 is `x`
- // _4 = &mut (_1.0: i32); // this is handling `(mut x, 1)` case
- // _4 = &mut (_1.1: i32); // this is handling `(2, mut x)` case
+ // StorageLive(_4); // _4 is `x`
+ // _4 = &mut (_1.0: i32); // this is handling `(mut x, 1)` case
+ // _4 = &mut (_1.1: i32); // this is handling `(2, mut x)` case
// ```
//
// and that is clearly not correct.
diff --git a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
index 5105f059f9b64..ed22dc445e66e 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
@@ -280,9 +280,9 @@ impl IntRange {
// as overlapping:
// ```
// match (0u8, true) {
- // (0 ..= 125, false) => {}
- // (125 ..= 255, true) => {}
- // _ => {}
+ // (0..=125, false) => {}
+ // (125..=255, true) => {}
+ // _ => {}
// }
// ```
return;
@@ -1705,7 +1705,7 @@ impl<'p, 'tcx> fmt::Debug for DeconstructedPat<'p, 'tcx> {
write!(f, "{}", end)?;
write!(f, "{}", hi)
}
- IntRange(range) => write!(f, "{:?}", range), // Best-effort, will render e.g. `false` as `0..=0`
+ IntRange(range) => write!(f, "{:?}", range), /* Best-effort, will render e.g. `false` as `0..=0` */
Wildcard | Missing { .. } | NonExhaustive => write!(f, "_ : {:?}", self.ty),
Or => {
for pat in self.iter_fields() {
diff --git a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs
index 02e047afaf31f..b2906a9cc5606 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs
@@ -37,10 +37,10 @@
//! ```rust
//! # fn foo(x: Option) {
//! match x {
-//! Some(_) => {},
-//! None => {}, // reachable: `None` is matched by this but not the branch above
-//! Some(0) => {}, // unreachable: all the values this matches are already matched by
-//! // `Some(_)` above
+//! Some(_) => {}
+//! None => {} // reachable: `None` is matched by this but not the branch above
+//! Some(0) => {} /* unreachable: all the values this matches are already matched by
+//! * `Some(_)` above */
//! }
//! # }
//! ```
diff --git a/compiler/rustc_mir_dataflow/src/framework/lattice.rs b/compiler/rustc_mir_dataflow/src/framework/lattice.rs
index d6b89eb82275e..ff2744d6e205a 100644
--- a/compiler/rustc_mir_dataflow/src/framework/lattice.rs
+++ b/compiler/rustc_mir_dataflow/src/framework/lattice.rs
@@ -13,7 +13,6 @@
//! {X} {Y}
//! \ /
//! {} <- bottom
-//!
//! ```
//!
//! The defining characteristic of a lattice—the one that differentiates it from a [partially
diff --git a/compiler/rustc_mir_dataflow/src/impls/mod.rs b/compiler/rustc_mir_dataflow/src/impls/mod.rs
index fd1e492779f1b..f84be11bebee4 100644
--- a/compiler/rustc_mir_dataflow/src/impls/mod.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/mod.rs
@@ -39,21 +39,23 @@ pub use self::storage_liveness::{MaybeRequiresStorage, MaybeStorageLive};
///
/// ```rust
/// struct S;
-/// fn foo(pred: bool) { // maybe-init:
-/// // {}
-/// let a = S; let mut b = S; let c; let d; // {a, b}
+/// fn foo(pred: bool) {
+/// // maybe-init:
+/// // {}
+/// let a = S;
+/// let mut b = S;
+/// let c;
+/// let d; // {a, b}
///
/// if pred {
-/// drop(a); // { b}
-/// b = S; // { b}
-///
+/// drop(a); // { b}
+/// b = S; // { b}
/// } else {
-/// drop(b); // {a}
-/// d = S; // {a, d}
-///
-/// } // {a, b, d}
+/// drop(b); // {a}
+/// d = S; // {a, d}
+/// } // {a, b, d}
///
-/// c = S; // {a, b, c, d}
+/// c = S; // {a, b, c, d}
/// }
/// ```
///
@@ -92,21 +94,23 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'tcx> {
///
/// ```rust
/// struct S;
-/// fn foo(pred: bool) { // maybe-uninit:
-/// // {a, b, c, d}
-/// let a = S; let mut b = S; let c; let d; // { c, d}
+/// fn foo(pred: bool) {
+/// // maybe-uninit:
+/// // {a, b, c, d}
+/// let a = S;
+/// let mut b = S;
+/// let c;
+/// let d; // { c, d}
///
/// if pred {
-/// drop(a); // {a, c, d}
-/// b = S; // {a, c, d}
-///
+/// drop(a); // {a, c, d}
+/// b = S; // {a, c, d}
/// } else {
-/// drop(b); // { b, c, d}
-/// d = S; // { b, c }
-///
-/// } // {a, b, c, d}
+/// drop(b); // { b, c, d}
+/// d = S; // { b, c }
+/// } // {a, b, c, d}
///
-/// c = S; // {a, b, d}
+/// c = S; // {a, b, d}
/// }
/// ```
///
@@ -157,21 +161,23 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, 'tcx> {
///
/// ```rust
/// struct S;
-/// fn foo(pred: bool) { // definite-init:
-/// // { }
-/// let a = S; let mut b = S; let c; let d; // {a, b }
+/// fn foo(pred: bool) {
+/// // definite-init:
+/// // { }
+/// let a = S;
+/// let mut b = S;
+/// let c;
+/// let d; // {a, b }
///
/// if pred {
-/// drop(a); // { b, }
-/// b = S; // { b, }
-///
+/// drop(a); // { b, }
+/// b = S; // { b, }
/// } else {
-/// drop(b); // {a, }
-/// d = S; // {a, d}
-///
-/// } // { }
+/// drop(b); // {a, }
+/// d = S; // {a, d}
+/// } // { }
///
-/// c = S; // { c }
+/// c = S; // { c }
/// }
/// ```
///
@@ -212,21 +218,23 @@ impl<'a, 'tcx> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> {
///
/// ```rust
/// struct S;
-/// fn foo(pred: bool) { // ever-init:
-/// // { }
-/// let a = S; let mut b = S; let c; let d; // {a, b }
+/// fn foo(pred: bool) {
+/// // ever-init:
+/// // { }
+/// let a = S;
+/// let mut b = S;
+/// let c;
+/// let d; // {a, b }
///
/// if pred {
-/// drop(a); // {a, b, }
-/// b = S; // {a, b, }
-///
+/// drop(a); // {a, b, }
+/// b = S; // {a, b, }
/// } else {
-/// drop(b); // {a, b, }
-/// d = S; // {a, b, d }
-///
-/// } // {a, b, d }
+/// drop(b); // {a, b, }
+/// d = S; // {a, b, d }
+/// } // {a, b, d }
///
-/// c = S; // {a, b, c, d }
+/// c = S; // {a, b, c, d }
/// }
/// ```
pub struct EverInitializedPlaces<'a, 'tcx> {
diff --git a/compiler/rustc_mir_transform/src/add_retag.rs b/compiler/rustc_mir_transform/src/add_retag.rs
index 036b5589849a2..77d62108d878e 100644
--- a/compiler/rustc_mir_transform/src/add_retag.rs
+++ b/compiler/rustc_mir_transform/src/add_retag.rs
@@ -72,7 +72,7 @@ impl<'tcx> MirPass<'tcx> for AddRetag {
// FIXME: Instead of giving up for unstable places, we should introduce
// a temporary and retag on that.
is_stable(place.as_ref())
- && may_contain_reference(place.ty(&*local_decls, tcx).ty, /*depth*/ 3, tcx)
+ && may_contain_reference(place.ty(&*local_decls, tcx).ty, /* depth */ 3, tcx)
&& !local_decls[place.local].is_deref_temp()
};
let place_base_raw = |place: &Place<'tcx>| {
diff --git a/compiler/rustc_mir_transform/src/dead_store_elimination.rs b/compiler/rustc_mir_transform/src/dead_store_elimination.rs
index 3f3870cc7bad2..71c65a65fbaa5 100644
--- a/compiler/rustc_mir_transform/src/dead_store_elimination.rs
+++ b/compiler/rustc_mir_transform/src/dead_store_elimination.rs
@@ -10,7 +10,6 @@
//! 2. This idempotence persists across dest prop's main transform, in other words inserting any
//! number of iterations of dest prop between the first and second application of this transform
//! will still not cause any further changes.
-//!
use rustc_index::bit_set::BitSet;
use rustc_middle::mir::*;
diff --git a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs
index 32e738bbcea44..174fd94642be5 100644
--- a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs
+++ b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs
@@ -231,21 +231,23 @@ fn may_hoist<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, place: Place<'tcx>) ->
// let Q = val;
// if discriminant(P) == otherwise {
// let ptr = &mut Q as *mut _ as *mut u8;
- // unsafe { *ptr = 10; } // Any invalid value for the type
+ // unsafe {
+ // *ptr = 10;
+ // } // Any invalid value for the type
// }
//
// match P {
- // A => match Q {
- // A => {
- // // code
- // }
- // _ => {
- // // don't use Q
- // }
- // }
- // _ => {
- // // don't use Q
- // }
+ // A => match Q {
+ // A => {
+ // // code
+ // }
+ // _ => {
+ // // don't use Q
+ // }
+ // },
+ // _ => {
+ // // don't use Q
+ // }
// };
// ```
//
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index 852557ba7969f..7a709b827cef0 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -934,7 +934,7 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
* Integrates blocks from the callee function into the calling function.
* Updates block indices, references to locals and other control flow
* stuff.
-*/
+ */
struct Integrator<'a, 'tcx> {
args: &'a [Local],
new_locals: RangeFrom,
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index e6fc85595714b..afddf5ab61ed0 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -552,8 +552,8 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
tcx,
body,
&[
- &reveal_all::RevealAll, // has to be done before inlining, since inlined code is in RevealAll mode.
- &lower_slice_len::LowerSliceLenCalls, // has to be done before inlining, otherwise actual call will be almost always inlined. Also simple, so can just do first
+ &reveal_all::RevealAll, /* has to be done before inlining, since inlined code is in RevealAll mode. */
+ &lower_slice_len::LowerSliceLenCalls, /* has to be done before inlining, otherwise actual call will be almost always inlined. Also simple, so can just do first */
&normalize_array_len::NormalizeArrayLen, // has to run after `slice::len` lowering
&unreachable_prop::UnreachablePropagation,
&uninhabited_enum_branching::UninhabitedEnumBranching,
diff --git a/compiler/rustc_mir_transform/src/simplify.rs b/compiler/rustc_mir_transform/src/simplify.rs
index 57d372fda5697..961820eed7584 100644
--- a/compiler/rustc_mir_transform/src/simplify.rs
+++ b/compiler/rustc_mir_transform/src/simplify.rs
@@ -18,9 +18,11 @@
//! standard example of the situation is:
//!
//! ```rust
-//! fn example() {
-//! let _a: char = { return; };
-//! }
+//! fn example() {
+//! let _a: char = {
+//! return;
+//! };
+//! }
//! ```
//!
//! Here the block (`{ return; }`) has the return type `char`, rather than `()`, but the MIR we
diff --git a/compiler/rustc_mir_transform/src/simplify_try.rs b/compiler/rustc_mir_transform/src/simplify_try.rs
index baeb620ef2403..dc1e9a8b708bc 100644
--- a/compiler/rustc_mir_transform/src/simplify_try.rs
+++ b/compiler/rustc_mir_transform/src/simplify_try.rs
@@ -4,7 +4,7 @@
//! # fn foo(x: Result) -> Result {
//! match x {
//! Ok(x) => Ok(x),
-//! Err(x) => Err(x)
+//! Err(x) => Err(x),
//! }
//! # }
//! ```
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs
index 5cd7a7f760f5d..ab71f68e3c6b1 100644
--- a/compiler/rustc_monomorphize/src/collector.rs
+++ b/compiler/rustc_monomorphize/src/collector.rs
@@ -239,7 +239,7 @@ struct MonoItems<'tcx> {
// The collected mono items. The bool field in each element
// indicates whether this element should be inlined.
- items: Vec<(Spanned>, bool /*inlined*/)>,
+ items: Vec<(Spanned>, bool /* inlined */)>,
}
impl<'tcx> MonoItems<'tcx> {
@@ -1038,9 +1038,9 @@ fn should_codegen_locally<'tcx>(tcx: TyCtxt<'tcx>, instance: &Instance<'tcx>) ->
///
/// ```rust
/// struct ComplexStruct {
-/// a: u32,
-/// b: f64,
-/// c: T
+/// a: u32,
+/// b: f64,
+/// c: T,
/// }
/// ```
///
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index ae77961b7bc28..08161d5975480 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -566,14 +566,14 @@ impl<'a> Parser<'a> {
// Note: when adding new unary operators, don't forget to adjust TokenKind::can_begin_expr()
match this.token.uninterpolate().kind {
- token::Not => make_it!(this, attrs, |this, _| this.parse_unary_expr(lo, UnOp::Not)), // `!expr`
- token::Tilde => make_it!(this, attrs, |this, _| this.recover_tilde_expr(lo)), // `~expr`
+ token::Not => make_it!(this, attrs, |this, _| this.parse_unary_expr(lo, UnOp::Not)), /* `!expr` */
+ token::Tilde => make_it!(this, attrs, |this, _| this.recover_tilde_expr(lo)), /* `~expr` */
token::BinOp(token::Minus) => {
make_it!(this, attrs, |this, _| this.parse_unary_expr(lo, UnOp::Neg))
- } // `-expr`
+ } /* `-expr` */
token::BinOp(token::Star) => {
make_it!(this, attrs, |this, _| this.parse_unary_expr(lo, UnOp::Deref))
- } // `*expr`
+ } /* `*expr` */
token::BinOp(token::And) | token::AndAnd => {
make_it!(this, attrs, |this, _| this.parse_borrow_expr(lo))
}
diff --git a/compiler/rustc_query_system/src/ich/hcx.rs b/compiler/rustc_query_system/src/ich/hcx.rs
index 8140c243453bd..9f451555dd364 100644
--- a/compiler/rustc_query_system/src/ich/hcx.rs
+++ b/compiler/rustc_query_system/src/ich/hcx.rs
@@ -83,7 +83,7 @@ impl<'a> StableHashingContext<'a> {
definitions,
cstore,
source_span,
- /*always_ignore_spans=*/ false,
+ /* always_ignore_spans= */ false,
)
}
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index ab71fa0bc1d4d..08e396423aa61 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -1944,7 +1944,7 @@ impl<'a> Resolver<'a> {
// fn f() {
// let Foo: &str = "";
// println!("{}", Foo::Bar); // Name refers to local
- // // variable `Foo`.
+ // // variable `Foo`.
// }
// ```
Some(LexicalScopeBinding::Res(Res::Local(id))) => {
diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs
index 2287aa1eb2567..a193214d0b067 100644
--- a/compiler/rustc_resolve/src/ident.rs
+++ b/compiler/rustc_resolve/src/ident.rs
@@ -41,7 +41,7 @@ impl<'a> Resolver<'a> {
mut visitor: impl FnMut(
&mut Self,
Scope<'a>,
- /*use_prelude*/ bool,
+ /* use_prelude */ bool,
SyntaxContext,
) -> Option,
) -> Option {
@@ -267,10 +267,10 @@ impl<'a> Resolver<'a> {
/// the items are defined in the block. For example,
/// ```rust
/// fn f() {
- /// g(); // Since there are no local variables in scope yet, this resolves to the item.
- /// let g = || {};
- /// fn g() {}
- /// g(); // This resolves to the local variable `g` since it shadows the item.
+ /// g(); // Since there are no local variables in scope yet, this resolves to the item.
+ /// let g = || {};
+ /// fn g() {}
+ /// g(); // This resolves to the local variable `g` since it shadows the item.
/// }
/// ```
///
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs
index 5bdb427478199..c797353241928 100644
--- a/compiler/rustc_resolve/src/imports.rs
+++ b/compiler/rustc_resolve/src/imports.rs
@@ -50,8 +50,8 @@ pub enum ImportKind<'a> {
},
Glob {
is_prelude: bool,
- max_vis: Cell