Skip to content

Commit 4de16f6

Browse files
committed
Remove derive_more dep
1 parent 1ed3277 commit 4de16f6

6 files changed

Lines changed: 41 additions & 51 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ cfg-if = "1.0"
1919
once_cell = "1.4.1"
2020
siphasher = "0.3"
2121
rand = "0.8"
22-
derive_more = "0.99.9"
2322
volatile = "0.3"
2423
radium = "0.6"

common/src/borrow.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,33 @@ use crate::lock::{
44
};
55
use std::ops::{Deref, DerefMut};
66

7-
#[derive(Debug, derive_more::From)]
7+
macro_rules! impl_from {
8+
($lt:lifetime, $gen:ident, $t:ty, $($var:ident($from:ty),)*) => {
9+
$(
10+
impl<$lt, $gen: ?Sized> From<$from> for $t {
11+
fn from(t: $from) -> Self {
12+
Self::$var(t)
13+
}
14+
}
15+
)*
16+
};
17+
}
18+
19+
#[derive(Debug)]
820
pub enum BorrowedValue<'a, T: ?Sized> {
921
Ref(&'a T),
1022
MuLock(PyMutexGuard<'a, T>),
1123
MappedMuLock(PyImmutableMappedMutexGuard<'a, T>),
1224
ReadLock(PyRwLockReadGuard<'a, T>),
1325
MappedReadLock(PyMappedRwLockReadGuard<'a, T>),
1426
}
27+
impl_from!('a, T, BorrowedValue<'a, T>,
28+
Ref(&'a T),
29+
MuLock(PyMutexGuard<'a, T>),
30+
MappedMuLock(PyImmutableMappedMutexGuard<'a, T>),
31+
ReadLock(PyRwLockReadGuard<'a, T>),
32+
MappedReadLock(PyMappedRwLockReadGuard<'a, T>),
33+
);
1534

1635
impl<'a, T: ?Sized> BorrowedValue<'a, T> {
1736
pub fn map<U: ?Sized, F>(s: Self, f: F) -> BorrowedValue<'a, U>
@@ -45,14 +64,21 @@ impl<T: ?Sized> Deref for BorrowedValue<'_, T> {
4564
}
4665
}
4766

48-
#[derive(Debug, derive_more::From)]
67+
#[derive(Debug)]
4968
pub enum BorrowedValueMut<'a, T: ?Sized> {
5069
RefMut(&'a mut T),
5170
MuLock(PyMutexGuard<'a, T>),
5271
MappedMuLock(PyMappedMutexGuard<'a, T>),
5372
WriteLock(PyRwLockWriteGuard<'a, T>),
5473
MappedWriteLock(PyMappedRwLockWriteGuard<'a, T>),
5574
}
75+
impl_from!('a, T, BorrowedValueMut<'a, T>,
76+
RefMut(&'a mut T),
77+
MuLock(PyMutexGuard<'a, T>),
78+
MappedMuLock(PyMappedMutexGuard<'a, T>),
79+
WriteLock(PyRwLockWriteGuard<'a, T>),
80+
MappedWriteLock(PyMappedRwLockWriteGuard<'a, T>),
81+
);
5682

5783
impl<'a, T: ?Sized> BorrowedValueMut<'a, T> {
5884
pub fn map<U: ?Sized, F>(s: Self, f: F) -> BorrowedValueMut<'a, U>

vm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ rustpython-bytecode = { path = "../bytecode", version = "0.1.2" }
5454
rustpython-jit = { path = "../jit", optional = true, version = "0.1.2" }
5555
rustpython-pylib = { path = "pylib-crate", optional = true, version = "0.1.0" }
5656
serde = { version = "1.0.66", features = ["derive"] }
57-
rustc_version_runtime = "0.2.0"
5857
puruspe = "0.1"
5958
caseless = "0.2.1"
6059
chrono = { version = "0.4", features = ["wasmbind"] }
@@ -159,3 +158,4 @@ wasm-bindgen = "0.2"
159158

160159
[build-dependencies]
161160
itertools = "0.10.0"
161+
rustc_version = "0.4"

vm/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ fn main() {
1212
);
1313
println!("cargo:rustc-env=RUSTPYTHON_GIT_TAG={}", git_tag());
1414
println!("cargo:rustc-env=RUSTPYTHON_GIT_BRANCH={}", git_branch());
15+
println!(
16+
"cargo:rustc-env=RUSTC_VERSION={}",
17+
rustc_version::version().unwrap()
18+
);
1519

1620
println!(
1721
"cargo:rustc-env=RUSTPYTHON_TARGET_TRIPLE={}",

vm/src/version.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ pub fn get_version_number() -> String {
5959
}
6060

6161
pub fn get_compiler() -> String {
62-
let rustc_version = rustc_version_runtime::version_meta();
63-
format!("rustc {}", rustc_version.semver)
62+
format!("rustc {}", env!("RUSTC_VERSION"))
6463
}
6564

6665
pub fn get_build_info() -> String {

0 commit comments

Comments
 (0)