diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:21 +0000 |
commit | 4e8199b572f2035b7749cba276ece3a26630d23e (patch) | |
tree | f09feeed6a0fe39d027b1908aa63ea6b35e4b631 /src/test/rustdoc-json/traits | |
parent | Adding upstream version 1.66.0+dfsg1. (diff) | |
download | rustc-4e8199b572f2035b7749cba276ece3a26630d23e.tar.xz rustc-4e8199b572f2035b7749cba276ece3a26630d23e.zip |
Adding upstream version 1.67.1+dfsg1.upstream/1.67.1+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/rustdoc-json/traits')
-rw-r--r-- | src/test/rustdoc-json/traits/trait_alias.rs | 30 | ||||
-rw-r--r-- | src/test/rustdoc-json/traits/uses_extern_trait.rs | 6 |
2 files changed, 32 insertions, 4 deletions
diff --git a/src/test/rustdoc-json/traits/trait_alias.rs b/src/test/rustdoc-json/traits/trait_alias.rs new file mode 100644 index 000000000..35db9296c --- /dev/null +++ b/src/test/rustdoc-json/traits/trait_alias.rs @@ -0,0 +1,30 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/104923> +// ignore-tidy-linelength + +#![feature(trait_alias)] + +// @set Orig = "$.index[*][?(@.name == 'Orig')].id" +// @is "$.index[*][?(@.name == 'Orig')].kind" '"trait"' +pub trait Orig<T> {} + +// @set Alias = "$.index[*][?(@.name == 'Alias')].id" +// @is "$.index[*][?(@.name == 'Alias')].kind" '"trait_alias"' +// @is "$.index[*][?(@.name == 'Alias')].inner.generics" '{"params": [], "where_predicates": []}' +// @count "$.index[*][?(@.name == 'Alias')].inner.params[*]" 1 +// @is "$.index[*][?(@.name == 'Alias')].inner.params[0].trait_bound.trait.id" $Orig +// @is "$.index[*][?(@.name == 'Alias')].inner.params[0].trait_bound.trait.args.angle_bracketed.args[0].type.inner" '"i32"' +pub trait Alias = Orig<i32>; + +pub struct Struct; + +impl Orig<i32> for Struct {} + +// @is "$.index[*][?(@.name=='takes_alias')].inner.decl.inputs[0][1].kind" '"impl_trait"' +// @is "$.index[*][?(@.name=='takes_alias')].inner.decl.inputs[0][1].inner[0].trait_bound.trait.id" $Alias +// @is "$.index[*][?(@.name=='takes_alias')].inner.generics.params[0].kind.type.bounds[0].trait_bound.trait.id" $Alias +pub fn takes_alias(_: impl Alias) {} +// FIXME: Should the trait be mentioned in both the decl and generics? + +fn main() { + takes_alias(Struct); +} diff --git a/src/test/rustdoc-json/traits/uses_extern_trait.rs b/src/test/rustdoc-json/traits/uses_extern_trait.rs index 430dd1543..55a51f739 100644 --- a/src/test/rustdoc-json/traits/uses_extern_trait.rs +++ b/src/test/rustdoc-json/traits/uses_extern_trait.rs @@ -1,7 +1,5 @@ #![no_std] 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[*]" -// @has "$.index[*][?(@.name=='fmt')].id" $Debug_fmt +// @!has "$.index[*][?(@.name=='Debug')]" +// @!has "$.index[*][?(@.name=='Default')]" |