Remove IndexableLength::Specializable variant.

Specializable constants are no longer permitted as array lengths, so this case
should not arise in valid code.
This commit is contained in:
Jim Blandy
2021-11-14 12:20:27 -08:00
committed by Dzmitry Malyshau
parent 90daa9edfe
commit 3d6cbcf8a6
2 changed files with 5 additions and 9 deletions

View File

@@ -109,10 +109,6 @@ impl<'w> BlockContext<'w> {
let length_id = self.write_runtime_array_length(sequence, block)?;
Ok(MaybeKnown::Computed(length_id))
}
crate::proc::IndexableLength::Specializable(constant) => {
let length_id = self.writer.constant_ids[constant.index()];
Ok(MaybeKnown::Computed(length_id))
}
}
}

View File

@@ -49,10 +49,6 @@ pub enum IndexableLength {
/// Values of this type always have the given number of elements.
Known(u32),
/// The value of the given specializable constant is the number of elements.
/// (Non-specializable constants are reported as `Known`.)
Specializable(crate::Handle<crate::Constant>),
/// The number of elements is determined at runtime.
Dynamic,
}
@@ -65,7 +61,11 @@ impl crate::ArraySize {
K {
specialization: Some(_),
..
} => IndexableLength::Specializable(k),
} => {
// Specializable constants are not supported as array lengths.
// See valid::TypeError::UnsupportedSpecializedArrayLength.
return Err(ProcError::InvalidArraySizeConstant(k));
}
ref unspecialized => {
let length = unspecialized
.to_array_length()