mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
1a9a284ad2
`derive(HashStable_Generic)` generates impls like this:
```
impl<__CTX> HashStable<__CTX> for ExpnKind
where
__CTX: crate::HashStableContext
{
fn hash_stable(&self, hcx : &mut __CTX, __hasher: &mut StableHasher) {
...
}
}
```
This is used for crates that are upstream of `rustc_middle`.
The `crate::HashStableContext` bound means every crate that uses
`derive(HashStable_Generic)` must provide (or import) a trait
`HashStableContext` which `rustc_middle` then impls. In `rustc_span`
this trait is sensible, with three methods. In other crates, this trait
is empty, and there is the following trait hierarchy:
```
rustc_session::HashStableContext
| |
| rustc_hir::HashStableContext
| / \
rustc_ast::HashStableContext rustc_abi::HashStableContext
|
rustc_span::HashStableContext
```
All very strange and unnecessary. This commit changes
`derive(HashStable_Generic)` to use `rustc_span::HashStableContext`
instead of `crate::HashStableContext`. This eliminates the need for all
the empty `HashStableContext` traits and impls. Much better.
32 lines
825 B
Rust
32 lines
825 B
Rust
// tidy-alphabetical-start
|
|
#![allow(internal_features)]
|
|
#![feature(const_option_ops)]
|
|
#![feature(const_trait_impl)]
|
|
#![feature(default_field_values)]
|
|
#![feature(iter_intersperse)]
|
|
#![feature(macro_derive)]
|
|
#![feature(rustc_attrs)]
|
|
// To generate CodegenOptionsTargetModifiers and UnstableOptionsTargetModifiers enums
|
|
// with macro_rules, it is necessary to use recursive mechanic ("Incremental TT Munchers").
|
|
#![recursion_limit = "256"]
|
|
// tidy-alphabetical-end
|
|
|
|
pub use getopts;
|
|
pub use lint::{declare_lint, declare_lint_pass, declare_tool_lint, impl_lint_pass};
|
|
pub use rustc_lint_defs as lint;
|
|
pub use session::*;
|
|
|
|
pub mod code_stats;
|
|
pub mod errors;
|
|
pub mod parse;
|
|
pub mod utils;
|
|
#[macro_use]
|
|
pub mod config;
|
|
pub mod cstore;
|
|
pub mod filesearch;
|
|
mod macros;
|
|
mod options;
|
|
pub mod output;
|
|
pub mod search_paths;
|
|
mod session;
|