diff options
Diffstat (limited to 'tests/ui/impl-trait/question_mark.rs')
-rw-r--r-- | tests/ui/impl-trait/question_mark.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/question_mark.rs b/tests/ui/impl-trait/question_mark.rs new file mode 100644 index 000000000..7bd5cff31 --- /dev/null +++ b/tests/ui/impl-trait/question_mark.rs @@ -0,0 +1,30 @@ +// check-pass + +use std::fmt::Debug; + +#[derive(Debug)] +pub struct Target; + +#[derive(Debug)] +pub struct Source; +impl From<Source> for Target { + fn from(_: Source) -> Self { + Self + } +} + +fn maybe_source() -> Result<(), Source> { + todo!() +} + +pub fn typaram() -> Result<(), impl Debug> { + maybe_source()?; + Ok::<_, Target>(()) +} + +pub fn direct() -> Result<(), impl Debug> { + maybe_source()?; + Err(Target) +} + +fn main() {} |