move CollapseMacroDebuginfo

This commit is contained in:
mejrs
2026-08-17 18:27:33 +02:00
committed by Jonathan Brouwer
parent 8d970ffe69
commit 7bec351981
10 changed files with 33 additions and 32 deletions

View File

@@ -4748,7 +4748,6 @@ dependencies = [
"libc",
"rustc_abi",
"rustc_ast",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",

View File

@@ -16,7 +16,7 @@ use rustc_macros::{Decodable, Encodable, PrintAttribute, StableHash};
use rustc_span::def_id::DefId;
use rustc_span::hygiene::Transparency;
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};
use rustc_structures::{CrateType, Limit, NativeLibKind, SanitizerSet};
use rustc_structures::{CollapseMacroDebuginfo, CrateType, Limit, NativeLibKind, SanitizerSet};
use thin_vec::ThinVec;
pub use crate::canonical_symbols::{CanonicalSymbol, CanonicalSymbols};
@@ -601,26 +601,6 @@ impl<E: rustc_span::SpanEncoder> rustc_serialize::Encodable<E> for DocAttribute
}
}
/// How to perform collapse macros debug info
/// if-ext - if macro from different crate (related to callsite code)
/// | cmd \ attr | no | (unspecified) | external | yes |
/// | no | no | no | no | no |
/// | (unspecified) | no | no | if-ext | yes |
/// | external | no | if-ext | if-ext | yes |
/// | yes | yes | yes | yes | yes |
#[derive(Copy, Clone, Debug, Hash, PartialEq)]
#[derive(StableHash, Encodable, Decodable, PrintAttribute)]
pub enum CollapseMacroDebuginfo {
/// Don't collapse debuginfo for the macro
No = 0,
/// Unspecified value
Unspecified = 1,
/// Collapse debuginfo if the macro comes from a different crate
External = 2,
/// Collapse debuginfo for the macro
Yes = 3,
}
#[derive(Clone, Debug, StableHash, Encodable, Decodable, PrintAttribute)]
pub enum RustcDumpLayoutKind {
Align,

View File

@@ -14,7 +14,7 @@ use rustc_data_structures::fx::FxIndexMap;
use rustc_span::def_id::DefId;
use rustc_span::hygiene::Transparency;
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};
use rustc_structures::{CrateType, Limit, NativeLibKind, SanitizerSet};
use rustc_structures::{CollapseMacroDebuginfo, CrateType, Limit, NativeLibKind, SanitizerSet};
use thin_vec::ThinVec;
/// This trait is used to print attributes in `rustc_hir_pretty`.
@@ -209,4 +209,5 @@ print_debug!(
DiffMode,
CrateType,
NativeLibKind,
CollapseMacroDebuginfo,
);

View File

@@ -1,6 +1,7 @@
use rustc_attr_ir::{CollapseMacroDebuginfo, MacroUseArgs, find_attr};
use rustc_attr_ir::{MacroUseArgs, find_attr};
use rustc_feature::AttributeStability;
use rustc_lint_defs::builtin::INVALID_MACRO_EXPORT_ARGUMENTS;
use rustc_structures::CollapseMacroDebuginfo;
use super::prelude::*;
use crate::diagnostics::MacroOnlyAttribute;

View File

@@ -9,9 +9,7 @@ use rustc_ast::attr::MarkedAttrs;
use rustc_ast::tokenstream::TokenStream;
use rustc_ast::visit::{AssocCtxt, Visitor};
use rustc_ast::{self as ast, AttrVec, Attribute, HasAttrs, Item, NodeId, PatKind, Safety};
use rustc_attr_ir::{
self as attrs, CfgEntry, CollapseMacroDebuginfo, Deprecation, Stability, find_attr,
};
use rustc_attr_ir::{self as attrs, CfgEntry, Deprecation, Stability, find_attr};
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
use rustc_data_structures::sync;
use rustc_errors::{BufferedEarlyLint, DiagCtxtHandle, ErrorGuaranteed};
@@ -27,7 +25,7 @@ use rustc_span::edition::Edition;
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId, MacroKind};
use rustc_span::source_map::SourceMap;
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw};
use rustc_structures::Limit;
use rustc_structures::{CollapseMacroDebuginfo, Limit};
use smallvec::{SmallVec, smallvec};
use thin_vec::ThinVec;

View File

@@ -8,7 +8,6 @@ edition = "2024"
getopts = "0.2"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_attr_ir = { path = "../rustc_attr_ir" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }

View File

@@ -3317,7 +3317,6 @@ pub(crate) mod dep_tracking {
use rustc_abi::Align;
use rustc_ast::attr::version::RustcVersion;
use rustc_attr_ir::CollapseMacroDebuginfo;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::stable_hash::StableHasher;
use rustc_errors::LanguageIdentifier;
@@ -3325,6 +3324,7 @@ pub(crate) mod dep_tracking {
use rustc_hashes::Hash64;
use rustc_span::edition::Edition;
use rustc_span::{RealFileName, RemapPathScopeComponents};
use rustc_structures::CollapseMacroDebuginfo;
use rustc_target::spec::{
CodeModel, FramePointer, MergeFunctions, OnBrokenPipe, PanicStrategy, RelocModel,
RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, SymbolVisibility, TargetTuple,

View File

@@ -5,7 +5,6 @@ use std::str;
use rustc_abi::Align;
use rustc_ast::attr::version::RustcVersion;
use rustc_attr_ir::CollapseMacroDebuginfo;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::profiling::TimePassesFormat;
use rustc_data_structures::stable_hash::StableHasher;
@@ -16,7 +15,7 @@ use rustc_macros::{BlobDecodable, Encodable};
use rustc_span::edit_distance::edit_distance;
use rustc_span::edition::Edition;
use rustc_span::{RealFileName, RemapPathScopeComponents, SourceFileHashAlgorithm};
use rustc_structures::CrateType;
use rustc_structures::{CollapseMacroDebuginfo, CrateType};
use rustc_target::spec::{
CodeModel, FramePointer, LinkerFlavorCli, MergeFunctions, OnBrokenPipe, PanicStrategy,
RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, SymbolVisibility,

View File

@@ -0,0 +1,22 @@
#[cfg(feature = "nightly")]
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, StableHash};
// How to perform collapse macros debug info
/// if-ext - if macro from different crate (related to callsite code)
/// | cmd \ attr | no | (unspecified) | external | yes |
/// | no | no | no | no | no |
/// | (unspecified) | no | no | if-ext | yes |
/// | external | no | if-ext | if-ext | yes |
/// | yes | yes | yes | yes | yes |
#[derive(Copy, Clone, Debug, Hash, PartialEq)]
#[cfg_attr(feature = "nightly", derive(StableHash, Encodable_NoContext, Decodable_NoContext))]
pub enum CollapseMacroDebuginfo {
/// Don't collapse debuginfo for the macro
No = 0,
/// Unspecified value
Unspecified = 1,
/// Collapse debuginfo if the macro comes from a different crate
External = 2,
/// Collapse debuginfo for the macro
Yes = 3,
}

View File

@@ -1,10 +1,12 @@
#![deny(unstable_features)]
mod collapse_macro_debug_info;
mod crate_type;
mod limit;
mod native_lib_kind;
mod sanitizer_set;
pub use collapse_macro_debug_info::CollapseMacroDebuginfo;
pub use crate_type::CrateType;
pub use limit::Limit;
pub use native_lib_kind::NativeLibKind;