Auto merge of #96082 - michaelwoerister:less_impl_stable_hash_via_hash, r=compiler-errors
incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it. Fixes https://github.com/rust-lang/rust/issues/96013.
This commit is contained in:
commit
27af517549
8 changed files with 38 additions and 37 deletions
|
@ -3,14 +3,14 @@
|
|||
|
||||
pub use crate::options::*;
|
||||
|
||||
use crate::lint;
|
||||
use crate::search_paths::SearchPath;
|
||||
use crate::utils::{CanonicalizedPath, NativeLib, NativeLibKind};
|
||||
use crate::{early_error, early_warn, Session};
|
||||
use crate::{lint, HashStableContext};
|
||||
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::impl_stable_hash_via_hash;
|
||||
|
||||
use rustc_data_structures::stable_hasher::ToStableHashKey;
|
||||
use rustc_target::abi::{Align, TargetDataLayout};
|
||||
use rustc_target::spec::{LinkerFlavor, SplitDebuginfo, Target, TargetTriple, TargetWarnings};
|
||||
use rustc_target::spec::{PanicStrategy, SanitizerSet, TARGETS};
|
||||
|
@ -78,7 +78,7 @@ pub enum CFProtection {
|
|||
Full,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Hash, HashStable_Generic)]
|
||||
pub enum OptLevel {
|
||||
No, // -O0
|
||||
Less, // -O1
|
||||
|
@ -88,8 +88,6 @@ pub enum OptLevel {
|
|||
SizeMin, // -Oz
|
||||
}
|
||||
|
||||
impl_stable_hash_via_hash!(OptLevel);
|
||||
|
||||
/// This is what the `LtoCli` values get mapped to after resolving defaults and
|
||||
/// and taking other command line options into account.
|
||||
///
|
||||
|
@ -230,15 +228,13 @@ impl SwitchWithOptPath {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable_Generic)]
|
||||
#[derive(Encodable, Decodable)]
|
||||
pub enum SymbolManglingVersion {
|
||||
Legacy,
|
||||
V0,
|
||||
}
|
||||
|
||||
impl_stable_hash_via_hash!(SymbolManglingVersion);
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
|
||||
pub enum DebugInfo {
|
||||
None,
|
||||
|
@ -277,7 +273,7 @@ impl FromStr for SplitDwarfKind {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, HashStable_Generic)]
|
||||
#[derive(Encodable, Decodable)]
|
||||
pub enum OutputType {
|
||||
Bitcode,
|
||||
|
@ -290,7 +286,13 @@ pub enum OutputType {
|
|||
DepInfo,
|
||||
}
|
||||
|
||||
impl_stable_hash_via_hash!(OutputType);
|
||||
impl<HCX: HashStableContext> ToStableHashKey<HCX> for OutputType {
|
||||
type KeyType = Self;
|
||||
|
||||
fn to_stable_hash_key(&self, _: &HCX) -> Self::KeyType {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
impl OutputType {
|
||||
fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool {
|
||||
|
@ -396,7 +398,7 @@ pub enum TrimmedDefPaths {
|
|||
/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
|
||||
/// dependency tracking for command-line arguments. Also only hash keys, since tracking
|
||||
/// should only depend on the output types, not the paths they're written to.
|
||||
#[derive(Clone, Debug, Hash)]
|
||||
#[derive(Clone, Debug, Hash, HashStable_Generic)]
|
||||
pub struct OutputTypes(BTreeMap<OutputType, Option<PathBuf>>);
|
||||
|
||||
impl OutputTypes {
|
||||
|
@ -585,7 +587,7 @@ impl Input {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Hash, Debug)]
|
||||
#[derive(Clone, Hash, Debug, HashStable_Generic)]
|
||||
pub struct OutputFilenames {
|
||||
pub out_directory: PathBuf,
|
||||
filestem: String,
|
||||
|
@ -594,8 +596,6 @@ pub struct OutputFilenames {
|
|||
pub outputs: OutputTypes,
|
||||
}
|
||||
|
||||
impl_stable_hash_via_hash!(OutputFilenames);
|
||||
|
||||
pub const RLINK_EXT: &str = "rlink";
|
||||
pub const RUST_CGU_EXT: &str = "rcgu";
|
||||
pub const DWARF_OBJECT_EXT: &str = "dwo";
|
||||
|
@ -808,15 +808,14 @@ impl DebuggingOptions {
|
|||
}
|
||||
|
||||
// The type of entry function, so users can have their own entry functions
|
||||
#[derive(Copy, Clone, PartialEq, Hash, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Hash, Debug, HashStable_Generic)]
|
||||
pub enum EntryFnType {
|
||||
Main,
|
||||
Start,
|
||||
}
|
||||
|
||||
impl_stable_hash_via_hash!(EntryFnType);
|
||||
|
||||
#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug, Encodable, Decodable)]
|
||||
#[derive(HashStable_Generic)]
|
||||
pub enum CrateType {
|
||||
Executable,
|
||||
Dylib,
|
||||
|
@ -826,8 +825,6 @@ pub enum CrateType {
|
|||
ProcMacro,
|
||||
}
|
||||
|
||||
impl_stable_hash_via_hash!(CrateType);
|
||||
|
||||
impl CrateType {
|
||||
/// When generated, is this crate type an archive?
|
||||
pub fn is_archive(&self) -> bool {
|
||||
|
|
|
@ -26,7 +26,7 @@ pub struct SearchPathFile {
|
|||
pub file_name_str: String,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Copy, Debug, Hash, Eq, Encodable, Decodable)]
|
||||
#[derive(PartialEq, Clone, Copy, Debug, Hash, Eq, Encodable, Decodable, HashStable_Generic)]
|
||||
pub enum PathKind {
|
||||
Native,
|
||||
Crate,
|
||||
|
@ -36,8 +36,6 @@ pub enum PathKind {
|
|||
All,
|
||||
}
|
||||
|
||||
rustc_data_structures::impl_stable_hash_via_hash!(PathKind);
|
||||
|
||||
impl PathKind {
|
||||
pub fn matches(&self, kind: PathKind) -> bool {
|
||||
match (self, kind) {
|
||||
|
|
|
@ -18,6 +18,7 @@ impl Session {
|
|||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)]
|
||||
#[derive(HashStable_Generic)]
|
||||
pub enum NativeLibKind {
|
||||
/// Static library (e.g. `libfoo.a` on Linux or `foo.lib` on Windows/MSVC)
|
||||
Static {
|
||||
|
@ -57,9 +58,8 @@ impl NativeLibKind {
|
|||
}
|
||||
}
|
||||
|
||||
rustc_data_structures::impl_stable_hash_via_hash!(NativeLibKind);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)]
|
||||
#[derive(HashStable_Generic)]
|
||||
pub struct NativeLib {
|
||||
pub name: String,
|
||||
pub new_name: Option<String>,
|
||||
|
@ -73,8 +73,6 @@ impl NativeLib {
|
|||
}
|
||||
}
|
||||
|
||||
rustc_data_structures::impl_stable_hash_via_hash!(NativeLib);
|
||||
|
||||
/// A path that has been canonicalized along with its original, non-canonicalized form
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct CanonicalizedPath {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue