Skip to content

Commit e293927

Browse files
committed
Auto merge of #116443 - workingjubilee:rollup-r9mh13f, r=workingjubilee
Rollup of 5 pull requests Successful merges: - #116223 (Fix misuses of a vs an) - #116296 (More accurately point to where default return type should go) - #116429 (Diagnostics: Be more careful when suggesting struct fields) - #116431 (Tweak wording of E0562) - #116432 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 2)) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5236c8e + 4a14a80 commit e293927

File tree

132 files changed

+553
-396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+553
-396
lines changed

compiler/rustc_ast/src/token.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ impl Token {
446446
}
447447
}
448448

449-
/// Returns `true` if the token can appear at the start of an pattern.
449+
/// Returns `true` if the token can appear at the start of a pattern.
450450
///
451451
/// Shamelessly borrowed from `can_begin_expr`, only used for diagnostics right now.
452452
pub fn can_begin_pattern(&self) -> bool {

compiler/rustc_ast_lowering/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ ast_lowering_misplaced_double_dot =
9999
.note = only allowed in tuple, tuple struct, and slice patterns
100100
101101
ast_lowering_misplaced_impl_trait =
102-
`impl Trait` only allowed in function and inherent method return types, not in {$position}
102+
`impl Trait` only allowed in function and inherent method argument and return types, not in {$position}
103103
104104
ast_lowering_misplaced_relax_trait_bound =
105105
`?Trait` bounds are only permitted at the point where a type parameter is declared

compiler/rustc_attr/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub enum StabilityLevel {
162162
is_soft: bool,
163163
/// If part of a feature is stabilized and a new feature is added for the remaining parts,
164164
/// then the `implied_by` attribute is used to indicate which now-stable feature previously
165-
/// contained a item.
165+
/// contained an item.
166166
///
167167
/// ```pseudo-Rust
168168
/// #[unstable(feature = "foo", issue = "...")]

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13641364
err.note(format!(
13651365
"a for loop advances the iterator for you, the result is stored in `{loop_bind}`."
13661366
));
1367-
err.help("if you want to call `next` on a iterator within the loop, consider using `while let`.");
1367+
err.help("if you want to call `next` on an iterator within the loop, consider using `while let`.");
13681368
}
13691369
}
13701370

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1359,9 +1359,9 @@ fn suggest_ampmut<'tcx>(
13591359
None => (false, decl_span),
13601360
};
13611361

1362-
// if the binding already exists and is a reference with a explicit
1362+
// if the binding already exists and is a reference with an explicit
13631363
// lifetime, then we can suggest adding ` mut`. this is special-cased from
1364-
// the path without a explicit lifetime.
1364+
// the path without an explicit lifetime.
13651365
if let Ok(src) = tcx.sess.source_map().span_to_snippet(span)
13661366
&& src.starts_with("&'")
13671367
// note that `& 'a T` is invalid so this is correct.

