]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/missing_const_for_fn/could_be_const.rs
Fix missing_const_for_fn false positive
[rust.git] / tests / ui / missing_const_for_fn / could_be_const.rs
index 139e64de1ff5d465e423ed02e115b8dff3327749..9109d255ca789cc2758f80b1bea67ef3e6e27829 100644 (file)
@@ -53,5 +53,20 @@ fn sub(x: u32) -> usize {
     t[0]
 }
 
+mod with_drop {
+    pub struct A;
+    pub struct B;
+    impl Drop for A {
+        fn drop(&mut self) {}
+    }
+
+    impl B {
+        // This can be const, because `a` is passed by reference
+        pub fn b(self, a: &A) -> B {
+            B
+        }
+    }
+}
+
 // Should not be const
 fn main() {}