Remove Obj::into_gc() and have Obj ctors return a Gc instead

Since we're nightly and using coerce_unsized, we can just coerce a
Gc<T: Obj> into a Gc<dyn Obj> for free.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-01-25 17:36:07 -08:00
parent 427d354857
commit ec8793a494
9 changed files with 28 additions and 39 deletions

View File

@@ -2,7 +2,7 @@ use crate::obj::{Obj, VTable};
use crate::syn::ast::SpStmt;
use crate::vm::{error::*, machine::Machine};
use crate::{scope::Scope, syn::span::Span, vm::inst::SpInst};
use gc::{unsafe_empty_trace, Finalize, Trace};
use gc::{unsafe_empty_trace, Finalize, Gc, Trace};
use std::fmt::Debug;
use std::rc::Rc;
@@ -27,11 +27,11 @@ pub struct QuoteObj {
}
impl QuoteObj {
pub fn new(value: Quote) -> Self {
QuoteObj {
pub fn new(value: Quote) -> Gc<Self> {
Gc::new(QuoteObj {
value,
vtable: vtable! {},
}
})
}
#[allow(dead_code)]