about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-11-30 19:53:18 +0100
committerGitHub <noreply@github.com>2022-11-30 19:53:18 +0100
commitcbf1a0ed3ac0b436834e80086f136ef18b3b2ccf (patch)
treee8ec115461a138a1064f0e2c169d67f698826b20
parenteabc0720a672a70ca4ee2c760a2726f202a7252e (diff)
parent928622812c8f885d8d802ccee36bbe538a47e801 (diff)
downloadrust-cbf1a0ed3ac0b436834e80086f136ef18b3b2ccf.tar.gz
rust-cbf1a0ed3ac0b436834e80086f136ef18b3b2ccf.zip
Rollup merge of #105063 - aDotInTheVoid:rdj-dont-assume-core, r=notriddle
Rustdoc Json Tests: Don't assume that core::fmt::Debug will always have one item.

See https://github.com/rust-lang/rust/pull/104525#issuecomment-1330837047 and https://github.com/rust-lang/rust/pull/104525#issuecomment-1331087852 for motivation.

This still assumes that `fmt` is the first method, but thats alot less brittle than assuming it will be the only method.

Sadly, we can't use a aux crate to insulate the tests from core changes, because core is special, so all we can do is try not to depend on things that may change.
-rw-r--r--src/test/rustdoc-json/traits/uses_extern_trait.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/test/rustdoc-json/traits/uses_extern_trait.rs b/src/test/rustdoc-json/traits/uses_extern_trait.rs
index 430dd1543f5..a4add43c6a1 100644
--- a/src/test/rustdoc-json/traits/uses_extern_trait.rs
+++ b/src/test/rustdoc-json/traits/uses_extern_trait.rs
@@ -3,5 +3,10 @@ pub fn drop_default<T: core::default::Default>(_x: T) {}
 
 // FIXME(adotinthevoid): Theses shouldn't be here
 // @has "$.index[*][?(@.name=='Debug')]"
-// @set Debug_fmt = "$.index[*][?(@.name=='Debug')].inner.items[*]"
+
+// Debug may have several items. All we depend on here the that `fmt` is first. See
+// https://github.com/rust-lang/rust/pull/104525#issuecomment-1331087852 for why we
+// can't use [*].
+
+// @set Debug_fmt = "$.index[*][?(@.name=='Debug')].inner.items[0]"
 // @has "$.index[*][?(@.name=='fmt')].id" $Debug_fmt