Skip to content

Commit 9668ae5

Browse files
authored
Rollup merge of #108726 - est31:backticks_matchmaking_tidy, r=Nilstrieb
tidy: enforce comment blocks to have an even number of backticks After PR #108694, most unmatched backticks in `compiler/` comments have been eliminated. This PR adds a tidy lint to ensure no new unmatched backticks are added, and either addresses the lint in the remaining instances it found, or allows it. Very often, backtick containing sections wrap around lines, for example: ```Rust // This function takes a tuple `(Vec<String>, // Box<[u8]>)` and transforms it into `Vec<u8>`. ``` The lint is implemented to work on top of blocks, counting each line with a `//` into a block, and counting if there are an odd or even number of backticks in the entire block, instead of looking at just a single line.
2 parents 501ad02 + b2aeb07 commit 9668ae5

File tree

12 files changed

+69
-21
lines changed

12 files changed

+69
-21
lines changed

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ impl<'a> MethodDef<'a> {
10521052
/// ::core::hash::Hash::hash(&{ self.y }, state)
10531053
/// }
10541054
/// }
1055+
/// ```
10551056
fn expand_struct_method_body<'b>(
10561057
&self,
10571058
cx: &mut ExtCtxt<'_>,

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ fn build_enum_variant_member_di_node<'ll, 'tcx>(
438438
/// DW_TAG_structure_type (type of variant 1)
439439
/// DW_TAG_structure_type (type of variant 2)
440440
/// DW_TAG_structure_type (type of variant 3)
441+
/// ```
441442
struct VariantMemberInfo<'a, 'll> {
442443
variant_index: VariantIdx,
443444
variant_name: Cow<'a, str>,

compiler/rustc_error_codes/src/error_codes/E0368.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl Add for Foo {
4141
4242
fn main() {
4343
let mut x: Foo = Foo(5);
44-
x += Foo(7); // error, `+= cannot be applied to the type `Foo`
44+
x += Foo(7); // error, `+=` cannot be applied to the type `Foo`
4545
}
4646
```
4747

compiler/rustc_error_codes/src/error_codes/E0710.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ An unknown tool name was found in a scoped lint.
33
Erroneous code examples:
44

55
```compile_fail,E0710
6-
#[allow(clipp::filter_map)] // error!`
6+
#[allow(clipp::filter_map)] // error!
77
fn main() {
88
// business logic
99
}
1010
```
1111

1212
```compile_fail,E0710
13-
#[warn(clipp::filter_map)] // error!`
13+
#[warn(clipp::filter_map)] // error!
1414
fn main() {
1515
// business logic
1616
}

compiler/rustc_hir_typeck/src/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
398398
///
399399
/// Here:
400400
/// - E would be `fn(&u32) -> &u32`.
401-
/// - S would be `fn(&u32) ->
401+
/// - S would be `fn(&u32) -> ?T`
402402
/// - E' is `&'!0 u32 -> &'!0 u32`
403403
/// - S' is `&'?0 u32 -> ?T`
404404
///

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
104104
let (mention_influencer, influencer_point) =
105105
if sup_origin.span().overlaps(param.param_ty_span) {
106106
// Account for `async fn` like in `async-await/issues/issue-62097.rs`.
107-
// The desugaring of `async `fn`s causes `sup_origin` and `param` to point at the same
107+
// The desugaring of `async fn`s causes `sup_origin` and `param` to point at the same
108108
// place (but with different `ctxt`, hence `overlaps` instead of `==` above).
109109
//
110110
// This avoids the following:

compiler/rustc_middle/src/mir/pretty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ fn dump_matched_mir_node<'tcx, F>(
123123
// see notes on #41697 above
124124
let def_path =
125125
ty::print::with_forced_impl_filename_line!(tcx.def_path_str(body.source.def_id()));
126+
// ignore-tidy-odd-backticks the literal below is fine
126127
write!(file, "// MIR for `{}", def_path)?;
127128
match body.source.promoted {
128129
None => write!(file, "`")?,

compiler/rustc_mir_build/src/build/matches/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
18861886
// let place = Foo::new();
18871887
// match place { Foo { .. } if { let tmp1 = &place; inspect(*tmp1) }
18881888
// => { let tmp2 = place; feed(tmp2) }, ... }
1889+
// ```
18891890
//
18901891
// And an input like:
18911892
//

compiler/rustc_trait_selection/src/solve/assembly.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
248248
///
249249
/// To deal with this, we first try to normalize the self type and add the candidates for the normalized
250250
/// self type to the list of candidates in case that succeeds. Note that we can't just eagerly return in
251-
/// this case as projections as self types add `
251+
/// this case as projections as self types add
252+
// FIXME complete the unfinished sentence above
252253
fn assemble_candidates_after_normalizing_self_ty<G: GoalKind<'tcx>>(
253254
&mut self,
254255
goal: Goal<'tcx, G>,

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2220,7 +2220,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
22202220
// - `BuiltinDerivedObligation` with a generator witness (A)
22212221
// - `BuiltinDerivedObligation` with a generator (A)
22222222
// - `BuiltinDerivedObligation` with `impl std::future::Future` (A)
2223-
// - `BindingObligation` with `impl_send (Send requirement)
2223+
// - `BindingObligation` with `impl_send` (Send requirement)
22242224
//
22252225
// The first obligation in the chain is the most useful and has the generator that captured
22262226
// the type. The last generator (`outer_generator` below) has information about where the

0 commit comments

Comments
 (0)