Skip to content

Commit 5825740

Browse files
committed
Auto merge of #144740 - jdonszelmann:rollup-nprgqnm, r=jdonszelmann
Rollup of 6 pull requests Successful merges: - rust-lang/rust#144688 (Uniform `enter_trace_span!` and add documentation) - rust-lang/rust#144702 (stall `ConstArgHasType` in `compute_goal_fast_path`) - rust-lang/rust#144711 (Consider operator's span when computing binop expr span) - rust-lang/rust#144712 (Deduplicate `IntTy`/`UintTy`/`FloatTy`.) - rust-lang/rust#144726 (merge rustc_attr_data_structures into rustc_hir) - rust-lang/rust#144733 (fix: Match width of ascii and unicode secondary file start) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1828559 + 4f80a1e commit 5825740

File tree

3 files changed

+7
-39
lines changed

3 files changed

+7
-39
lines changed

src/helpers.rs

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,43 +1245,14 @@ impl ToU64 for usize {
12451245
}
12461246
}
12471247

1248-
/// This struct is needed to enforce `#[must_use]` on values produced by [enter_trace_span] even
1249-
/// when the "tracing" feature is not enabled.
1250-
#[must_use]
1251-
pub struct MaybeEnteredTraceSpan {
1252-
#[cfg(feature = "tracing")]
1253-
pub _entered_span: tracing::span::EnteredSpan,
1254-
}
1255-
12561248
/// Enters a [tracing::info_span] only if the "tracing" feature is enabled, otherwise does nothing.
1257-
/// This is like [rustc_const_eval::enter_trace_span] except that it does not depend on the
1258-
/// [Machine] trait to check if tracing is enabled, because from the Miri codebase we can directly
1259-
/// check whether the "tracing" feature is enabled, unlike from the rustc_const_eval codebase.
1260-
///
1261-
/// In addition to the syntax accepted by [tracing::span!], this macro optionally allows passing
1262-
/// the span name (i.e. the first macro argument) in the form `NAME::SUBNAME` (without quotes) to
1263-
/// indicate that the span has name "NAME" (usually the name of the component) and has an additional
1264-
/// more specific name "SUBNAME" (usually the function name). The latter is passed to the [tracing]
1265-
/// infrastructure as a span field with the name "NAME". This allows not being distracted by
1266-
/// subnames when looking at the trace in <https://ui.perfetto.dev>, but when deeper introspection
1267-
/// is needed within a component, it's still possible to view the subnames directly in the UI by
1268-
/// selecting a span, clicking on the "NAME" argument on the right, and clicking on "Visualize
1269-
/// argument values".
1270-
/// ```rust
1271-
/// // for example, the first will expand to the second
1272-
/// enter_trace_span!(borrow_tracker::on_stack_pop, /* ... */)
1273-
/// enter_trace_span!("borrow_tracker", borrow_tracker = "on_stack_pop", /* ... */)
1274-
/// ```
1249+
/// This calls [rustc_const_eval::enter_trace_span] with [MiriMachine] as the first argument, which
1250+
/// will in turn call [MiriMachine::enter_trace_span], which takes care of determining at compile
1251+
/// time whether to trace or not (and supposedly the call is compiled out if tracing is disabled).
1252+
/// Look at [rustc_const_eval::enter_trace_span] for complete documentation, examples and tips.
12751253
#[macro_export]
12761254
macro_rules! enter_trace_span {
1277-
($name:ident :: $subname:ident $($tt:tt)*) => {{
1278-
enter_trace_span!(stringify!($name), $name = %stringify!($subname) $($tt)*)
1279-
}};
1280-
12811255
($($tt:tt)*) => {
1282-
$crate::MaybeEnteredTraceSpan {
1283-
#[cfg(feature = "tracing")]
1284-
_entered_span: tracing::info_span!($($tt)*).entered()
1285-
}
1256+
rustc_const_eval::enter_trace_span!($crate::MiriMachine<'static>, $($tt)*)
12861257
};
12871258
}

src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ extern crate tracing;
5757
extern crate rustc_abi;
5858
extern crate rustc_apfloat;
5959
extern crate rustc_ast;
60-
extern crate rustc_attr_data_structures;
6160
extern crate rustc_const_eval;
6261
extern crate rustc_data_structures;
6362
extern crate rustc_errors;
@@ -143,9 +142,7 @@ pub use crate::eval::{
143142
AlignmentCheck, BacktraceStyle, IsolatedOp, MiriConfig, MiriEntryFnType, RejectOpWith,
144143
ValidationMode, create_ecx, eval_entry,
145144
};
146-
pub use crate::helpers::{
147-
AccessKind, EvalContextExt as _, MaybeEnteredTraceSpan, ToU64 as _, ToUsize as _,
148-
};
145+
pub use crate::helpers::{AccessKind, EvalContextExt as _, ToU64 as _, ToUsize as _};
149146
pub use crate::intrinsics::EvalContextExt as _;
150147
pub use crate::machine::{
151148
AllocExtra, DynMachineCallback, FrameExtra, MachineCallback, MemoryKind, MiriInterpCx,

src/machine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rand::rngs::StdRng;
1212
use rand::{Rng, SeedableRng};
1313
use rustc_abi::{Align, ExternAbi, Size};
1414
use rustc_apfloat::{Float, FloatConvert};
15-
use rustc_attr_data_structures::InlineAttr;
15+
use rustc_hir::attrs::InlineAttr;
1616
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1717
#[allow(unused)]
1818
use rustc_data_structures::static_assert_size;

0 commit comments

Comments
 (0)