compiler/rustc_borrowck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19671967
Reservation(WriteKind::MutableBorrow(BorrowKind::Mut { kind: mut_borrow_kind }))
19681968
| Write(WriteKind::MutableBorrow(BorrowKind::Mut { kind: mut_borrow_kind })) => {
19691969
let is_local_mutation_allowed = match mut_borrow_kind {
1970-
// `ClosureCapture` is used for mutable variable with a immutable binding.
1970+
// `ClosureCapture` is used for mutable variable with an immutable binding.
19711971
// This is only behaviour difference between `ClosureCapture` and mutable borrows.
19721972
MutBorrowKind::ClosureCapture => LocalMutationIsAllowed::Yes,
19731973
MutBorrowKind::Default | MutBorrowKind::TwoPhaseBorrow => {

compiler/rustc_borrowck/src/universal_regions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct UniversalRegionIndices<'tcx> {
164164
/// be able to map them to our internal `RegionVid`. This is
165165
/// basically equivalent to an `GenericArgs`, except that it also
166166
/// contains an entry for `ReStatic` -- it might be nice to just
167-
/// use a args, and then handle `ReStatic` another way.
167+
/// use an args, and then handle `ReStatic` another way.
168168
indices: FxHashMap<ty::Region<'tcx>, RegionVid>,
169169

170170
/// The vid assigned to `'static`. Used only for diagnostics.
@@ -290,7 +290,7 @@ impl<'tcx> UniversalRegions<'tcx> {
290290
(FIRST_GLOBAL_INDEX..self.num_universals).map(RegionVid::from_usize)
291291
}
292292

293-
/// Returns `true` if `r` is classified as an local region.
293+
/// Returns `true` if `r` is classified as a local region.
294294
pub fn is_local_free_region(&self, r: RegionVid) -> bool {
295295
self.region_classification(r) == Some(RegionClassification::Local)
296296
}

compiler/rustc_codegen_cranelift/src/abi/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn clif_sig_from_fn_abi<'tcx>(
3030
let inputs = fn_abi.args.iter().flat_map(|arg_abi| arg_abi.get_abi_param(tcx).into_iter());
3131

3232
let (return_ptr, returns) = fn_abi.ret.get_abi_return(tcx);
33-
// Sometimes the first param is an pointer to the place where the return value needs to be stored.
33+
// Sometimes the first param is a pointer to the place where the return value needs to be stored.
3434
let params: Vec<_> = return_ptr.into_iter().chain(inputs).collect();
3535

3636
Signature { params, returns, call_conv }

compiler/rustc_codegen_llvm/src/type_.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'ll> CodegenCx<'ll, '_> {
112112
}
113113
}
114114

115-
/// Return a LLVM type that has at most the required alignment,
115+
/// Return an LLVM type that has at most the required alignment,
116116
/// and exactly the required size, as a best-effort padding array.
117117
pub(crate) fn type_padding_filler(&self, size: Size, align: Align) -> &'ll Type {
118118
let unit = Integer::approximate_align(self, align);

compiler/rustc_codegen_ssa/src/traits/type_.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
3030
fn type_ptr_ext(&self, address_space: AddressSpace) -> Self::Type;
3131
fn element_type(&self, ty: Self::Type) -> Self::Type;
3232

33-
/// Returns the number of elements in `self` if it is a LLVM vector type.
33+
/// Returns the number of elements in `self` if it is an LLVM vector type.
3434
fn vector_length(&self, ty: Self::Type) -> usize;
3535

3636
fn float_width(&self, ty: Self::Type) -> usize;

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ fn report_trait_method_mismatch<'tcx>(
11891189
let ap = Applicability::MachineApplicable;
11901190
match sig.decl.output {
11911191
hir::FnRetTy::DefaultReturn(sp) => {
1192-
let sugg = format!("-> {} ", trait_sig.output());
1192+
let sugg = format!(" -> {}", trait_sig.output());
11931193
diag.span_suggestion_verbose(sp, msg, sugg, ap);
11941194
}
11951195
hir::FnRetTy::Return(hir_ty) => {

compiler/rustc_hir_typeck/src/check.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ pub(super) fn check_fn<'a, 'tcx>(
113113

114114
fcx.typeck_results.borrow_mut().liberated_fn_sigs_mut().insert(fn_id, fn_sig);
115115

116-
fcx.require_type_is_sized(declared_ret_ty, decl.output.span(), traits::SizedReturnType);
116+
let return_or_body_span = match decl.output {
117+
hir::FnRetTy::DefaultReturn(_) => body.value.span,
118+
hir::FnRetTy::Return(ty) => ty.span,
119+
};
120+
fcx.require_type_is_sized(declared_ret_ty, return_or_body_span, traits::SizedReturnType);
117121
fcx.check_return_expr(&body.value, false);
118122

119123
// We insert the deferred_generator_interiors entry after visiting the body.

compiler/rustc_hir_typeck/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub struct AddressOfTemporaryTaken {
110110
pub enum AddReturnTypeSuggestion {
111111
#[suggestion(
112112
hir_typeck_add_return_type_add,
113-
code = "-> {found} ",
113+
code = " -> {found}",
114114
applicability = "machine-applicable"
115115
)]
116116
Add {
@@ -120,7 +120,7 @@ pub enum AddReturnTypeSuggestion {
120120
},
121121
#[suggestion(
122122
hir_typeck_add_return_type_missing_here,
123-
code = "-> _ ",
123+
code = " -> _",
124124
applicability = "has-placeholders"
125125
)]
126126
MissingHere {

0 commit comments

Comments
 (0)