Merge #204

204: Switch all crate names to use underscores rather than hyphens. r=jrvanwhy a=jrvanwhy

We previously had `libtock_codegen` and `libtock-core`, plus `test-runner` and `print-sizes`. Because Rust does not allow hyphens in crate names in code, Cargo automatically translates the hyphens to underscores (e.g. an application refers to items in `libtock-core` using `libtock_core::`). I decided to make the crate naming consistently use underscores rather than hyphens so that crate names in the repository match their use in user code.

Co-authored-by: Johnathan Van Why <jrvanwhy@google.com>
diff --git a/.github/workflows/size-diff.yml b/.github/workflows/size-diff.yml
index d35fde0..4d14308 100644
--- a/.github/workflows/size-diff.yml
+++ b/.github/workflows/size-diff.yml
@@ -40,12 +40,12 @@
           cd "${GITHUB_WORKSPACE}"
           rustup target add riscv32imc-unknown-none-elf thumbv7em-none-eabi
           make -j2 examples  # The VM this runs on has 2 logical cores.
-          cargo run --release -p print-sizes >'${{runner.temp}}/merge-sizes'
+          cargo run --release -p print_sizes >'${{runner.temp}}/merge-sizes'
           git remote set-branches "${UPSTREAM_REMOTE_NAME}" "${GITHUB_BASE_REF}"
           git fetch --depth=1 "${UPSTREAM_REMOTE_NAME}" "${GITHUB_BASE_REF}"
           git checkout "${UPSTREAM_REMOTE_NAME}/${GITHUB_BASE_REF}"
           make -j2 examples
-          cargo run --release -p print-sizes >'${{runner.temp}}/base-sizes'
+          cargo run --release -p print_sizes >'${{runner.temp}}/base-sizes'
 
       # Computes and displays the size diff. diff returns a nonzero status code
       # if the files differ, and GitHub interprets a nonzero status code as an
diff --git a/Cargo.toml b/Cargo.toml
index b8e0bec..f5cb932 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,13 +6,13 @@
 edition = "2018"
 
 [features]
-alloc = ["libtock-core/alloc"]
-custom_panic_handler = ["libtock-core/custom_panic_handler"]
-custom_alloc_error_handler = ["libtock-core/custom_alloc_error_handler"]
+alloc = ["libtock_core/alloc"]
+custom_panic_handler = ["libtock_core/custom_panic_handler"]
+custom_alloc_error_handler = ["libtock_core/custom_alloc_error_handler"]
 __internal_disable_gpio_in_integration_test = []
 
 [dependencies]
-libtock-core = { path = "core" }
+libtock_core = { path = "core" }
 libtock_codegen = { path = "codegen" }
 futures = { version = "0.3.1", default-features = false, features = ["unstable", "cfg-target-has-atomic"] }
 
@@ -62,6 +62,6 @@
 members = [
     "codegen",
     "core",
-    "test-runner",
-    "tools/print-sizes",
+    "test_runner",
+    "tools/print_sizes",
 ]
diff --git a/Makefile b/Makefile
index 36921bb..87b6a10 100644
--- a/Makefile
+++ b/Makefile
@@ -59,23 +59,23 @@
 # Prints out the sizes of the example binaries.
 .PHONY: print-sizes
 print-sizes: examples
-	cargo run --release -p print-sizes
+	cargo run --release -p print_sizes
 
 # Runs the libtock_test tests in QEMU on a simulated HiFive board.
 .PHONY: test-qemu-hifive
 test-qemu-hifive: kernel-hifive setup-qemu
 	PLATFORM=hifive1 cargo rrv32imac --example libtock_test --features=alloc \
 		--features=__internal_disable_gpio_in_integration_test
-	cargo run -p test-runner
+	cargo run -p test_runner
 
 .PHONY: examples
 examples:
-	PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples -p libtock -p libtock-core
+	PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples -p libtock -p libtock_core
 	PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples --features=alloc
 	PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --example panic --features=custom_panic_handler,custom_alloc_error_handler
 	PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --example alloc_error --features=alloc,custom_alloc_error_handler
 	# Important: This tests a platform without atomic instructions.
