Skip to content

Commit 7bec351

Browse files
mejrsJonathanBrouwer
authored andcommitted
move CollapseMacroDebuginfo
1 parent 8d970ff commit 7bec351

10 files changed

Lines changed: 33 additions & 32 deletions

File tree

‎Cargo.lock‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4748,7 +4748,6 @@ dependencies = [
47484748
"libc",
47494749
"rustc_abi",
47504750
"rustc_ast",
4751-
"rustc_attr_ir",
47524751
"rustc_data_structures",
47534752
"rustc_errors",
47544753
"rustc_feature",

‎compiler/rustc_attr_ir/src/data_structures.rs‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_macros::{Decodable, Encodable, PrintAttribute, StableHash};
1616
use rustc_span::def_id::DefId;
1717
use rustc_span::hygiene::Transparency;
1818
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};
19-
use rustc_structures::{CrateType, Limit, NativeLibKind, SanitizerSet};
19+
use rustc_structures::{CollapseMacroDebuginfo, CrateType, Limit, NativeLibKind, SanitizerSet};
2020
use thin_vec::ThinVec;
2121

2222
pub use crate::canonical_symbols::{CanonicalSymbol, CanonicalSymbols};
@@ -601,26 +601,6 @@ impl<E: rustc_span::SpanEncoder> rustc_serialize::Encodable<E> for DocAttribute
601601
}
602602
}
603603

604-
/// How to perform collapse macros debug info
605-
/// if-ext - if macro from different crate (related to callsite code)
606-
/// | cmd \ attr | no | (unspecified) | external | yes |
607-
/// | no | no | no | no | no |
608-
/// | (unspecified) | no | no | if-ext | yes |
609-
/// | external | no | if-ext | if-ext | yes |
610-
/// | yes | yes | yes | yes | yes |
611-
#[derive(Copy, Clone, Debug, Hash, PartialEq)]
612-
#[derive(StableHash, Encodable, Decodable, PrintAttribute)]
613-
pub enum CollapseMacroDebuginfo {
614-
/// Don't collapse debuginfo for the macro
615-
No = 0,
616-
/// Unspecified value
617-
Unspecified = 1,
618-
/// Collapse debuginfo if the macro comes from a different crate
619-
External = 2,
620-
/// Collapse debuginfo for the macro
621-
Yes = 3,
622-
}
623-
624604
#[derive(Clone, Debug, StableHash, Encodable, Decodable, PrintAttribute)]
625605
pub enum RustcDumpLayoutKind {
626606
Align,

‎compiler/rustc_attr_ir/src/pretty_printing.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_data_structures::fx::FxIndexMap;
1414
use rustc_span::def_id::DefId;
1515
use rustc_span::hygiene::Transparency;
1616
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};
17-
use rustc_structures::{CrateType, Limit, NativeLibKind, SanitizerSet};
17+
use rustc_structures::{CollapseMacroDebuginfo, CrateType, Limit, NativeLibKind, SanitizerSet};
1818
use thin_vec::ThinVec;
1919

2020
/// This trait is used to print attributes in `rustc_hir_pretty`.
@@ -209,4 +209,5 @@ print_debug!(
209209
DiffMode,
210210
CrateType,
211211
NativeLibKind,
212+
CollapseMacroDebuginfo,
212213
);

‎compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use rustc_attr_ir::{CollapseMacroDebuginfo, MacroUseArgs, find_attr};
1+
use rustc_attr_ir::{MacroUseArgs, find_attr};
22
use rustc_feature::AttributeStability;
33
use rustc_lint_defs::builtin::INVALID_MACRO_EXPORT_ARGUMENTS;
4+
use rustc_structures::CollapseMacroDebuginfo;
45

56
use super::prelude::*;
67
use crate::diagnostics::MacroOnlyAttribute;

‎compiler/rustc_expand/src/base.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ use rustc_ast::attr::MarkedAttrs;
99
use rustc_ast::tokenstream::TokenStream;
1010
use rustc_ast::visit::{AssocCtxt, Visitor};
1111
use rustc_ast::{self as ast, AttrVec, Attribute, HasAttrs, Item, NodeId, PatKind, Safety};
12-
use rustc_attr_ir::{
13-
self as attrs, CfgEntry, CollapseMacroDebuginfo, Deprecation, Stability, find_attr,
14-
};
12+
use rustc_attr_ir::{self as attrs, CfgEntry, Deprecation, Stability, find_attr};
1513
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
1614
use rustc_data_structures::sync;
1715
use rustc_errors::{BufferedEarlyLint, DiagCtxtHandle, ErrorGuaranteed};
@@ -27,7 +25,7 @@ use rustc_span::edition::Edition;
2725
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId, MacroKind};
2826
use rustc_span::source_map::SourceMap;
2927
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw};
30-
use rustc_structures::Limit;
28+
use rustc_structures::{CollapseMacroDebuginfo, Limit};
3129
use smallvec::{SmallVec, smallvec};
3230
use thin_vec::ThinVec;
3331

