Skip to content

Commit bbf3209

Browse files
authored
Unrolled build for rust-lang#122355
Rollup merge of rust-lang#122355 - fmease:rustdoc-fix-up-old-test, r=notriddle rustdoc: fix up old test `tests/rustdoc/line-breaks.rs` had several issues: 1. It used `//`@count`` instead of `// `@count`` (notice the space!) which gets treated as a `ui_test` directive instead of a `htmldocck` one. `compiletest` didn't flag it as an error because it's allowlisted ([rust-lang#121561](rust-lang#121561)) presumably precisely because of this test. And before the compiletest→ui_test migration, these directives must've been ignored, too, because … 2. … the checks themselves no longer work either: The count of `<br>`s is actually 0 in all 3 cases because – well – we no longer generate any `<br>`s inside `<pre>`s. Since I don't know how to ``@count`` `\n`s instead of `<br>`s, I've turned them into ``@matches`.` Btw, I don't know if this test is still desirable or if we have other tests that cover this (I haven't checked). r? rustdoc
2 parents 7de1a1f + f4b2a8a commit bbf3209

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

src/tools/compiletest/src/header.rs

-1
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
694694
"check-stdout",
695695
"check-test-line-numbers-match",
696696
"compile-flags",
697-
"count",
698697
"dont-check-compiler-stderr",
699698
"dont-check-compiler-stdout",
700699
"dont-check-failure-status",

tests/rustdoc/line-breaks.rs

+26-15
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,37 @@
11
#![crate_name = "foo"]
22

3-
use std::ops::Add;
43
use std::fmt::Display;
4+
use std::ops::Add;
55

6-
//@count foo/fn.function_with_a_really_long_name.html //pre/br 2
7-
pub fn function_with_a_really_long_name(parameter_one: i32,
8-
parameter_two: i32)
9-
-> Option<i32> {
6+
// @matches foo/fn.function_with_a_really_long_name.html '//*[@class="rust item-decl"]//code' "\
7+
// function_with_a_really_long_name\(\n\
8+
// \ parameter_one: i32,\n\
9+
// \ parameter_two: i32\n\
10+
// \) -> Option<i32>$"
11+
pub fn function_with_a_really_long_name(parameter_one: i32, parameter_two: i32) -> Option<i32> {
1012
Some(parameter_one + parameter_two)
1113
}
1214

13-
//@count foo/fn.short_name.html //pre/br 0
14-
pub fn short_name(param: i32) -> i32 { param + 1 }
15+
// @matches foo/fn.short_name.html '//*[@class="rust item-decl"]//code' \
16+
// "short_name\(param: i32\) -> i32$"
17+
pub fn short_name(param: i32) -> i32 {
18+
param + 1
19+
}
1520

16-
//@count foo/fn.where_clause.html //pre/br 4
17-
pub fn where_clause<T, U>(param_one: T,
18-
param_two: U)
19-
where T: Add<U> + Display + Copy,
20-
U: Add<T> + Display + Copy,
21-
T::Output: Display + Add<U::Output> + Copy,
22-
<T::Output as Add<U::Output>>::Output: Display,
23-
U::Output: Display + Copy
21+
// @matches foo/fn.where_clause.html '//*[@class="rust item-decl"]//code' "\
22+
// where_clause<T, U>\(param_one: T, param_two: U\)where\n\
23+
// \ T: Add<U> \+ Display \+ Copy,\n\
24+
// \ U: Add<T> \+ Display \+ Copy,\n\
25+
// \ T::Output: Display \+ Add<U::Output> \+ Copy,\n\
26+
// \ <T::Output as Add<U::Output>>::Output: Display,\n\
27+
// \ U::Output: Display \+ Copy,$"
28+
pub fn where_clause<T, U>(param_one: T, param_two: U)
29+
where
30+
T: Add<U> + Display + Copy,
31+
U: Add<T> + Display + Copy,
32+
T::Output: Display + Add<U::Output> + Copy,
33+
<T::Output as Add<U::Output>>::Output: Display,
34+
U::Output: Display + Copy,
2435
{
2536
let x = param_one + param_two;
2637
println!("{} + {} = {}", param_one, param_two, x);

0 commit comments

Comments
 (0)