chiark / gitweb /
W
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 4 Sep 2023 10:50:26 +0000 (11:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 4 Sep 2023 10:50:26 +0000 (11:50 +0100)
Cargo.lock
Cargo.toml
macros/Cargo.toml
macros/macros.rs [new file with mode: 0644]
src/main.rs

index b495f57bd0298f3ec7244af6b32e87d0eded83b8..bb59fc7da1a99072f7d4be5607be8cf15a5849d7 100644 (file)
 # It is not intended for manual editing.
 version = 3
 
-[[package]]
-name = "autocfg"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
-
-[[package]]
-name = "downcast-rs"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
-
-[[package]]
-name = "dumpster"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4081876a3a37b862402a80758787b5d505548b3f6c619f1c162fb63beb19c9d0"
-dependencies = [
- "dumpster_derive",
- "once_cell",
-]
-
-[[package]]
-name = "dumpster_derive"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b07d33f43bac481daf9bd8f3dc9b4db7f323894e8571ccd17621351b010373df"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
 [[package]]
 name = "foo"
 version = "0.1.0"
 dependencies = [
- "downcast-rs",
- "dumpster",
- "futures",
-]
-
-[[package]]
-name = "futures"
-version = "0.3.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-executor",
- "futures-io",
- "futures-sink",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-channel"
-version = "0.3.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
-dependencies = [
- "futures-core",
- "futures-sink",
+ "foo-macros",
 ]
 
 [[package]]
-name = "futures-core"
-version = "0.3.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
-
-[[package]]
-name = "futures-executor"
-version = "0.3.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
-dependencies = [
- "futures-core",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-io"
-version = "0.3.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
-
-[[package]]
-name = "futures-macro"
-version = "0.3.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
+name = "foo-macros"
+version = "0.1.0"
 dependencies = [
  "proc-macro2",
- "quote",
  "syn",
 ]
 
-[[package]]
-name = "futures-sink"
-version = "0.3.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
-
-[[package]]
-name = "futures-task"
-version = "0.3.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
-
-[[package]]
-name = "futures-util"
-version = "0.3.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-io",
- "futures-macro",
- "futures-sink",
- "futures-task",
- "memchr",
- "pin-project-lite",
- "pin-utils",
- "slab",
-]
-
-[[package]]
-name = "memchr"
-version = "2.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
-
-[[package]]
-name = "once_cell"
-version = "1.18.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
-
-[[package]]
-name = "pin-project-lite"
-version = "0.2.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57"
-
-[[package]]
-name = "pin-utils"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-
 [[package]]
 name = "proc-macro2"
 version = "1.0.66"
@@ -175,20 +35,11 @@ dependencies = [
  "proc-macro2",
 ]
 
-[[package]]
-name = "slab"
-version = "0.4.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
-dependencies = [
- "autocfg",
-]
-
 [[package]]
 name = "syn"
-version = "2.0.28"
+version = "1.0.109"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
 dependencies = [
  "proc-macro2",
  "quote",
index f0f74a9c2d3fe704f955bc2d1fa4945ac95ebfb8..2c2586a6dda67e62530e26950e3cccfb89552969 100644 (file)
@@ -9,7 +9,7 @@ edition = "2021"
 foo-macros = { version = "0.1.0", path = "macros" }
 
 [workspace]
-members = "macros"
+members = ["macros"]
 
 #downcast-rs = "1"
 #dumpster = "0.1.1"
index 95e750e6e507734c6486bfb8928a815c942b9ec7..4d995aef603dd428a3a7ea14eb3bb047a49db0c0 100644 (file)
@@ -8,4 +8,7 @@ proc_macro = true
 
 [dependencies]
 syn = "1"
-proc_macro2 = "1"
+proc-macro2 = "1"
+
+[lib]
+path = "macros.rs"
diff --git a/macros/macros.rs b/macros/macros.rs
new file mode 100644 (file)
index 0000000..32cd5cd
--- /dev/null
@@ -0,0 +1,6 @@
+
+
+
+#[proc_macro]
+fn foo(proc_macro::TokenStream) -> proc_macro::TokenStream {
+}
index 4902668315ea6ad8e71d64718986f4bf227e6b74..4f3d0b87bfda4b890aa36bb423818e1215c72836 100644 (file)
@@ -1,36 +1,5 @@
 
-use std::cell::RefCell;
-
-use dumpster::{Collectable, unsync::Gc};
-
-#[derive(Collectable, Debug)]
-struct Loopy {
-    value: u32,
-    loopy: RefCell<Option<Gc<Loopy>>>,
-}
-
-impl Drop for Loopy {
-    fn drop(&mut self) {
-        eprintln!(
-            "drop {:?} {:?}",
-            self.value,
-            self.loopy.borrow().as_ref().map(|gcl| gcl.value),
-        );
-    }
-}
-
 fn main() {
-    let a = Gc::new(Loopy {
-        value: 42,
-        loopy: None.into(),
-    });
-    let b = Gc::new(Loopy {
-        value: 66,
-        loopy: None.into(),
-    });
-    *a.loopy.borrow_mut() = Some(b.clone());
-    *b.loopy.borrow_mut() = Some(a.clone());
-    drop(a);
-    drop(b);
-    eprintln!("returning from main");
+    let s = foo!("y");
+    println!("{s}");
 }