Skip to content

Commit 83460d5

Browse files
committed
Auto merge of #94966 - matthiaskrgr:rollup-iqzswh3, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #94810 (debuginfo: Fix bug in type name generation for dyn types with associated types but no other generic arguments.) - #94947 (fix typos) - #94956 (Fix small typo in FIXME) - #94958 (Support other types of pluralization in pluralize macro) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents be52b4a + 183262d commit 83460d5

File tree

27 files changed

+78
-52
lines changed

27 files changed

+78
-52
lines changed

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,18 @@ fn push_debuginfo_type_name<'tcx>(
226226
if projection_bounds.len() != 0 {
227227
if principal_has_generic_params {
228228
// push_generic_params_internal() above added a `>` but we actually
229-
// want to add more items to that list, so remove that again.
229+
// want to add more items to that list, so remove that again...
230230
pop_close_angle_bracket(output);
231+
// .. and add a comma to separate the regular generic args from the
232+
// associated types.
233+
push_arg_separator(cpp_like_debuginfo, output);
234+
} else {
235+
// push_generic_params_internal() did not add `<...>`, so we open
236+
// angle brackets here.
237+
output.push('<');
231238
}
232239

233240
for (item_def_id, ty) in projection_bounds {
234-
push_arg_separator(cpp_like_debuginfo, output);
235-
236241
if cpp_like_debuginfo {
237242
output.push_str("assoc$<");
238243
push_item_name(tcx, item_def_id, false, output);
@@ -244,8 +249,10 @@ fn push_debuginfo_type_name<'tcx>(
244249
output.push('=');
245250
push_debuginfo_type_name(tcx, ty, true, output, visited);
246251
}
252+
push_arg_separator(cpp_like_debuginfo, output);
247253
}
248254

255+
pop_arg_separator(output);
249256
push_close_angle_bracket(cpp_like_debuginfo, output);
250257
}
251258

