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 authored and Dzmitry Malyshau committed 2021-11-16 09:12:42 -05:00
1 parent 90daa9edfe
commit 3d6cbcf8a6
2 files changed
+5 -9

No files matched your search

-4
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))
}
}
}
+5 -5
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()