diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 14 | ||||
| -rw-r--r-- | src/librustdoc/html/templates/source.html | 6 | ||||
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 10 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 4 |
4 files changed, 24 insertions, 10 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index e86eaa65b75..9df19352567 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -352,7 +352,7 @@ pre.item-decl { .source .content pre { padding: 20px; } -.rustdoc.source .example-wrap > pre.src-line-numbers { +.rustdoc.source .example-wrap pre.src-line-numbers { padding: 20px 0 20px 4px; } @@ -537,17 +537,17 @@ ul.block, .block li { margin-bottom: 0px; } -.rustdoc .example-wrap > pre { +.rustdoc .example-wrap pre { margin: 0; flex-grow: 1; } -.rustdoc:not(.source) .example-wrap > pre { +.rustdoc:not(.source) .example-wrap pre { overflow: auto hidden; } -.rustdoc .example-wrap > pre.example-line-numbers, -.rustdoc .example-wrap > pre.src-line-numbers { +.rustdoc .example-wrap pre.example-line-numbers, +.rustdoc .example-wrap pre.src-line-numbers { flex-grow: 0; min-width: fit-content; /* prevent collapsing into nothing in truncated scraped examples */ overflow: initial; @@ -558,7 +558,7 @@ ul.block, .block li { color: var(--src-line-numbers-span-color); } -.rustdoc .example-wrap > pre.src-line-numbers { +.rustdoc .example-wrap pre.src-line-numbers { padding: 14px 0; } .src-line-numbers a, .src-line-numbers span { @@ -706,7 +706,7 @@ h2.small-section-header > .anchor { } .main-heading a:hover, -.example-wrap > .rust a:hover, +.example-wrap .rust a:hover, .all-items a:hover, .docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover, .docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover, diff --git a/src/librustdoc/html/templates/source.html b/src/librustdoc/html/templates/source.html index a224ff12f44..42d01277db2 100644 --- a/src/librustdoc/html/templates/source.html +++ b/src/librustdoc/html/templates/source.html @@ -1,5 +1,7 @@ <div class="example-wrap"> {# #} - <pre class="src-line-numbers"> + {# https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr + Do not show "1 2 3 4 5 ..." in web search results. #} + <div data-nosnippet><pre class="src-line-numbers"> {% for line in lines.clone() %} {% if embedded %} <span>{{line|safe}}</span> @@ -7,7 +9,7 @@ <a href="#{{line|safe}}" id="{{line|safe}}">{{line|safe}}</a> {%~ endif %} {% endfor %} - </pre> {# #} + </pre></div> {# #} <pre class="rust"> {# #} <code> {% if needs_expansion %} diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 50b99b80572..735351fbf60 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -144,6 +144,8 @@ pub struct TestProps { pub normalize_stdout: Vec<(String, String)>, pub normalize_stderr: Vec<(String, String)>, pub failure_status: i32, + // For UI tests, allows compiler to exit with arbitrary failure status + pub dont_check_failure_status: bool, // Whether or not `rustfix` should apply the `CodeSuggestion`s of this test and compile the // resulting Rust code. pub run_rustfix: bool, @@ -186,6 +188,7 @@ mod directives { pub const CHECK_TEST_LINE_NUMBERS_MATCH: &'static str = "check-test-line-numbers-match"; pub const IGNORE_PASS: &'static str = "ignore-pass"; pub const FAILURE_STATUS: &'static str = "failure-status"; + pub const DONT_CHECK_FAILURE_STATUS: &'static str = "dont-check-failure-status"; pub const RUN_RUSTFIX: &'static str = "run-rustfix"; pub const RUSTFIX_ONLY_MACHINE_APPLICABLE: &'static str = "rustfix-only-machine-applicable"; pub const ASSEMBLY_OUTPUT: &'static str = "assembly-output"; @@ -233,6 +236,7 @@ impl TestProps { normalize_stdout: vec![], normalize_stderr: vec![], failure_status: -1, + dont_check_failure_status: false, run_rustfix: false, rustfix_only_machine_applicable: false, assembly_output: None, @@ -395,6 +399,12 @@ impl TestProps { self.failure_status = code; } + config.set_name_directive( + ln, + DONT_CHECK_FAILURE_STATUS, + &mut self.dont_check_failure_status, + ); + config.set_name_directive(ln, RUN_RUSTFIX, &mut self.run_rustfix); config.set_name_directive( ln, diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 794c845458b..a35284f05b5 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -310,7 +310,9 @@ impl<'test> TestCx<'test> { ); } - self.check_correct_failure_status(proc_res); + if !self.props.dont_check_failure_status { + self.check_correct_failure_status(proc_res); + } } } |
