From aa046da61f8722dfe46204cb303dbc9d2b4cb32e Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Thu, 30 Jan 2020 15:49:21 +0100 Subject: [PATCH 1/2] rustdoc: attempt full build for compile_fail test Some code fails when doing a full build but does not fail when only emitting metadata. This commit makes sure compile_fail tests for such code behave as expected, that is, the test succeeds because the compilation fails. --- src/librustdoc/test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index d89dc2adafeb3..37ff292205a56 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -282,7 +282,7 @@ fn run_test( for debugging_option_str in &options.debugging_options_strs { compiler.arg("-Z").arg(&debugging_option_str); } - if no_run { + if no_run && !compile_fail { compiler.arg("--emit=metadata"); } compiler.arg("--target").arg(target.to_string()); From 6d768ddecc13c4acf45730952c0af401a990383a Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Thu, 30 Jan 2020 15:51:19 +0100 Subject: [PATCH 2/2] error code examples: replace some ignore with compile_fail --- src/librustc_error_codes/error_codes/E0454.md | 2 +- src/librustc_error_codes/error_codes/E0458.md | 2 +- src/librustc_error_codes/error_codes/E0459.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0454.md b/src/librustc_error_codes/error_codes/E0454.md index d33148850816f..80eb91e43d16b 100644 --- a/src/librustc_error_codes/error_codes/E0454.md +++ b/src/librustc_error_codes/error_codes/E0454.md @@ -1,6 +1,6 @@ A link name was given with an empty name. Erroneous code example: -```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen) +```compile_fail,E0454 #[link(name = "")] extern {} // error: `#[link(name = "")]` given with empty name ``` diff --git a/src/librustc_error_codes/error_codes/E0458.md b/src/librustc_error_codes/error_codes/E0458.md index 385079d403d59..5996f190b34f0 100644 --- a/src/librustc_error_codes/error_codes/E0458.md +++ b/src/librustc_error_codes/error_codes/E0458.md @@ -1,6 +1,6 @@ An unknown "kind" was specified for a link attribute. Erroneous code example: -```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen) +```compile_fail,E0458 #[link(kind = "wonderful_unicorn")] extern {} // error: unknown kind: `wonderful_unicorn` ``` diff --git a/src/librustc_error_codes/error_codes/E0459.md b/src/librustc_error_codes/error_codes/E0459.md index 663bc322ee65d..580cbf1e1c6ed 100644 --- a/src/librustc_error_codes/error_codes/E0459.md +++ b/src/librustc_error_codes/error_codes/E0459.md @@ -1,6 +1,6 @@ A link was used without a name parameter. Erroneous code example: -```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen) +```compile_fail,E0459 #[link(kind = "dylib")] extern {} // error: `#[link(...)]` specified without `name = "foo"` ```