diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
commit | d1b2d29528b7794b41e66fc2136e395a02f8529b (patch) | |
tree | a4a17504b260206dec3cf55b2dca82929a348ac2 /tests/rustdoc/inline_cross/auxiliary | |
parent | Releasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip |
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc/inline_cross/auxiliary')
3 files changed, 78 insertions, 0 deletions
diff --git a/tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs b/tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs new file mode 100644 index 000000000..0fc7a7aae --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs @@ -0,0 +1,22 @@ +#![feature(generic_const_items)] +#![allow(incomplete_features)] + +pub const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> = None +where + String: From<T>; + +pub trait Trait<T: ?Sized> { + const C<'a>: &'a T + where + T: 'a + Eq; +} + +pub struct Implementor; + +impl Trait<str> for Implementor { + const C<'a>: &'a str = "C" + // In real code we could've left off this bound but adding it explicitly allows us to test if + // we render where-clauses on associated consts inside impl blocks correctly. + where + str: 'a; +} diff --git a/tests/rustdoc/inline_cross/auxiliary/impl-sized.rs b/tests/rustdoc/inline_cross/auxiliary/impl-sized.rs new file mode 100644 index 000000000..65f72a3b9 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/impl-sized.rs @@ -0,0 +1,21 @@ +use std::fmt::Debug; + +pub fn sized(x: impl Sized) -> impl Sized { + x +} + +pub fn sized_outlives<'a>(x: impl Sized + 'a) -> impl Sized + 'a { + x +} + +pub fn maybe_sized(x: &impl ?Sized) -> &impl ?Sized { + x +} + +pub fn debug_maybe_sized(x: &(impl Debug + ?Sized)) -> &(impl Debug + ?Sized) { + x +} + +pub fn maybe_sized_outlives<'t>(x: &(impl ?Sized + 't)) -> &(impl ?Sized + 't) { + x +} diff --git a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs new file mode 100644 index 000000000..c72f01115 --- /dev/null +++ b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs @@ -0,0 +1,35 @@ +#![feature(return_position_impl_trait_in_trait)] + +pub trait Trait { + fn create() -> impl Iterator<Item = u64> { + std::iter::empty() + } +} + +pub struct Basic; +pub struct Intermediate; +pub struct Advanced; + +impl Trait for Basic { + // method provided by the trait +} + +impl Trait for Intermediate { + fn create() -> std::ops::Range<u64> { // concrete return type + 0..1 + } +} + +impl Trait for Advanced { + fn create() -> impl Iterator<Item = u64> { // opaque return type + std::iter::repeat(0) + } +} + +// Regression test for issue #113929: + +pub trait Def { + fn def<T>() -> impl Default {} +} + +impl Def for () {} |