diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast/src/util/parser.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_ast_passes/src/ast_validation.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pprust/state.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir_pretty/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/unused.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/check/callee.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/check/op.rs | 2 |
12 files changed, 16 insertions, 16 deletions
diff --git a/compiler/rustc_ast/src/util/parser.rs b/compiler/rustc_ast/src/util/parser.rs index 078dd4bd6e6..500c97e65ef 100644 --- a/compiler/rustc_ast/src/util/parser.rs +++ b/compiler/rustc_ast/src/util/parser.rs @@ -357,13 +357,13 @@ impl ExprPrecedence { } } -/// In `let p = e`, operators with precedence `<=` this one requires parenthesis in `e`. +/// In `let p = e`, operators with precedence `<=` this one requires parentheses in `e`. pub fn prec_let_scrutinee_needs_par() -> usize { AssocOp::LAnd.precedence() } /// Suppose we have `let _ = e` and the `order` of `e`. -/// Is the `order` such that `e` in `let _ = e` needs parenthesis when it is on the RHS? +/// Is the `order` such that `e` in `let _ = e` needs parentheses when it is on the RHS? /// /// Conversely, suppose that we have `(let _ = a) OP b` and `order` is that of `OP`. /// Can we print this as `let _ = a OP b`? diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 968e9fa3e24..793f6504be6 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -113,7 +113,7 @@ impl<'a> AstValidator<'a> { if sess.opts.unstable_features.is_nightly_build() { sess.struct_span_err(expr.span, "`let` expressions are not supported here") .note("only supported directly in conditions of `if`- and `while`-expressions") - .note("as well as when nested within `&&` and parenthesis in those conditions") + .note("as well as when nested within `&&` and parentheses in those conditions") .emit(); } else { sess.struct_span_err(expr.span, "expected expression, found statement (`let`)") diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index c24882086e1..6d0589b7ba1 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -1675,7 +1675,7 @@ impl<'a> State<'a> { self.print_expr_cond_paren(expr, Self::cond_needs_par(expr)) } - // Does `expr` need parenthesis when printed in a condition position? + // Does `expr` need parentheses when printed in a condition position? // // These cases need parens due to the parse error observed in #26461: `if return {}` // parses as the erroneous construct `if (return {})`, not `if (return) {}`. diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 9196344cb3f..532f1582970 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1168,7 +1168,7 @@ impl<'a> State<'a> { self.print_expr_cond_paren(expr, Self::cond_needs_par(expr) || npals()) } - // Does `expr` need parenthesis when printed in a condition position? + // Does `expr` need parentheses when printed in a condition position? // // These cases need parens due to the parse error observed in #26461: `if return {}` // parses as the erroneous construct `if (return {})`, not `if (return) {}`. diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 48b955e41ac..da1edcf6fe3 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -670,7 +670,7 @@ declare_lint! { /// /// ### Explanation /// - /// The parenthesis are not needed, and should be removed. This is the + /// The parentheses are not needed, and should be removed. This is the /// preferred style for writing these expressions. pub(super) UNUSED_PARENS, Warn, diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 8095f386fa3..81328e09156 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -1342,10 +1342,10 @@ impl<'a> Parser<'a> { self.struct_span_err( MultiSpan::from_spans(vec![begin_par_sp, self.prev_token.span]), - "unexpected parenthesis surrounding `for` loop head", + "unexpected parentheses surrounding `for` loop head", ) .multipart_suggestion( - "remove parenthesis in `for` loop", + "remove parentheses in `for` loop", vec![(begin_par_sp, String::new()), (self.prev_token.span, String::new())], // With e.g. `for (x) in y)` this would replace `(x) in y)` // with `x) in y)` which is syntactically invalid. diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 5c701fefd17..e50b983ec62 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1258,7 +1258,7 @@ impl<'a> Parser<'a> { /// Parses `pub`, `pub(crate)` and `pub(in path)` plus shortcuts `crate` for `pub(crate)`, /// `pub(self)` for `pub(in self)` and `pub(super)` for `pub(in super)`. /// If the following element can't be a tuple (i.e., it's a function definition), then - /// it's not a tuple struct field), and the contents within the parentheses isn't valid, + /// it's not a tuple struct field), and the contents within the parentheses aren't valid, /// so emit a proper diagnostic. // Public for rustfmt usage. pub fn parse_visibility(&mut self, fbt: FollowedByType) -> PResult<'a, Visibility> { diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 9ec6effeb4e..c4569c07db4 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -328,7 +328,7 @@ impl<'a> Parser<'a> { ), ) .multipart_suggestion( - "wrap the expression in parenthesis", + "wrap the expression in parentheses", suggs, Applicability::MachineApplicable, ) @@ -349,7 +349,7 @@ impl<'a> Parser<'a> { "right curly brace `}` before `else` in a `let...else` statement not allowed", ) .multipart_suggestion( - "try wrapping the expression in parenthesis", + "try wrapping the expression in parentheses", suggs, Applicability::MachineApplicable, ) diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 98400372c36..c4c0c17addf 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -430,7 +430,7 @@ impl<'a> Parser<'a> { } // Parses the `typeof(EXPR)`. - // To avoid ambiguity, the type is surrounded by parenthesis. + // To avoid ambiguity, the type is surrounded by parentheses. fn parse_typeof_ty(&mut self) -> PResult<'a, TyKind> { self.expect(&token::OpenDelim(token::Paren))?; let expr = self.parse_anon_const_expr()?; diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 7b0dd82f0e6..1748a9be8e1 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1552,7 +1552,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { matches!(source, PathSource::TupleStruct(..)) || source.is_call(); if suggest_only_tuple_variants { // Suggest only tuple variants regardless of whether they have fields and do not - // suggest path with added parenthesis. + // suggest path with added parentheses. let mut suggestable_variants = variants .iter() .filter(|(.., kind)| *kind == CtorKind::Fn) diff --git a/compiler/rustc_typeck/src/check/callee.rs b/compiler/rustc_typeck/src/check/callee.rs index 06c42098791..5d22e300774 100644 --- a/compiler/rustc_typeck/src/check/callee.rs +++ b/compiler/rustc_typeck/src/check/callee.rs @@ -300,7 +300,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let end = callee_span.shrink_to_hi(); err.multipart_suggestion( "if you meant to create this closure and immediately call it, surround the \ - closure with parenthesis", + closure with parentheses", vec![(start, "(".to_string()), (end, ")".to_string())], Applicability::MaybeIncorrect, ); @@ -383,7 +383,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { call_expr.span, &format!( "`{}` is a unit variant, you need to write it \ - without the parenthesis", + without the parentheses", path ), path.to_string(), diff --git a/compiler/rustc_typeck/src/check/op.rs b/compiler/rustc_typeck/src/check/op.rs index 79e004a47db..1bbdf910e42 100644 --- a/compiler/rustc_typeck/src/check/op.rs +++ b/compiler/rustc_typeck/src/check/op.rs @@ -492,7 +492,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { other_ty: Ty<'tcx>, op: hir::BinOp, is_assign: IsAssign, - ) -> bool /* did we suggest to call a function because of missing parenthesis? */ { + ) -> bool /* did we suggest to call a function because of missing parentheses? */ { err.span_label(span, ty.to_string()); if let FnDef(def_id, _) = *ty.kind() { let source_map = self.tcx.sess.source_map(); |
