Skip to content

Commit

Permalink
Auto merge of #68080 - varkor:declared-here, r=petrochenkov
Browse files Browse the repository at this point in the history
Address inconsistency in using "is" with "declared here"

"is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout.

r? @Centril
  • Loading branch information
bors committed Jan 31, 2020
2 parents ecde10f + 4583283 commit 5371ddf
Show file tree
Hide file tree
Showing 384 changed files with 439 additions and 439 deletions.
2 changes: 1 addition & 1 deletion src/librustc/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ pub fn struct_lint_level<'a>(
&mut err,
DiagnosticMessageId::from(lint),
src,
"lint level defined here",
"the lint level is defined here",
);
if lint_attr_name.as_str() != name {
let level_str = level.as_str();
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,17 @@ impl LanguageItemCollector<'tcx> {
},
};
if let Some(span) = self.tcx.hir().span_if_local(original_def_id) {
err.span_note(span, "first defined here");
err.span_note(span, "the lang item is first defined here");
} else {
match self.tcx.extern_crate(original_def_id) {
Some(ExternCrate {dependency_of, ..}) => {
err.note(&format!(
"first defined in crate `{}` (which `{}` depends on)",
"the lang item is first defined in crate `{}` (which `{}` depends on)",
self.tcx.crate_name(original_def_id.krate),
self.tcx.crate_name(*dependency_of)));
},
_ => {
err.note(&format!("first defined in crate `{}`.",
err.note(&format!("the lang item is first defined in crate `{}`.",
self.tcx.crate_name(original_def_id.krate)));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
diag.note(note);
if let ty::Adt(def, _) = ty.kind {
if let Some(sp) = self.cx.tcx.hir().span_if_local(def.did) {
diag.span_note(sp, "type defined here");
diag.span_note(sp, "the type is defined here");
}
}
diag.emit();
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ impl<'a> CrateLoader<'a> {
self.sess
.struct_span_err(*span2, "cannot define multiple global allocators")
.span_label(*span2, "cannot define a new global allocator")
.span_label(*span1, "previous global allocator is defined here")
.span_label(*span1, "previous global allocator defined here")
.emit();
true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {

err.span_label(
upvar_span,
format!("`{}` is declared here, outside of the {} body", upvar_name, escapes_from),
format!("`{}` declared here, outside of the {} body", upvar_name, escapes_from),
);

err.span_label(borrow_span, format!("borrow is only valid in the {} body", escapes_from));
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
diag.span_label(
outlived_fr_span,
format!(
"`{}` is declared here, outside of the {} body",
"`{}` declared here, outside of the {} body",
outlived_fr_name, escapes_from
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/check_consts/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ fn check_short_circuiting_in_const_local(item: &Item<'_, 'tcx>) {
}
for local in locals {
let span = body.local_decls[local].source_info.span;
error.span_note(span, "more locals defined here");
error.span_note(span, "more locals are defined here");
}
error.emit();
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_passes/diagnostic_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ fn collect_item(
)),
};
if let Some(span) = tcx.hir().span_if_local(original_def_id) {
err.span_note(span, "first defined here");
err.span_note(span, "the diagnostic item is first defined here");
} else {
err.note(&format!(
"first defined in crate `{}`.",
"the diagnostic item is first defined in crate `{}`.",
tcx.crate_name(original_def_id.krate)
));
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2220,7 +2220,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

let mut could_refer_to = |kind: DefKind, def_id, also| {
let note_msg = format!(
"`{}` could{} refer to {} defined here",
"`{}` could{} refer to the {} defined here",
assoc_ident,
also,
kind.descr(def_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `[v2]` cannot be resolved, ignoring it.
LL | /// [v2]
| ^^ cannot be resolved, ignoring
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/deny-intra-link-resolution-failure.rs:1:9
|
LL | #![deny(intra_doc_link_resolution_failure)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/deny-missing-docs-crate.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | |
LL | | pub struct Foo;
| |_______________^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/deny-missing-docs-crate.rs:1:9
|
LL | #![deny(missing_docs)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/deny-missing-docs-macro.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: missing documentation for macro
LL | macro_rules! foo {
| ^^^^^^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/deny-missing-docs-macro.rs:3:9
|
LL | #![deny(missing_docs)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/doc-without-codeblock.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL | | pub fn bar() {}
LL | | }
| |_^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/doc-without-codeblock.rs:1:9
|
LL | #![deny(missing_doc_code_examples)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/intra-doc-alias-ice.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `[TypeAlias::hoge]` cannot be resolved, ignoring it.
LL | /// [broken cross-reference](TypeAlias::hoge)
| ^^^^^^^^^^^^^^^ cannot be resolved, ignoring
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/intra-doc-alias-ice.rs:1:9
|
LL | #![deny(intra_doc_link_resolution_failure)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/intra-link-span-ice-55723.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `[i]` cannot be resolved, ignoring it.
LL | /// (arr[i])
| ^ cannot be resolved, ignoring
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/intra-link-span-ice-55723.rs:1:9
|
LL | #![deny(intra_doc_link_resolution_failure)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/intra-links-ambiguity.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `ambiguous` is both a struct and a function
LL | /// [`ambiguous`] is ambiguous.
| ^^^^^^^^^^^ ambiguous link
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/intra-links-ambiguity.rs:1:9
|
LL | #![deny(intra_doc_link_resolution_failure)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/intra-links-anchors.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `[Foo::f#hola]` has an issue with the link anchor.
LL | /// Or maybe [Foo::f#hola].
| ^^^^^^^^^^^ struct fields cannot be followed by anchors
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/intra-links-anchors.rs:1:9
|
LL | #![deny(intra_doc_link_resolution_failure)]
Expand Down
6 changes: 3 additions & 3 deletions src/test/rustdoc-ui/lint-group.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | | /// println!("sup");
LL | | /// ```
| |_______^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc)]
Expand All @@ -21,7 +21,7 @@ error: `[error]` cannot be resolved, ignoring it.
LL | /// what up, let's make an [error]
| ^^^^^ cannot be resolved, ignoring
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc)]
Expand All @@ -35,7 +35,7 @@ error: missing code example in this documentation
LL | /// wait, this doesn't have a doctest?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/lint-missing-doc-code-example.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | / mod module1 {
LL | | }
| |_^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/lint-missing-doc-code-example.rs:2:9
|
LL | #![deny(missing_doc_code_examples)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/private-item-doc-test.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | | /// assert!(false);
LL | | /// ```
| |___________^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/private-item-doc-test.rs:1:9
|
LL | #![deny(private_doc_tests)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: Prefer FxHashMap over HashMap, it has better performance
LL | let _map: HashMap<String, String> = HashMap::default();
| ^^^^^^^ help: use: `FxHashMap`
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/default_hash_types.rs:10:8
|
LL | #[deny(rustc::default_hash_types)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: implementing `LintPass` by hand
LL | impl LintPass for Foo {
| ^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/lint_pass_impl_without_macro.rs:4:9
|
LL | #![deny(rustc::lint_pass_impl_without_macro)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: passing `Ty<'_>` by reference
LL | ty_ref: &Ty<'_>,
| ^^^^^^^ help: try passing by value: `Ty<'_>`
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/pass_ty_by_ref.rs:4:9
|
LL | #![deny(rustc::ty_pass_by_reference)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: usage of qualified `ty::Ty<'_>`
LL | ty_q: ty::Ty<'_>,
| ^^^^^^^^^^ help: try using it unqualified: `Ty<'_>`
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/qualified_ty_ty_ctxt.rs:4:9
|
LL | #![deny(rustc::usage_of_qualified_ty)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: usage of `ty::TyKind::<kind>`
LL | let kind = TyKind::Bool;
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/ty_tykind_usage.rs:9:8
|
LL | #[deny(rustc::usage_of_ty_tykind)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/lint-plugin-deny-attr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ error: item is named 'lintme'
LL | fn lintme() { }
| ^^^^^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/lint-plugin-deny-attr.rs:7:9
|
LL | #![deny(test_lint)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ error: item is named 'lintme'
LL | fn lintme() { }
| ^^^^^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/lint-plugin-forbid-attrs.rs:7:11
|
LL | #![forbid(test_lint)]
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui-fulldeps/lint-tool-test.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ error: item is named 'lintme'
LL | fn lintme() { }
| ^^^^^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/lint-tool-test.rs:13:9
|
LL | #![deny(clippy_group)]
Expand All @@ -83,7 +83,7 @@ error: item is named 'lintmetoo'
LL | fn lintmetoo() { }
| ^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/lint-tool-test.rs:13:9
|
LL | #![deny(clippy_group)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/allocator/two-allocators.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: cannot define multiple global allocators
--> $DIR/two-allocators.rs:6:1
|
LL | static A: System = System;
| -------------------------- previous global allocator is defined here
| -------------------------- previous global allocator defined here
LL | #[global_allocator]
LL | static B: System = System;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/anon-params-deprecated.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edi
LL | fn foo(i32);
| ^^^ help: try naming the parameter or explicitly ignoring it: `_: i32`
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/anon-params-deprecated.rs:1:9
|
LL | #![warn(anonymous_parameters)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: associated const is never used: `BAR`
LL | const BAR: u32 = 1;
| ^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/associated-const-dead-code.rs:1:9
|
LL | #![deny(dead_code)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `await` is a keyword in the 2018 edition
LL | pub mod await {
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/2015-edition-error-various-positions.rs:2:9
|
LL | #![deny(keyword_idents)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `await` is a keyword in the 2018 edition
LL | pub mod await {
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/2015-edition-warning.rs:4:9
|
LL | #![deny(keyword_idents)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/unreachable-lint-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | return; bar().await;
| |
| any code following this expression is unreachable
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/unreachable-lint-1.rs:2:9
|
LL | #![deny(unreachable_code)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/unused-lifetime.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: lifetime parameter `'a` never used
LL | pub async fn func_with_unused_lifetime<'a>(s: &'a str) {
| ^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/unused-lifetime.rs:7:9
|
LL | #![deny(unused_lifetimes)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/attributes/register-attr-tool-unused.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: unused attribute
LL | #[register_attr(attr)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/register-attr-tool-unused.rs:1:9
|
LL | #![deny(unused)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/bad/bad-lint-cap2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: unused import: `std::option`
LL | use std::option;
| ^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/bad-lint-cap2.rs:4:9
|
LL | #![deny(warnings)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/bad/bad-lint-cap3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ warning: unused import: `std::option`
LL | use std::option;
| ^^^^^^^^^^^
|
note: lint level defined here
note: the lint level is defined here
--> $DIR/bad-lint-cap3.rs:5:9
|
LL | #![deny(warnings)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/issue-45983.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0521]: borrowed data escapes outside of closure
--> $DIR/issue-45983.rs:20:18
|
LL | let x = None;
| - `x` is declared here, outside of the closure body
| - `x` declared here, outside of the closure body
LL | give_any(|y| x = Some(y));
| - ^^^^^^^^^^^ `y` escapes the closure body here
| |
Expand Down
Loading

0 comments on commit 5371ddf

Please sign in to comment.