summaryrefslogtreecommitdiffstats
path: root/src/test/ui/return/return-impl-trait.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/return/return-impl-trait.fixed')
-rw-r--r--src/test/ui/return/return-impl-trait.fixed30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/return/return-impl-trait.fixed b/src/test/ui/return/return-impl-trait.fixed
new file mode 100644
index 000000000..ff2b02f73
--- /dev/null
+++ b/src/test/ui/return/return-impl-trait.fixed
@@ -0,0 +1,30 @@
+// run-rustfix
+
+trait Trait {}
+impl Trait for () {}
+
+// this works
+fn foo() -> impl Trait {
+ ()
+}
+
+fn bar<T: Trait + std::marker::Sync>() -> impl Trait + std::marker::Sync + Send
+where
+ T: Send,
+{
+ () //~ ERROR mismatched types
+}
+
+fn other_bounds<T>() -> impl Trait
+where
+ T: Trait,
+ Vec<usize>: Clone,
+{
+ () //~ ERROR mismatched types
+}
+
+fn main() {
+ foo();
+ bar::<()>();
+ other_bounds::<()>();
+}