Skip to content

Commit

Permalink
Remove ABI from Fn
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureMarker committed Jun 9, 2020
1 parent 90f9b57 commit 48cb467
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 22 deletions.
3 changes: 0 additions & 3 deletions chalk-integration/src/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ impl<'k> Env<'k> {
} else {
return Ok(chalk_ir::TyData::Function(chalk_ir::Fn {
num_binders: k.binders.len(interner),
abi: *self.fn_def_abis.get(id).unwrap(),
substitution: chalk_ir::Substitution::empty(interner),
})
.intern(interner)
Expand Down Expand Up @@ -1416,7 +1415,6 @@ impl LowerTy for Ty {

Ty::ForAll {
lifetime_names,
abi,
types,
} => {
let quantified_env = env.introduce(lifetime_names.iter().map(|id| {
Expand All @@ -1430,7 +1428,6 @@ impl LowerTy for Ty {

let function = chalk_ir::Fn {
num_binders: lifetime_names.len(),
abi: abi.lower()?,
substitution: Substitution::from(interner, lowered_tys),
};
Ok(chalk_ir::TyData::Function(function).intern(interner))
Expand Down
7 changes: 1 addition & 6 deletions chalk-ir/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,9 @@ impl<I: Interner> Debug for Fn<I> {
// FIXME -- we should introduce some names or something here
let Fn {
num_binders,
abi,
substitution,
} = self;
write!(
fmt,
"extern \"{:?}\" for<{}> {:?}",
abi, num_binders, substitution
)
write!(fmt, "for<{}> {:?}", num_binders, substitution)
}
}

Expand Down
2 changes: 0 additions & 2 deletions chalk-ir/src/fold/binder_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ impl<I: Interner, TI: TargetInterner<I>> Fold<I, TI> for Fn<I> {
{
let Fn {
num_binders,
abi,
substitution,
} = self;
Ok(Fn {
num_binders: *num_binders,
abi: TI::transfer_abi(*abi),
substitution: substitution.fold_with(folder, outer_binder.shifted_in())?,
})
}
Expand Down
6 changes: 0 additions & 6 deletions chalk-ir/src/interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,6 @@ pub trait TargetInterner<I: Interner>: Interner {
&self,
const_evaluated: &I::InternedConcreteConst,
) -> Self::InternedConcreteConst;

fn transfer_abi(abi: I::FnAbi) -> Self::FnAbi;
}

impl<I: Interner> TargetInterner<I> for I {
Expand Down Expand Up @@ -709,10 +707,6 @@ impl<I: Interner> TargetInterner<I> for I {
) -> Self::InternedConcreteConst {
const_evaluated.clone()
}

fn transfer_abi(abi: <I as Interner>::FnAbi) -> Self::FnAbi {
abi
}
}

/// Implemented by types that have an associated interner (which
Expand Down
1 change: 0 additions & 1 deletion chalk-ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,6 @@ impl InferenceVar {
#[derive(Clone, PartialEq, Eq, Hash, HasInterner)]
pub struct Fn<I: Interner> {
pub num_binders: usize,
pub abi: I::FnAbi,
pub substitution: Substitution<I>,
}

Expand Down
1 change: 0 additions & 1 deletion chalk-parse/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ pub enum Ty {
},
ForAll {
lifetime_names: Vec<Identifier>,
abi: FnAbi,
types: Vec<Box<Ty>>,
},
Tuple {
Expand Down
3 changes: 1 addition & 2 deletions chalk-parse/src/parser.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,8 @@ pub Ty: Ty = {
};

TyWithoutId: Ty = {
<abi:FnAbi?> <l:ForLifetimes?> "fn" "(" <types:Comma<Ty>> ")" <ret_ty:FnReturn?> => Ty::ForAll {
<l:ForLifetimes?> "fn" "(" <types:Comma<Ty>> ")" <ret_ty:FnReturn?> => Ty::ForAll {
lifetime_names: l.unwrap_or_default(),
abi: abi.unwrap_or_default(),
types: types
.into_iter()
.chain(std::iter::once(ret_ty.unwrap_or_else(|| Ty::Tuple { types: Vec::new() })))
Expand Down
1 change: 0 additions & 1 deletion chalk-solve/src/test_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ macro_rules! ty {
(function $n:tt $($arg:tt)*) => {
chalk_ir::TyData::Function(Fn {
num_binders: $n,
abi: chalk_integration::interner::ChalkFnAbi::Rust,
substitution: chalk_ir::Substitution::from(
&chalk_integration::interner::ChalkIr,
vec![$(arg!($arg)),*] as Vec<chalk_ir::GenericArg<_>>
Expand Down

0 comments on commit 48cb467

Please sign in to comment.