compiler/rustc_index/src/bit_set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ impl<T: Idx> BitRelations<HybridBitSet<T>> for ChunkedBitSet<T> {
656656
fn union(&mut self, other: &HybridBitSet<T>) -> bool {
657657
// FIXME: This is slow if `other` is dense, but it hasn't been a problem
658658
// in practice so far.
659-
// If a a faster implementation of this operation is required, consider
659+
// If a faster implementation of this operation is required, consider
660660
// reopening https://github.com/rust-lang/rust/pull/94625
661661
assert_eq!(self.domain_size, other.domain_size());
662662
sequential_update(|elem| self.insert(elem), other.iter())
@@ -665,7 +665,7 @@ impl<T: Idx> BitRelations<HybridBitSet<T>> for ChunkedBitSet<T> {
665665
fn subtract(&mut self, other: &HybridBitSet<T>) -> bool {
666666
// FIXME: This is slow if `other` is dense, but it hasn't been a problem
667667
// in practice so far.
668-
// If a a faster implementation of this operation is required, consider
668+
// If a faster implementation of this operation is required, consider
669669
// reopening https://github.com/rust-lang/rust/pull/94625
670670
assert_eq!(self.domain_size, other.domain_size());
671671
sequential_update(|elem| self.remove(elem), other.iter())

compiler/rustc_lint/src/builtin.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl UnsafeCode {
328328
cx.struct_span_lint(UNSAFE_CODE, span, decorate);
329329
}
330330

331-
fn report_overriden_symbol_name(&self, cx: &EarlyContext<'_>, span: Span, msg: &str) {
331+
fn report_overridden_symbol_name(&self, cx: &EarlyContext<'_>, span: Span, msg: &str) {
332332
self.report_unsafe(cx, span, |lint| {
333333
lint.build(msg)
334334
.note(
@@ -380,14 +380,14 @@ impl EarlyLintPass for UnsafeCode {
380380

381381
ast::ItemKind::Fn(..) => {
382382
if let Some(attr) = cx.sess().find_by_name(&it.attrs, sym::no_mangle) {
383-
self.report_overriden_symbol_name(
383+
self.report_overridden_symbol_name(
384384
cx,
385385
attr.span,
386386
"declaration of a `no_mangle` function",
387387
);
388388
}
389389
if let Some(attr) = cx.sess().find_by_name(&it.attrs, sym::export_name) {
390-
self.report_overriden_symbol_name(
390+
self.report_overridden_symbol_name(
391391
cx,
392392
attr.span,
393393
"declaration of a function with `export_name`",
@@ -397,14 +397,14 @@ impl EarlyLintPass for UnsafeCode {
397397

398398
ast::ItemKind::Static(..) => {
399399
if let Some(attr) = cx.sess().find_by_name(&it.attrs, sym::no_mangle) {
400-
self.report_overriden_symbol_name(
400+
self.report_overridden_symbol_name(
401401
cx,
402402
attr.span,
403403
"declaration of a `no_mangle` static",
404404
);
405405
}
406406
if let Some(attr) = cx.sess().find_by_name(&it.attrs, sym::export_name) {
407-
self.report_overriden_symbol_name(
407+
self.report_overridden_symbol_name(
408408
cx,
409409
attr.span,
410410
"declaration of a static with `export_name`",
@@ -419,14 +419,14 @@ impl EarlyLintPass for UnsafeCode {
419419
fn check_impl_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
420420
if let ast::AssocItemKind::Fn(..) = it.kind {
421421
if let Some(attr) = cx.sess().find_by_name(&it.attrs, sym::no_mangle) {
422-
self.report_overriden_symbol_name(
422+
self.report_overridden_symbol_name(
423423
cx,
424424
attr.span,
425425
"declaration of a `no_mangle` method",
426426
);
427427
}
428428
if let Some(attr) = cx.sess().find_by_name(&it.attrs, sym::export_name) {
429-
self.report_overriden_symbol_name(
429+
self.report_overridden_symbol_name(
430430
cx,
431431
attr.span,
432432
"declaration of a method with `export_name`",

compiler/rustc_lint/src/levels.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'s> LintLevelsBuilder<'s> {
116116
continue
117117
};
118118
for id in ids {
119-
// ForceWarn and Forbid cannot be overriden
119+
// ForceWarn and Forbid cannot be overridden
120120
if let Some((Level::ForceWarn | Level::Forbid, _)) = self.current_specs().get(&id) {
121121
continue;
122122
}
@@ -137,7 +137,7 @@ impl<'s> LintLevelsBuilder<'s> {
137137
self.sets.get_lint_level(id.lint, self.cur, Some(self.current_specs()), &self.sess);
138138
// Setting to a non-forbid level is an error if the lint previously had
139139
// a forbid level. Note that this is not necessarily true even with a
140-
// `#[forbid(..)]` attribute present, as that is overriden by `--cap-lints`.
140+
// `#[forbid(..)]` attribute present, as that is overridden by `--cap-lints`.
141141
//
142142
// This means that this only errors if we're truly lowering the lint
143143
// level from forbid.

compiler/rustc_lint_defs/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ macro_rules! pluralize {
2020
($x:expr) => {
2121
if $x != 1 { "s" } else { "" }
2222
};
23+
("is", $x:expr) => {
24+
if $x == 1 { "is" } else { "are" }
25+
};
26+
("this", $x:expr) => {
27+
if $x == 1 { "this" } else { "these" }
28+
};
2329
}
2430

2531
/// Indicates the confidence in the correctness of a suggestion.

compiler/rustc_middle/src/mir/generic_graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn bb_to_graph_node(block: BasicBlock, body: &Body<'_>, dark_mode: bool) -> Node
5050
let style = NodeStyle { title_bg: Some(bgcolor.to_owned()), ..Default::default() };
5151
let mut stmts: Vec<String> = data.statements.iter().map(|x| format!("{:?}", x)).collect();
5252

53-
// add the terminator to the stmts, gsgdt can print it out seperately
53+
// add the terminator to the stmts, gsgdt can print it out separately
5454
let mut terminator_head = String::new();
5555
data.terminator().kind.fmt_head(&mut terminator_head).unwrap();
5656
stmts.push(terminator_head);

compiler/rustc_middle/src/mir/interpret/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
400400
Pointer::new(*alloc, access.access_offset),
401401
access.uninit_size.bytes(),
402402
pluralize!(access.uninit_size.bytes()),
403-
if access.uninit_size.bytes() != 1 { "are" } else { "is" },
403+
pluralize!("is", access.uninit_size.bytes()),
404404
Pointer::new(*alloc, access.uninit_offset),
405405
),
406406
InvalidUninitBytes(None) => write!(

compiler/rustc_middle/src/mir/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ pub struct BorrowCheckResult<'tcx> {
250250

251251
/// The result of the `mir_const_qualif` query.
252252
///
253-
/// Each field (except `error_occured`) corresponds to an implementer of the `Qualif` trait in
253+
/// Each field (except `error_occurred`) corresponds to an implementer of the `Qualif` trait in
254254
/// `rustc_const_eval/src/transform/check_consts/qualifs.rs`. See that file for more information on each
255255
/// `Qualif`.
256256
#[derive(Clone, Copy, Debug, Default, TyEncodable, TyDecodable, HashStable)]

compiler/rustc_middle/src/ty/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ fn foo(&self) -> Self::T { String::new() }
847847
"{some} method{s} {are} available that return{r} `{ty}`",
848848
some = if methods.len() == 1 { "a" } else { "some" },
849849
s = pluralize!(methods.len()),
850-
are = if methods.len() == 1 { "is" } else { "are" },
850+
are = pluralize!("is", methods.len()),
851851
r = if methods.len() == 1 { "s" } else { "" },
852852
ty = expected
853853
);

compiler/rustc_mir_build/src/check_unsafety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalD
608608

609609
let (thir, expr) = tcx.thir_body(def);
610610
let thir = &thir.borrow();
611-
// If `thir` is empty, a type error occured, skip this body.
611+
// If `thir` is empty, a type error occurred, skip this body.
612612
if thir.exprs.is_empty() {
613613
return;
614614
}

0 commit comments

Comments
 (0)