Skip to content

Commit

Permalink
normalize use of backticks in compiler messages for librustc_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Samy Kacimi committed Jul 19, 2019
1 parent 527dce7 commit 19a848d
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,14 +938,14 @@ impl<'a> CrateLoader<'a> {
}
match global_allocator {
Some(Some(other_crate)) => {
self.sess.err(&format!("the #[global_allocator] in {} \
self.sess.err(&format!("the `#[global_allocator]` in {} \
conflicts with this global \
allocator in: {}",
other_crate,
data.root.name));
}
Some(None) => {
self.sess.err(&format!("the #[global_allocator] in this \
self.sess.err(&format!("the `#[global_allocator]` in this \
crate conflicts with global \
allocator in: {}", data.root.name));
}
Expand All @@ -971,7 +971,7 @@ impl<'a> CrateLoader<'a> {
if !has_default {
self.sess.err("no global memory allocator found but one is \
required; link to std or \
add #[global_allocator] to a static item \
add `#[global_allocator]` to a static item \
that implements the GlobalAlloc trait.");
}
self.sess.allocator_kind.set(Some(AllocatorKind::DefaultLib));
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_metadata/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ E0454: r##"
A link name was given with an empty name. Erroneous code example:
```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen)
#[link(name = "")] extern {} // error: #[link(name = "")] given with empty name
#[link(name = "")] extern {}
// error: `#[link(name = "")]` given with empty name
```
The rust compiler cannot link to an external library if you don't give it its
Expand Down Expand Up @@ -61,7 +62,7 @@ A link was used without a name parameter. Erroneous code example:
```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen)
#[link(kind = "dylib")] extern {}
// error: #[link(...)] specified without `name = "foo"`
// error: `#[link(...)]` specified without `name = "foo"`
```
Please add the name parameter to allow the rust compiler to find the library
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_metadata/native_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
match item.value_str() {
Some(s) => lib.wasm_import_module = Some(s),
None => {
let msg = "must be of the form #[link(wasm_import_module = \"...\")]";
let msg = "must be of the form `#[link(wasm_import_module = \"...\")]`";
self.tcx.sess.span_err(item.span(), msg);
}
}
Expand All @@ -117,7 +117,7 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
let requires_name = kind_specified || lib.wasm_import_module.is_none();
if lib.name.is_none() && requires_name {
struct_span_err!(self.tcx.sess, m.span, E0459,
"#[link(...)] specified without \
"`#[link(...)]` specified without \
`name = \"foo\"`")
.span_label(m.span, "missing `name` argument")
.emit();
Expand All @@ -136,7 +136,7 @@ impl Collector<'tcx> {
match span {
Some(span) => {
struct_span_err!(self.tcx.sess, span, E0454,
"#[link(name = \"\")] given with empty name")
"`#[link(name = \"\")]` given with empty name")
.span_label(span, "empty name given")
.emit();
}
Expand Down Expand Up @@ -187,7 +187,7 @@ impl Collector<'tcx> {
&format!("an empty renaming target was specified for library `{}`",name));
} else if !any_duplicate {
self.tcx.sess.err(&format!("renaming of the library `{}` was specified, \
however this crate contains no #[link(...)] \
however this crate contains no `#[link(...)]` \
attributes referencing this library.", name));
} else if renames.contains(name) {
self.tcx.sess.err(&format!("multiple renamings were \
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/allocator/two-allocators2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// aux-build:system-allocator.rs
// no-prefer-dynamic
// error-pattern: the #[global_allocator] in
// error-pattern: the `#[global_allocator]` in

extern crate system_allocator;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/allocator/two-allocators2.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: the #[global_allocator] in this crate conflicts with global allocator in: system_allocator
error: the `#[global_allocator]` in this crate conflicts with global allocator in: system_allocator

error: aborting due to previous error

2 changes: 1 addition & 1 deletion src/test/ui/allocator/two-allocators3.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// aux-build:system-allocator.rs
// aux-build:system-allocator2.rs
// no-prefer-dynamic
// error-pattern: the #[global_allocator] in
// error-pattern: the `#[global_allocator]` in


extern crate system_allocator;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/allocator/two-allocators3.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: the #[global_allocator] in system_allocator conflicts with this global allocator in: system_allocator2
error: the `#[global_allocator]` in system_allocator conflicts with this global allocator in: system_allocator2

error: aborting due to previous error

4 changes: 2 additions & 2 deletions src/test/ui/bad/bad-extern-link-attrs.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error[E0459]: #[link(...)] specified without `name = "foo"`
error[E0459]: `#[link(...)]` specified without `name = "foo"`
--> $DIR/bad-extern-link-attrs.rs:1:1
|
LL | #[link()]
| ^^^^^^^^^ missing `name` argument

error[E0454]: #[link(name = "")] given with empty name
error[E0454]: `#[link(name = "")]` given with empty name
--> $DIR/bad-extern-link-attrs.rs:2:1
|
LL | #[link(name = "")]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/empty/empty-linkname.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0454]: #[link(name = "")] given with empty name
error[E0454]: `#[link(name = "")]` given with empty name
--> $DIR/empty-linkname.rs:1:1
|
LL | #[link(name = "")]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0454.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0454]: #[link(name = "")] given with empty name
error[E0454]: `#[link(name = "")]` given with empty name
--> $DIR/E0454.rs:1:1
|
LL | #[link(name = "")] extern {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0458.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | #[link(kind = "wonderful_unicorn")] extern {}
| |
| unknown kind

error[E0459]: #[link(...)] specified without `name = "foo"`
error[E0459]: `#[link(...)]` specified without `name = "foo"`
--> $DIR/E0458.rs:1:1
|
LL | #[link(kind = "wonderful_unicorn")] extern {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0459.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0459]: #[link(...)] specified without `name = "foo"`
error[E0459]: `#[link(...)]` specified without `name = "foo"`
--> $DIR/E0459.rs:1:1
|
LL | #[link(kind = "dylib")] extern {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/missing/missing-allocator.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: no global memory allocator found but one is required; link to std or add #[global_allocator] to a static item that implements the GlobalAlloc trait.
error: no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait.

error: aborting due to previous error

2 changes: 1 addition & 1 deletion src/test/ui/rfc1717/missing-link-attr.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: renaming of the library `foo` was specified, however this crate contains no #[link(...)] attributes referencing this library.
error: renaming of the library `foo` was specified, however this crate contains no `#[link(...)]` attributes referencing this library.

error: aborting due to previous error

6 changes: 3 additions & 3 deletions src/test/ui/wasm-import-module.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
error: must be of the form #[link(wasm_import_module = "...")]
error: must be of the form `#[link(wasm_import_module = "...")]`
--> $DIR/wasm-import-module.rs:1:22
|
LL | #[link(name = "...", wasm_import_module)]
| ^^^^^^^^^^^^^^^^^^

error: must be of the form #[link(wasm_import_module = "...")]
error: must be of the form `#[link(wasm_import_module = "...")]`
--> $DIR/wasm-import-module.rs:4:22
|
LL | #[link(name = "...", wasm_import_module(x))]
| ^^^^^^^^^^^^^^^^^^^^^

error: must be of the form #[link(wasm_import_module = "...")]
error: must be of the form `#[link(wasm_import_module = "...")]`
--> $DIR/wasm-import-module.rs:7:22
|
LL | #[link(name = "...", wasm_import_module())]
Expand Down

0 comments on commit 19a848d

Please sign in to comment.