Support the rustc in the latest Ubuntu LTS.

At this time, this is Bionic, with Rust 1.25.0.
This commit is contained in:
Dan Gohman
2018-07-13 16:19:48 -07:00
parent 202e45c213
commit 2db2d946b8
5 changed files with 20 additions and 12 deletions

View File

@@ -1,6 +1,8 @@
language: rust
rust:
- stable
# The version of rust in the latest Ubuntu LTS, currently Bionic.
- 1.25.0
- beta
- nightly
matrix:

View File

@@ -291,8 +291,7 @@ def gen_instruction_data_impl(fmt):
.format(field.member, field.member))
if args_eq is not None:
fmt.line('&& {}'.format(args_eq))
fmt.line('_ => unsafe { '
'::std::hint::unreachable_unchecked() }')
fmt.line('_ => unreachable!()')
fmt.line()
fmt.doc_comment(
@@ -306,20 +305,20 @@ def gen_instruction_data_impl(fmt):
'pub fn hash<H: ::std::hash::Hasher>'
'(&self, state: &mut H, pool: &ir::ValueListPool) {',
'}'):
with fmt.indented('match self {', '}'):
with fmt.indented('match *self {', '}'):
for f in InstructionFormat.all_formats:
n = 'InstructionData::' + f.name
members = ['opcode']
if f.typevar_operand is None:
args = '&()'
elif f.has_value_list:
members.append('args')
members.append('ref args')
args = 'args.as_slice(pool)'
elif f.num_value_operands == 1:
members.append('arg')
members.append('ref arg')
args = 'arg'
else:
members.append('args')
members.append('ref args')
args = 'args'
for field in f.imm_fields:
members.append(field.member)
@@ -327,9 +326,9 @@ def gen_instruction_data_impl(fmt):
with fmt.indented(pat + ' => {', '}'):
fmt.line('::std::hash::Hash::hash( '
'&::std::mem::discriminant(self), state);')
fmt.line('::std::hash::Hash::hash(opcode, state);')
fmt.line('::std::hash::Hash::hash(&opcode, state);')
for field in f.imm_fields:
fmt.line('::std::hash::Hash::hash({}, state);'
fmt.line('::std::hash::Hash::hash(&{}, state);'
.format(field.member))
fmt.line('::std::hash::Hash::hash({}, state);'
.format(args))

View File

@@ -154,7 +154,8 @@ mod details {
fn fmtdur(mut dur: Duration, f: &mut fmt::Formatter) -> fmt::Result {
// Round to nearest ms by adding 500us.
dur += Duration::new(0, 500_000);
write!(f, "{:4}.{:03} ", dur.as_secs(), dur.subsec_millis())
let ms = dur.subsec_nanos() / 1_000_000;
write!(f, "{:4}.{:03} ", dur.as_secs(), ms)
}
fmtdur(time.total, f)?;

View File

@@ -229,14 +229,14 @@ impl<T: EntityRef> EntityList<T> {
pub fn from_slice(slice: &[T], pool: &mut ListPool<T>) -> Self {
let len = slice.len();
if len == 0 {
return EntityList::new();
return Self::new();
}
let block = pool.alloc(sclass_for_length(len));
pool.data[block] = T::new(len);
pool.data[block + 1..block + len + 1].copy_from_slice(slice);
EntityList {
Self {
index: (block + 1) as u32,
unused: PhantomData,
}

View File

@@ -40,7 +40,13 @@ impl Display for QueueEntry {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let p = self.path.to_string_lossy();
match self.state {
State::Done(Ok(dur)) => write!(f, "{}.{:03} {}", dur.as_secs(), dur.subsec_millis(), p),
State::Done(Ok(dur)) => write!(
f,
"{}.{:03} {}",
dur.as_secs(),
dur.subsec_nanos() / 1_000_000,
p
),
State::Done(Err(ref e)) => write!(f, "FAIL {}: {}", p, e),
_ => write!(f, "{}", p),
}