‎compiler/rustc_session/Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ edition = "2024"
88
getopts = "0.2"
99
rustc_abi = { path = "../rustc_abi" }
1010
rustc_ast = { path = "../rustc_ast" }
11-
rustc_attr_ir = { path = "../rustc_attr_ir" }
1211
rustc_data_structures = { path = "../rustc_data_structures" }
1312
rustc_errors = { path = "../rustc_errors" }
1413
rustc_feature = { path = "../rustc_feature" }

‎compiler/rustc_session/src/config.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3317,14 +3317,14 @@ pub(crate) mod dep_tracking {
33173317

33183318
use rustc_abi::Align;
33193319
use rustc_ast::attr::version::RustcVersion;
3320-
use rustc_attr_ir::CollapseMacroDebuginfo;
33213320
use rustc_data_structures::fx::FxIndexMap;
33223321
use rustc_data_structures::stable_hash::StableHasher;
33233322
use rustc_errors::LanguageIdentifier;
33243323
use rustc_feature::UnstableFeatures;
33253324
use rustc_hashes::Hash64;
33263325
use rustc_span::edition::Edition;
33273326
use rustc_span::{RealFileName, RemapPathScopeComponents};
3327+
use rustc_structures::CollapseMacroDebuginfo;
33283328
use rustc_target::spec::{
33293329
CodeModel, FramePointer, MergeFunctions, OnBrokenPipe, PanicStrategy, RelocModel,
33303330
RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, SymbolVisibility, TargetTuple,

‎compiler/rustc_session/src/options.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::str;
55

66
use rustc_abi::Align;
77
use rustc_ast::attr::version::RustcVersion;
8-
use rustc_attr_ir::CollapseMacroDebuginfo;
98
use rustc_data_structures::fx::FxIndexMap;
109
use rustc_data_structures::profiling::TimePassesFormat;
1110
use rustc_data_structures::stable_hash::StableHasher;
@@ -16,7 +15,7 @@ use rustc_macros::{BlobDecodable, Encodable};
1615
use rustc_span::edit_distance::edit_distance;
1716
use rustc_span::edition::Edition;
1817
use rustc_span::{RealFileName, RemapPathScopeComponents, SourceFileHashAlgorithm};
19-
use rustc_structures::CrateType;
18+
use rustc_structures::{CollapseMacroDebuginfo, CrateType};
2019
use rustc_target::spec::{
2120
CodeModel, FramePointer, LinkerFlavorCli, MergeFunctions, OnBrokenPipe, PanicStrategy,
2221
RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, SymbolVisibility,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#[cfg(feature = "nightly")]
2+
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, StableHash};
3+
4+
// How to perform collapse macros debug info
5+
/// if-ext - if macro from different crate (related to callsite code)
6+
/// | cmd \ attr | no | (unspecified) | external | yes |
7+
/// | no | no | no | no | no |
8+
/// | (unspecified) | no | no | if-ext | yes |
9+
/// | external | no | if-ext | if-ext | yes |
10+
/// | yes | yes | yes | yes | yes |
11+
#[derive(Copy, Clone, Debug, Hash, PartialEq)]
12+
#[cfg_attr(feature = "nightly", derive(StableHash, Encodable_NoContext, Decodable_NoContext))]
13+
pub enum CollapseMacroDebuginfo {
14+
/// Don't collapse debuginfo for the macro
15+
No = 0,
16+
/// Unspecified value
17+
Unspecified = 1,
18+
/// Collapse debuginfo if the macro comes from a different crate
19+
External = 2,
20+
/// Collapse debuginfo for the macro
21+
Yes = 3,
22+
}

‎compiler/rustc_structures/src/lib.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#![deny(unstable_features)]
22

3+
mod collapse_macro_debug_info;
34
mod crate_type;
45
mod limit;
56
mod native_lib_kind;
67
mod sanitizer_set;
78

9+
pub use collapse_macro_debug_info::CollapseMacroDebuginfo;
810
pub use crate_type::CrateType;
911
pub use limit::Limit;
1012
pub use native_lib_kind::NativeLibKind;

0 commit comments

Comments
 (0)