2017-08-31 13:33:19 -05:00
|
|
|
//! The "main crate" of the Rust compiler. This crate contains common
|
|
|
|
//! type definitions that are used by the other crates in the rustc
|
|
|
|
//! "family". Some prominent examples (note that each of these modules
|
|
|
|
//! has their own README with further details).
|
|
|
|
//!
|
|
|
|
//! - **HIR.** The "high-level (H) intermediate representation (IR)" is
|
|
|
|
//! defined in the `hir` module.
|
|
|
|
//! - **MIR.** The "mid-level (M) intermediate representation (IR)" is
|
|
|
|
//! defined in the `mir` module. This module contains only the
|
|
|
|
//! *definition* of the MIR; the passes that transform and operate
|
2021-01-05 13:08:11 -06:00
|
|
|
//! on MIR are found in `rustc_const_eval` crate.
|
2017-08-31 13:33:19 -05:00
|
|
|
//! - **Types.** The internal representation of types used in rustc is
|
|
|
|
//! defined in the `ty` module. This includes the **type context**
|
|
|
|
//! (or `tcx`), which is the central context during most of
|
|
|
|
//! compilation, containing the interners and other things.
|
|
|
|
//!
|
2020-03-05 15:07:42 -06:00
|
|
|
//! For more information about how rustc works, see the [rustc dev guide].
|
2018-02-25 15:24:14 -06:00
|
|
|
//!
|
2020-03-09 16:33:04 -05:00
|
|
|
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/
|
2014-11-25 20:17:11 -06:00
|
|
|
//!
|
|
|
|
//! # Note
|
|
|
|
//!
|
|
|
|
//! This API is completely unstable and subject to change.
|
2014-01-07 23:17:52 -06:00
|
|
|
|
2020-09-23 14:51:56 -05:00
|
|
|
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
2021-08-04 17:24:31 -05:00
|
|
|
#![feature(allocator_api)]
|
2020-09-17 02:28:14 -05:00
|
|
|
#![feature(array_windows)]
|
2021-03-04 06:06:01 -06:00
|
|
|
#![feature(assert_matches)]
|
2015-02-10 15:52:44 -06:00
|
|
|
#![feature(box_patterns)]
|
2016-06-08 16:16:35 -05:00
|
|
|
#![feature(core_intrinsics)]
|
2020-04-05 13:36:39 -05:00
|
|
|
#![feature(discriminant_kind)]
|
2021-08-30 09:38:27 -05:00
|
|
|
#![feature(exhaustive_patterns)]
|
2022-11-26 07:54:45 -06:00
|
|
|
#![feature(generators)]
|
2021-11-29 06:55:00 -06:00
|
|
|
#![feature(get_mut_unchecked)]
|
2021-08-16 10:29:49 -05:00
|
|
|
#![feature(if_let_guard)]
|
2023-03-26 04:22:21 -05:00
|
|
|
#![feature(inline_const)]
|
2022-11-26 07:54:45 -06:00
|
|
|
#![feature(iter_from_generator)]
|
2023-02-07 23:24:57 -06:00
|
|
|
#![feature(local_key_cell_methods)]
|
2022-05-09 21:48:43 -05:00
|
|
|
#![feature(negative_impls)]
|
2019-12-11 08:55:29 -06:00
|
|
|
#![feature(never_type)]
|
2018-05-02 01:02:57 -05:00
|
|
|
#![feature(extern_types)]
|
2021-08-04 17:24:31 -05:00
|
|
|
#![feature(new_uninit)]
|
2022-08-20 13:40:08 -05:00
|
|
|
#![feature(let_chains)]
|
2020-06-01 12:58:18 -05:00
|
|
|
#![feature(min_specialization)]
|
2018-02-16 11:20:18 -06:00
|
|
|
#![feature(trusted_len)]
|
2022-03-08 08:39:52 -06:00
|
|
|
#![feature(type_alias_impl_trait)]
|
2022-12-31 04:43:40 -06:00
|
|
|
#![feature(strict_provenance)]
|
2019-07-31 14:00:35 -05:00
|
|
|
#![feature(associated_type_bounds)]
|
2019-05-19 13:16:04 -05:00
|
|
|
#![feature(rustc_attrs)]
|
2020-10-21 07:22:44 -05:00
|
|
|
#![feature(control_flow_enum)]
|
2021-01-05 12:53:07 -06:00
|
|
|
#![feature(trusted_step)]
|
|
|
|
#![feature(try_blocks)]
|
2021-07-23 10:40:43 -05:00
|
|
|
#![feature(try_reserve_kind)]
|
2021-07-13 01:58:59 -05:00
|
|
|
#![feature(nonzero_ops)]
|
2022-02-16 12:04:48 -06:00
|
|
|
#![feature(decl_macro)]
|
2022-02-25 10:01:44 -06:00
|
|
|
#![feature(drain_filter)]
|
2022-03-24 21:29:33 -05:00
|
|
|
#![feature(intra_doc_pointers)]
|
2022-05-29 03:19:52 -05:00
|
|
|
#![feature(yeet_expr)]
|
2022-10-18 09:31:56 -05:00
|
|
|
#![feature(result_option_inspect)]
|
2022-07-03 10:17:23 -05:00
|
|
|
#![feature(const_option)]
|
2023-02-09 08:02:47 -06:00
|
|
|
#![feature(trait_alias)]
|
2017-12-06 02:25:29 -06:00
|
|
|
#![recursion_limit = "512"]
|
2022-02-23 07:06:22 -06:00
|
|
|
#![allow(rustc::potential_query_instability)]
|
2017-04-28 11:09:15 -05:00
|
|
|
|
2017-09-08 14:08:01 -05:00
|
|
|
#[macro_use]
|
|
|
|
extern crate bitflags;
|
2018-04-06 05:56:59 -05:00
|
|
|
#[macro_use]
|
2018-12-02 18:14:35 -06:00
|
|
|
extern crate rustc_macros;
|
2017-12-06 02:25:29 -06:00
|
|
|
#[macro_use]
|
|
|
|
extern crate rustc_data_structures;
|
2015-01-06 11:24:46 -06:00
|
|
|
#[macro_use]
|
2020-08-14 01:05:01 -05:00
|
|
|
extern crate tracing;
|
2015-01-06 11:24:46 -06:00
|
|
|
#[macro_use]
|
2019-02-05 11:20:45 -06:00
|
|
|
extern crate smallvec;
|
2018-08-13 14:15:16 -05:00
|
|
|
|
2022-10-13 04:13:02 -05:00
|
|
|
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
|
|
|
|
use rustc_macros::fluent_messages;
|
|
|
|
|
2019-07-31 19:35:26 -05:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests;
|
|
|
|
|
2015-04-17 17:32:42 -05:00
|
|
|
#[macro_use]
|
|
|
|
mod macros;
|
|
|
|
|
2018-12-02 18:14:35 -06:00
|
|
|
#[macro_use]
|
|
|
|
pub mod query;
|
|
|
|
|
2019-03-29 11:49:11 -05:00
|
|
|
#[macro_use]
|
|
|
|
pub mod arena;
|
2021-01-19 12:07:06 -06:00
|
|
|
#[macro_use]
|
2016-01-05 12:02:57 -06:00
|
|
|
pub mod dep_graph;
|
2022-08-25 22:24:09 -05:00
|
|
|
pub(crate) mod error;
|
2016-03-29 00:50:44 -05:00
|
|
|
pub mod hir;
|
2016-03-22 10:30:57 -05:00
|
|
|
pub mod infer;
|
|
|
|
pub mod lint;
|
2021-12-20 21:24:43 -06:00
|
|
|
pub mod metadata;
|
2019-12-29 04:57:30 -06:00
|
|
|
pub mod middle;
|
2016-09-19 15:50:00 -05:00
|
|
|
pub mod mir;
|
2021-04-03 19:24:02 -05:00
|
|
|
pub mod thir;
|
2016-03-22 10:30:57 -05:00
|
|
|
pub mod traits;
|
|
|
|
pub mod ty;
|
2022-09-01 20:43:12 -05:00
|
|
|
mod values;
|
2014-06-01 17:58:06 -05:00
|
|
|
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod util {
|
2018-08-04 07:51:33 -05:00
|
|
|
pub mod bug;
|
2013-01-29 17:16:07 -06:00
|
|
|
pub mod common;
|
2010-08-18 13:34:47 -05:00
|
|
|
}
|
|
|
|
|
2020-03-29 11:08:01 -05:00
|
|
|
// Allows macros to refer to this crate as `::rustc_middle`
|
2020-03-29 09:41:09 -05:00
|
|
|
extern crate self as rustc_middle;
|
2022-10-13 04:13:02 -05:00
|
|
|
|
2023-03-02 17:18:38 -06:00
|
|
|
fluent_messages! { "../messages.ftl" }
|