Add use declarations for std features.

Merge the `use` parts of the `no_std` branch. This reduces the diffs
between master and the `no_std` branch, making it easier to maintain.

Most of these changes are derived from patches by @lachlansneff in
https://github.com/Cretonne/cretonne/tree/no_std.
This commit is contained in:
Dan Gohman
2018-03-20 12:15:59 -07:00
parent da4cf27780
commit 2b3df1a506
66 changed files with 82 additions and 2 deletions

View File

@@ -266,6 +266,7 @@ impl FromStr for FloatCC {
#[cfg(test)]
mod tests {
use super::*;
use std::string::ToString;
static INT_ALL: [IntCC; 10] = [
IntCC::Equal,

View File

@@ -944,6 +944,7 @@ mod tests {
use cursor::{Cursor, FuncCursor};
use ir::types;
use ir::{Function, Opcode, InstructionData, TrapCode};
use std::string::ToString;
#[test]
fn make_inst() {

View File

@@ -262,6 +262,7 @@ impl From<Heap> for AnyEntity {
mod tests {
use super::*;
use std::u32;
use std::string::ToString;
#[test]
fn value_with_number() {

View File

@@ -10,6 +10,7 @@ use isa::{RegInfo, RegUnit};
use std::cmp;
use std::fmt;
use std::str::FromStr;
use std::vec::Vec;
/// Function signature.
///
@@ -378,6 +379,7 @@ impl FromStr for CallConv {
mod tests {
use super::*;
use ir::types::{I32, F32, B8};
use std::string::ToString;
#[test]
fn argument_type() {

View File

@@ -122,6 +122,7 @@ impl FromStr for ExternalName {
mod tests {
use super::ExternalName;
use ir::LibCall;
use std::string::ToString;
#[test]
fn display_testcase() {

View File

@@ -652,6 +652,7 @@ mod tests {
use std::{f32, f64};
use std::str::FromStr;
use std::fmt::Display;
use std::string::ToString;
#[test]
fn format_imm64() {

View File

@@ -9,6 +9,7 @@
use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
use std::ops::{Deref, DerefMut};
use std::vec::Vec;
use ir;
use ir::{Value, Type, Ebb, JumpTable, SigRef, FuncRef};
@@ -537,6 +538,7 @@ pub enum ResolvedConstraint {
#[cfg(test)]
mod tests {
use super::*;
use std::string::ToString;
#[test]
fn opcodes() {

View File

@@ -8,6 +8,7 @@ use ir::entities::Ebb;
use std::iter;
use std::slice;
use std::fmt::{self, Display, Formatter};
use std::vec::Vec;
/// Contents of a jump table.
///
@@ -141,6 +142,8 @@ mod tests {
use super::JumpTableData;
use ir::Ebb;
use entity::EntityRef;
use std::vec::Vec;
use std::string::ToString;
#[test]
fn empty() {

View File

@@ -743,6 +743,7 @@ mod tests {
use entity::EntityRef;
use ir::{Ebb, Inst, ProgramOrder, SourceLoc};
use std::cmp::Ordering;
use std::vec::Vec;
struct LayoutCursor<'f> {
/// Borrowed function layout. Public so it can be re-borrowed from this cursor.

View File

@@ -100,6 +100,7 @@ impl LibCall {
#[cfg(test)]
mod test {
use super::*;
use std::string::ToString;
#[test]
fn display() {

View File

@@ -148,6 +148,7 @@ mod tests {
use super::*;
use entity::EntityRef;
use ir::{Inst, Ebb};
use std::string::ToString;
#[test]
fn convert() {

View File

@@ -51,6 +51,7 @@ impl fmt::Display for SourceLoc {
#[cfg(test)]
mod tests {
use ir::SourceLoc;
use std::string::ToString;
#[test]
fn display() {

View File

@@ -10,6 +10,7 @@ use std::cmp;
use std::fmt;
use std::ops::{Index, IndexMut};
use std::str::FromStr;
use std::vec::Vec;
/// The size of an object on the stack, or the size of a stack frame.
///
@@ -319,6 +320,7 @@ mod tests {
use ir::Function;
use ir::types;
use super::*;
use std::string::ToString;
#[test]
fn stack_slot() {

View File

@@ -89,6 +89,7 @@ impl FromStr for TrapCode {
#[cfg(test)]
mod tests {
use super::*;
use std::string::ToString;
// Everything but user-defined codes.
const CODES: [TrapCode; 8] = [

View File

@@ -324,6 +324,7 @@ impl Default for Type {
#[cfg(test)]
mod tests {
use super::*;
use std::string::ToString;
#[test]
fn basic_scalars() {