Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions intel-sgx/sgxs-tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sgxs-tools"
version = "0.9.2"
version = "0.9.3"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand Down Expand Up @@ -50,7 +50,6 @@ atty = "0.2" # MIT
quote = "0.6" # MIT/Apache-2.0
proc-macro2 = "0.4" # MIT/Apache-2.0
petgraph = "0.7" # MIT/Apache-2.0
mopa = "0.2" # MIT/Apache-2.0
syn = { version = "0.15", features = ["full"] } # MIT/Apache-2.0
fnv = "1" # MIT/Apache-2.0
proc-mounts = "0.3.0" # MIT
Expand Down
2 changes: 0 additions & 2 deletions intel-sgx/sgxs-tools/src/sgx_detect/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ extern crate log;
extern crate anyhow;
extern crate thiserror;
#[macro_use]
extern crate mopa;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate clap;
Expand Down
5 changes: 3 additions & 2 deletions intel-sgx/sgxs-tools/src/sgx_detect/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::any::Any;
use std::cell::Cell;
use std::path::PathBuf;
use std::rc::Rc;
Expand Down Expand Up @@ -1154,8 +1155,8 @@ fn update<T: DetectItem, U: Dependency<T>>(
support: &SgxSupport,
hidden: &Cell<bool>,
) {
let dependent = dependent.downcast_mut::<U>().unwrap();
let dependency = dependency.downcast_ref::<T>().unwrap();
let dependent = (dependent as &mut dyn Any).downcast_mut::<U>().unwrap();
let dependency = (dependency as &dyn Any).downcast_ref::<T>().unwrap();
dependent.update_dependency(dependency, support);

let hiddenval = if U::CONTROL_VISIBILITY {
Expand Down
15 changes: 9 additions & 6 deletions intel-sgx/sgxs-tools/src/sgx_detect/tests/scaffold.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::any::TypeId;
use std::any::{Any, TypeId};
use std::cell::Cell;
use std::cmp::Ordering;
use std::fmt;
Expand All @@ -11,10 +11,11 @@ use yansi::Paint;
use crate::{paintalt, SgxSupport};
use super::debug;

pub trait DetectItem: Print + DebugSupport + Update + mopa::Any {
fn default() -> Box<dyn DetectItem> where Self: Sized;
pub trait DetectItem: Print + DebugSupport + Update + Any {
fn default() -> Box<dyn DetectItem>
where
Self: Sized;
}
mopafy!(DetectItem);

pub trait Update {
fn update(&mut self, _support: &SgxSupport) {}
Expand Down Expand Up @@ -121,7 +122,7 @@ impl DetectItemMap {
Ordering::Greater => {},
}

assert_eq!(v, <dyn DetectItem as mopa::Any>::get_type_id(&*self.store[idx as usize]));
assert_eq!(v, (&*self.store[idx as usize] as &dyn Any).type_id());

idx
}
Expand All @@ -135,7 +136,9 @@ impl DetectItemMap {
}

pub fn lookup<T: DetectItem>(&self) -> &T {
self.store[self.map[&TypeId::of::<T>()] as usize].downcast_ref().unwrap()
(&*self.store[self.map[&TypeId::of::<T>()] as usize] as &dyn Any)
.downcast_ref()
.unwrap()
}
}

Expand Down