]> git.proxmox.com Git - rustc.git/blame - src/librustc_back/lib.rs
New upstream version 1.14.0+dfsg1
[rustc.git] / src / librustc_back / lib.rs
CommitLineData
1a4d82fc
JJ
1// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
11//! Some stuff used by rustc that doesn't have many dependencies
12//!
13//! Originally extracted from rustc::back, which was nominally the
14//! compiler 'backend', though LLVM is rustc's backend, so rustc_back
15//! is really just odds-and-ends relating to code gen and linking.
16//! This crate mostly exists to make rustc smaller, so we might put
17//! more 'stuff' here in the future. It does not have a dependency on
18//! rustc_llvm.
19//!
20//! FIXME: Split this into two crates: one that has deps on syntax, and
21//! one that doesn't; the one that doesn't might get decent parallel
22//! build speedups.
23
24#![crate_name = "rustc_back"]
e9174d1e 25#![unstable(feature = "rustc_private", issue = "27812")]
1a4d82fc
JJ
26#![crate_type = "dylib"]
27#![crate_type = "rlib"]
e9174d1e 28#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
62682a34 29 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
e9174d1e 30 html_root_url = "https://doc.rust-lang.org/nightly/")]
7453a54e 31#![cfg_attr(not(stage0), deny(warnings))]
85aaf69f
SL
32
33#![feature(box_syntax)]
54a0048b 34#![feature(const_fn)]
62682a34 35#![feature(libc)]
62682a34 36#![feature(rand)]
85aaf69f
SL
37#![feature(rustc_private)]
38#![feature(staged_api)]
9e0c209e 39#![cfg_attr(stage0, feature(question_mark))]
c30ab7b3 40#![cfg_attr(test, feature(rand))]
1a4d82fc
JJ
41
42extern crate syntax;
9346a6ac 43extern crate libc;
1a4d82fc
JJ
44extern crate serialize;
45#[macro_use] extern crate log;
46
c30ab7b3
SL
47extern crate serialize as rustc_serialize; // used by deriving
48
c34b1796 49pub mod tempdir;
1a4d82fc 50pub mod target;
b039eaaf 51pub mod slice;
54a0048b 52pub mod dynamic_lib;
c30ab7b3
SL
53
54use serialize::json::{Json, ToJson};
55
56#[derive(Clone, Copy, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
57pub enum PanicStrategy {
58 Unwind,
59 Abort,
60}
61
62impl PanicStrategy {
63 pub fn desc(&self) -> &str {
64 match *self {
65 PanicStrategy::Unwind => "unwind",
66 PanicStrategy::Abort => "abort",
67 }
68 }
69}
70
71impl ToJson for PanicStrategy {
72 fn to_json(&self) -> Json {
73 match *self {
74 PanicStrategy::Abort => "abort".to_json(),
75 PanicStrategy::Unwind => "unwind".to_json(),
76 }
77 }
78}