diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs')
-rw-r--r-- | src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs b/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs deleted file mode 100644 index cbf1daabe..000000000 --- a/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs +++ /dev/null @@ -1,74 +0,0 @@ -#![allow(bare_trait_objects)] -struct Struct; -trait Trait {} -impl Trait for Struct {} -impl Trait for u32 {} - -fn fuz() -> (usize, Trait) { (42, Struct) } -//~^ ERROR E0277 -//~| ERROR E0308 -fn bar() -> (usize, dyn Trait) { (42, Struct) } -//~^ ERROR E0277 -//~| ERROR E0308 -fn bap() -> Trait { Struct } -//~^ ERROR E0746 -fn ban() -> dyn Trait { Struct } -//~^ ERROR E0746 -fn bak() -> dyn Trait { unimplemented!() } //~ ERROR E0746 -// Suggest using `Box<dyn Trait>` -fn bal() -> dyn Trait { //~ ERROR E0746 - if true { - return Struct; - } - 42 -} -fn bax() -> dyn Trait { //~ ERROR E0746 - if true { - Struct - } else { - 42 //~ ERROR `if` and `else` have incompatible types - } -} -fn bam() -> Box<dyn Trait> { - if true { - return Struct; //~ ERROR mismatched types - } - 42 //~ ERROR mismatched types -} -fn baq() -> Box<dyn Trait> { - if true { - return 0; //~ ERROR mismatched types - } - 42 //~ ERROR mismatched types -} -fn baz() -> Box<dyn Trait> { - if true { - Struct //~ ERROR mismatched types - } else { - 42 //~ ERROR mismatched types - } -} -fn baw() -> Box<dyn Trait> { - if true { - 0 //~ ERROR mismatched types - } else { - 42 //~ ERROR mismatched types - } -} - -// Suggest using `impl Trait` -fn bat() -> dyn Trait { //~ ERROR E0746 - if true { - return 0; - } - 42 -} -fn bay() -> dyn Trait { //~ ERROR E0746 - if true { - 0 - } else { - 42 - } -} - -fn main() {} |