Skip to content

Commit

Permalink
Rollup merge of #105063 - aDotInTheVoid:rdj-dont-assume-core, r=notri…
Browse files Browse the repository at this point in the history
…ddle

Rustdoc Json Tests: Don't assume that core::fmt::Debug will always have one item.

See #104525 (comment) and #104525 (comment) 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.
  • Loading branch information
matthiaskrgr authored Nov 30, 2022
2 parents eabc072 + 9286228 commit cbf1a0e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test/rustdoc-json/traits/uses_extern_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cbf1a0e

Please sign in to comment.