-	PLATFORM=opentitan cargo build --release --target=riscv32imc-unknown-none-elf --examples -p libtock -p libtock-core
+	PLATFORM=opentitan cargo build --release --target=riscv32imc-unknown-none-elf --examples -p libtock -p libtock_core
 
 .PHONY: test
 test: examples test-qemu-hifive
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 94f3c8f..3f1723b 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "libtock-core"
+name = "libtock_core"
 version = "0.1.0"
 authors = ["Tock Project Developers <tock-dev@googlegroups.com>"]
 edition = "2018"
diff --git a/core/README.md b/core/README.md
index ba9602a..839c9ed 100644
--- a/core/README.md
+++ b/core/README.md
@@ -1,4 +1,4 @@
-# libtock-core
+# libtock\_core
 
 Core crate of `libtock-rs`. It contains the architecture specific code of `libtock-rs`. In particular:
 
diff --git a/core/examples/empty_main.rs b/core/examples/empty_main.rs
index dd062bc..1179b43 100644
--- a/core/examples/empty_main.rs
+++ b/core/examples/empty_main.rs
@@ -1,13 +1,13 @@
-// The most minimal libtock-core example possible. This file primarily exists
+// The most minimal libtock_core example possible. This file primarily exists
 // for code size measurement, as this should create the smallest-possible
-// libtock-core app.
+// libtock_core app.
 
 #![no_std]
 
-// If you don't *use* anything from libtock-core directly, cargo will not link
+// If you don't *use* anything from libtock_core directly, cargo will not link
 // it into the executable. However, we still need the runtime and lang items.
-// Therefore a libtock-core app that doesn't directly mention anything in
-// libtock-core needs to explicitly declare its dependency on libtock-core as
+// Therefore a libtock_core app that doesn't directly mention anything in
+// libtock_core needs to explicitly declare its dependency on libtock_core as
 // follows.
 extern crate libtock_core;
 
diff --git a/doc/Dependencies.md b/doc/Dependencies.md
index f157049..77da194 100644
--- a/doc/Dependencies.md
+++ b/doc/Dependencies.md
@@ -25,5 +25,5 @@
 
 ## Avoiding Optional Dependencies
 
-To avoid pulling in optional dependencies, users should use `libtock-core`
-instead of `libtock`. `libtock-core` is in the `core/` directory.
+To avoid pulling in optional dependencies, users should use `libtock_core`
+instead of `libtock`. `libtock_core` is in the `core/` directory.
diff --git a/test-runner/Cargo.toml b/test_runner/Cargo.toml
similarity index 95%
rename from test-runner/Cargo.toml
rename to test_runner/Cargo.toml
index b9769b9..133ff23 100644
--- a/test-runner/Cargo.toml
+++ b/test_runner/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "test-runner"
+name = "test_runner"
 version = "0.1.0"
 authors = ["torfmaster <briefe@kebes.de>"]
 edition = "2018"
diff --git a/test-runner/src/main.rs b/test_runner/src/main.rs
similarity index 100%
rename from test-runner/src/main.rs
rename to test_runner/src/main.rs
diff --git a/tools/print-sizes/Cargo.toml b/tools/print_sizes/Cargo.toml
similarity index 61%
rename from tools/print-sizes/Cargo.toml
rename to tools/print_sizes/Cargo.toml
index 97bdc48..12f76de 100644
--- a/tools/print-sizes/Cargo.toml
+++ b/tools/print_sizes/Cargo.toml
@@ -1,12 +1,12 @@
-# Finds all the libtock-core and libtock-rs examples and prints the sizes of
+# Finds all the libtock_core and libtock examples and prints the sizes of
 # several of their sections. Searches the target/$ARCH/release directory. Note
-# that print-sizes will not build the examples; that is done by the
+# that print_sizes will not build the examples; that is done by the
 # `print-sizes` Makefile action.
 
 [package]
 authors = ["Tock Project Developers <tock-dev@googlegroups.com>"]
 edition = "2018"
-name = "print-sizes"
+name = "print_sizes"
 version = "0.1.0"
 
 [dependencies]
diff --git a/tools/print-sizes/src/main.rs b/tools/print_sizes/src/main.rs
similarity index 100%
rename from tools/print-sizes/src/main.rs
rename to tools/print_sizes/src/main.rs