From 2db2d946b87a09eec5fd3d0cb57798db8e2f086f Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 13 Jul 2018 16:19:48 -0700 Subject: [PATCH] Support the rustc in the latest Ubuntu LTS. At this time, this is Bionic, with Rust 1.25.0. --- .travis.yml | 2 ++ lib/codegen/meta/gen_instr.py | 15 +++++++-------- lib/codegen/src/timing.rs | 3 ++- lib/entity/src/list.rs | 4 ++-- lib/filetests/src/runner.rs | 8 +++++++- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 26e34b45d2..e52f99be01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/lib/codegen/meta/gen_instr.py b/lib/codegen/meta/gen_instr.py index 3a33110a00..fa48dcb945 100644 --- a/lib/codegen/meta/gen_instr.py +++ b/lib/codegen/meta/gen_instr.py @@ -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' '(&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)) diff --git a/lib/codegen/src/timing.rs b/lib/codegen/src/timing.rs index c0bf1b8fdb..707efbf3f8 100644 --- a/lib/codegen/src/timing.rs +++ b/lib/codegen/src/timing.rs @@ -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)?; diff --git a/lib/entity/src/list.rs b/lib/entity/src/list.rs index f94f8ef56e..c061419eab 100644 --- a/lib/entity/src/list.rs +++ b/lib/entity/src/list.rs @@ -229,14 +229,14 @@ impl EntityList { pub fn from_slice(slice: &[T], pool: &mut ListPool) -> 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, } diff --git a/lib/filetests/src/runner.rs b/lib/filetests/src/runner.rs index 3d630d83a4..80b2e47d15 100644 --- a/lib/filetests/src/runner.rs +++ b/lib/filetests/src/runner.rs @@ -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), }