diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 2073b317939d7..126cfec157ff3 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -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)); } @@ -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)); diff --git a/src/librustc_metadata/error_codes.rs b/src/librustc_metadata/error_codes.rs index 7c63173659135..909fca2ab586f 100644 --- a/src/librustc_metadata/error_codes.rs +++ b/src/librustc_metadata/error_codes.rs @@ -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 @@ -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 diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 5da5384f8aaa7..66971bb6f8b1c 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -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); } } @@ -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(); @@ -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(); } @@ -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 \ diff --git a/src/test/ui/allocator/two-allocators2.rs b/src/test/ui/allocator/two-allocators2.rs index 96da780e4a254..6dfefe19c7fa4 100644 --- a/src/test/ui/allocator/two-allocators2.rs +++ b/src/test/ui/allocator/two-allocators2.rs @@ -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; diff --git a/src/test/ui/allocator/two-allocators2.stderr b/src/test/ui/allocator/two-allocators2.stderr index 2b23ce38ede76..b1fb4421ea048 100644 --- a/src/test/ui/allocator/two-allocators2.stderr +++ b/src/test/ui/allocator/two-allocators2.stderr @@ -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 diff --git a/src/test/ui/allocator/two-allocators3.rs b/src/test/ui/allocator/two-allocators3.rs index 8a06335c0318a..31dea2d4478f7 100644 --- a/src/test/ui/allocator/two-allocators3.rs +++ b/src/test/ui/allocator/two-allocators3.rs @@ -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; diff --git a/src/test/ui/allocator/two-allocators3.stderr b/src/test/ui/allocator/two-allocators3.stderr index 86e385a96a1b6..ecffb192e2acb 100644 --- a/src/test/ui/allocator/two-allocators3.stderr +++ b/src/test/ui/allocator/two-allocators3.stderr @@ -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 diff --git a/src/test/ui/bad/bad-extern-link-attrs.stderr b/src/test/ui/bad/bad-extern-link-attrs.stderr index 18b0dc9ea386e..525c605a9cf67 100644 --- a/src/test/ui/bad/bad-extern-link-attrs.stderr +++ b/src/test/ui/bad/bad-extern-link-attrs.stderr @@ -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 = "")] diff --git a/src/test/ui/empty/empty-linkname.stderr b/src/test/ui/empty/empty-linkname.stderr index df41cb894139c..b9d1841f16ca3 100644 --- a/src/test/ui/empty/empty-linkname.stderr +++ b/src/test/ui/empty/empty-linkname.stderr @@ -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 = "")] diff --git a/src/test/ui/error-codes/E0454.stderr b/src/test/ui/error-codes/E0454.stderr index 352c3baa83aa2..499162694e57d 100644 --- a/src/test/ui/error-codes/E0454.stderr +++ b/src/test/ui/error-codes/E0454.stderr @@ -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 {} diff --git a/src/test/ui/error-codes/E0458.stderr b/src/test/ui/error-codes/E0458.stderr index d60fd96c77936..51f7764aaf283 100644 --- a/src/test/ui/error-codes/E0458.stderr +++ b/src/test/ui/error-codes/E0458.stderr @@ -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 {} diff --git a/src/test/ui/error-codes/E0459.stderr b/src/test/ui/error-codes/E0459.stderr index da7069fbb477b..c618fea9afc8a 100644 --- a/src/test/ui/error-codes/E0459.stderr +++ b/src/test/ui/error-codes/E0459.stderr @@ -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 {} diff --git a/src/test/ui/missing/missing-allocator.stderr b/src/test/ui/missing/missing-allocator.stderr index 11e0085d1ce2e..59648c42a5f31 100644 --- a/src/test/ui/missing/missing-allocator.stderr +++ b/src/test/ui/missing/missing-allocator.stderr @@ -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 diff --git a/src/test/ui/rfc1717/missing-link-attr.stderr b/src/test/ui/rfc1717/missing-link-attr.stderr index 30555e8094435..d836741f9eddf 100644 --- a/src/test/ui/rfc1717/missing-link-attr.stderr +++ b/src/test/ui/rfc1717/missing-link-attr.stderr @@ -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 diff --git a/src/test/ui/wasm-import-module.stderr b/src/test/ui/wasm-import-module.stderr index 20eec4c9f59bf..47d6cb6899723 100644 --- a/src/test/ui/wasm-import-module.stderr +++ b/src/test/ui/wasm-import-module.stderr @@ -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())]