Skip to content
Merged

Rustup #4635

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
235a4c083eb2a2bfe8779d211c3232f39396de00
28d0a4a205f9e511ad2f51ee79a4aa19a704a455
5 changes: 3 additions & 2 deletions src/bin/log/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::env::{self, VarError};
use std::str::FromStr;
use std::sync::{Mutex, OnceLock};

use rustc_log::tracing;
use rustc_middle::ty::TyCtxt;
use rustc_session::{CtfeBacktrace, EarlyDiagCtxt};

Expand Down Expand Up @@ -72,8 +73,8 @@ fn init_logger_once(early_dcx: &EarlyDiagCtxt) {
early_dcx,
rustc_logger_config(),
|| {
tracing_subscriber::layer::SubscriberExt::with(
tracing_subscriber::Registry::default(),
rustc_log::tracing_subscriber::layer::SubscriberExt::with(
rustc_log::tracing_subscriber::Registry::default(),
chrome_layer,
)
},
Expand Down
65 changes: 31 additions & 34 deletions src/bin/log/tracing_chrome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
#![allow(warnings)]
#![cfg(feature = "tracing")]

// This is here and not in src/lib.rs since it is a direct dependency of tracing_chrome.rs and
// should not be included if the "tracing" feature is disabled.
extern crate tracing_core;

use tracing_core::{field::Field, span, Event, Subscriber};
use tracing_subscriber::{
use rustc_log::tracing_core::{field::Field, span, Event, Subscriber};
use rustc_log::tracing_subscriber::{
self,
layer::Context,
registry::{LookupSpan, SpanRef},
Layer,
Expand Down Expand Up @@ -526,16 +523,16 @@ where
}
},
TraceStyle::Async => Some(
span.scope()
.from_root()
.take(1)
.next()
.unwrap_or(span)
.id()
.into_u64()
span.scope()
.from_root()
.take(1)
.next()
.unwrap_or(span)
.id()
.into_u64()
.cast_signed() // the comment above explains the cast
),
}
}
}

fn enter_span(&self, span: SpanRef<S>, ts: f64, tid: usize, out: &Sender<Message>) {
Expand Down Expand Up @@ -570,11 +567,11 @@ where
Some(thread_data) => (thread_data, false),
None => {
let tid = self.max_tid.fetch_add(1, Ordering::SeqCst);
let out = self.out.lock().unwrap().clone();
let out = self.out.lock().unwrap().clone();
let start = TracingChromeInstant::setup_for_thread_and_start(tid);
*thread_data = Some(ThreadData { tid, out, start });
(thread_data.as_mut().unwrap(), true)
}
}
};

start.with_elapsed_micros_subtracting_tracing(|ts| {
Expand All @@ -586,7 +583,7 @@ where
let _ignored = out.send(Message::NewThread(*tid, name));
}
f(ts, *tid, out);
});
});
});
}
}
Expand All @@ -608,15 +605,15 @@ where
fn on_record(&self, id: &span::Id, values: &span::Record<'_>, ctx: Context<'_, S>) {
if self.include_args {
self.with_elapsed_micros_subtracting_tracing(|_, _, _| {
let span = ctx.span(id).unwrap();
let mut exts = span.extensions_mut();
let span = ctx.span(id).unwrap();
let mut exts = span.extensions_mut();

let args = exts.get_mut::<ArgsWrapper>();
let args = exts.get_mut::<ArgsWrapper>();

if let Some(args) = args {
let args = Arc::make_mut(&mut args.args);
values.record(&mut JsonVisitor { object: args });
}
if let Some(args) = args {
let args = Arc::make_mut(&mut args.args);
values.record(&mut JsonVisitor { object: args });
}
});
}
}
Expand All @@ -639,16 +636,16 @@ where

fn on_new_span(&self, attrs: &span::Attributes<'_>, id: &span::Id, ctx: Context<'_, S>) {
self.with_elapsed_micros_subtracting_tracing(|ts, tid, out| {
if self.include_args {
let mut args = Object::new();
attrs.record(&mut JsonVisitor { object: &mut args });
ctx.span(id).unwrap().extensions_mut().insert(ArgsWrapper {
args: Arc::new(args),
});
}
if let TraceStyle::Threaded = self.trace_style {
return;
}
if self.include_args {
let mut args = Object::new();
attrs.record(&mut JsonVisitor { object: &mut args });
ctx.span(id).unwrap().extensions_mut().insert(ArgsWrapper {
args: Arc::new(args),
});
}
if let TraceStyle::Threaded = self.trace_style {
return;
}

self.enter_span(ctx.span(id).expect("Span not found."), ts, tid, out);
});
Expand Down
7 changes: 1 addition & 6 deletions src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
rustc::untranslatable_diagnostic
)]

// Some "regular" crates we want to share with rustc
extern crate tracing;
#[cfg(feature = "tracing")]
extern crate tracing_subscriber;

// The rustc crates we need
extern crate rustc_abi;
extern crate rustc_data_structures;
Expand Down Expand Up @@ -48,6 +43,7 @@ use rustc_hir::def_id::LOCAL_CRATE;
use rustc_hir::{self as hir, Node};
use rustc_hir_analysis::check::check_function_signature;
use rustc_interface::interface::Config;
use rustc_log::tracing::debug;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::middle::exported_symbols::{
ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel,
Expand All @@ -60,7 +56,6 @@ use rustc_session::EarlyDiagCtxt;
use rustc_session::config::{CrateType, ErrorOutputType, OptLevel};
use rustc_session::search_paths::PathKind;
use rustc_span::def_id::DefId;
use tracing::debug;

use crate::log::setup::{deinit_loggers, init_early_loggers, init_late_loggers};

Expand Down
2 changes: 1 addition & 1 deletion src/borrow_tracker/stacked_borrows/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::ops::Range;

use rustc_data_structures::fx::FxHashSet;
use tracing::trace;
use rustc_log::tracing::trace;

use crate::borrow_tracker::stacked_borrows::{Item, Permission};
use crate::borrow_tracker::{AccessKind, BorTag};
Expand Down
1 change: 1 addition & 0 deletions src/concurrency/data_race.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ use rustc_abi::{Align, HasDataLayout, Size};
use rustc_ast::Mutability;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_index::{Idx, IndexVec};
use rustc_log::tracing;
use rustc_middle::mir;
use rustc_middle::ty::Ty;
use rustc_span::Span;
Expand Down
2 changes: 1 addition & 1 deletion src/concurrency/genmc/global_allocations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rand::SeedableRng;
use rand::rngs::StdRng;
use rustc_const_eval::interpret::{AllocId, AllocInfo, InterpResult, interp_ok};
use rustc_data_structures::fx::FxHashMap;
use tracing::debug;
use rustc_log::tracing::debug;

use crate::alloc_addresses::AddressGenerator;

Expand Down
1 change: 1 addition & 0 deletions src/concurrency/genmc/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::sync::Arc;
use std::time::Instant;

use genmc_sys::EstimationResult;
use rustc_log::tracing;
use rustc_middle::ty::TyCtxt;

use super::GlobalState;
Expand Down
3 changes: 2 additions & 1 deletion src/concurrency/genmc/scheduling.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use genmc_sys::{ActionKind, ExecutionState};
use rustc_data_structures::either::Either;
use rustc_middle::mir::TerminatorKind;
use rustc_middle::ty::{self, Ty};

Expand Down Expand Up @@ -38,7 +39,7 @@ fn get_next_instruction_kind<'tcx>(
let Some(frame) = thread_manager.active_thread_stack().last() else {
return interp_ok(NonAtomic);
};
let either::Either::Left(loc) = frame.current_loc() else {
let Either::Left(loc) = frame.current_loc() else {
// We are unwinding, so the next step is definitely not atomic.
return interp_ok(NonAtomic);
};
Expand Down
2 changes: 1 addition & 1 deletion src/concurrency/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use std::sync::atomic::Ordering::Relaxed;
use std::task::Poll;
use std::time::{Duration, SystemTime};

use either::Either;
use rand::seq::IteratorRandom;
use rustc_abi::ExternAbi;
use rustc_const_eval::CTRL_C_RECEIVED;
use rustc_data_structures::either::Either;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def_id::DefId;
use rustc_index::{Idx, IndexVec};
Expand Down
74 changes: 37 additions & 37 deletions src/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,47 +38,47 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
for i in 0..dest_len {
let op = this.read_immediate(&this.project_index(&op, i)?)?;
let dest = this.project_index(&dest, i)?;
let ty::Float(float_ty) = op.layout.ty.kind() else {
span_bug!(this.cur_span(), "{} operand is not a float", intrinsic_name)
};
// Using host floats except for sqrt (but it's fine, these operations do not
// have guaranteed precision).
let ty::Float(float_ty) = op.layout.ty.kind() else {
span_bug!(this.cur_span(), "{} operand is not a float", intrinsic_name)
};
// Using host floats except for sqrt (but it's fine, these operations do not
// have guaranteed precision).
let val = match float_ty {
FloatTy::F16 => unimplemented!("f16_f128"),
FloatTy::F32 => {
let f = op.to_scalar().to_f32()?;
FloatTy::F16 => unimplemented!("f16_f128"),
FloatTy::F32 => {
let f = op.to_scalar().to_f32()?;
let res = match intrinsic_name {
"fsqrt" => math::sqrt(f),
"fsin" => f.to_host().sin().to_soft(),
"fcos" => f.to_host().cos().to_soft(),
"fexp" => f.to_host().exp().to_soft(),
"fexp2" => f.to_host().exp2().to_soft(),
"flog" => f.to_host().ln().to_soft(),
"flog2" => f.to_host().log2().to_soft(),
"flog10" => f.to_host().log10().to_soft(),
_ => bug!(),
};
let res = this.adjust_nan(res, &[f]);
Scalar::from(res)
}
FloatTy::F64 => {
let f = op.to_scalar().to_f64()?;
"fsqrt" => math::sqrt(f),
"fsin" => f.to_host().sin().to_soft(),
"fcos" => f.to_host().cos().to_soft(),
"fexp" => f.to_host().exp().to_soft(),
"fexp2" => f.to_host().exp2().to_soft(),
"flog" => f.to_host().ln().to_soft(),
"flog2" => f.to_host().log2().to_soft(),
"flog10" => f.to_host().log10().to_soft(),
_ => bug!(),
};
let res = this.adjust_nan(res, &[f]);
Scalar::from(res)
}
FloatTy::F64 => {
let f = op.to_scalar().to_f64()?;
let res = match intrinsic_name {
"fsqrt" => math::sqrt(f),
"fsin" => f.to_host().sin().to_soft(),
"fcos" => f.to_host().cos().to_soft(),
"fexp" => f.to_host().exp().to_soft(),
"fexp2" => f.to_host().exp2().to_soft(),
"flog" => f.to_host().ln().to_soft(),
"flog2" => f.to_host().log2().to_soft(),
"flog10" => f.to_host().log10().to_soft(),
_ => bug!(),
"fsqrt" => math::sqrt(f),
"fsin" => f.to_host().sin().to_soft(),
"fcos" => f.to_host().cos().to_soft(),
"fexp" => f.to_host().exp().to_soft(),
"fexp2" => f.to_host().exp2().to_soft(),
"flog" => f.to_host().ln().to_soft(),
"flog2" => f.to_host().log2().to_soft(),
"flog10" => f.to_host().log10().to_soft(),
_ => bug!(),
};
let res = this.adjust_nan(res, &[f]);
Scalar::from(res)
}
FloatTy::F128 => unimplemented!("f16_f128"),
};
let res = this.adjust_nan(res, &[f]);
Scalar::from(res)
}
FloatTy::F128 => unimplemented!("f16_f128"),
};

this.write_scalar(val, &dest)?;
}
Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@
// Needed for rustdoc from bootstrap (with `-Znormalize-docs`).
#![recursion_limit = "256"]

// Some "regular" crates we want to share with rustc
extern crate either;
extern crate tracing;

// The rustc crates we need
extern crate rustc_abi;
extern crate rustc_apfloat;
Expand All @@ -63,6 +59,7 @@ extern crate rustc_errors;
extern crate rustc_hash;
extern crate rustc_hir;
extern crate rustc_index;
extern crate rustc_log;
extern crate rustc_middle;
extern crate rustc_session;
extern crate rustc_span;
Expand Down Expand Up @@ -96,8 +93,8 @@ pub use rustc_const_eval::interpret::*;
// Resolve ambiguity.
#[doc(no_inline)]
pub use rustc_const_eval::interpret::{self, AllocMap, Provenance as _};
use rustc_log::tracing::{self, info, trace};
use rustc_middle::{bug, span_bug};
use tracing::{info, trace};

#[cfg(all(unix, feature = "native-lib"))]
pub mod native_lib {
Expand Down
1 change: 1 addition & 0 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
#[allow(unused)]
use rustc_data_structures::static_assert_size;
use rustc_hir::attrs::InlineAttr;
use rustc_log::tracing;
use rustc_middle::middle::codegen_fn_attrs::TargetFeatureKind;
use rustc_middle::mir;
use rustc_middle::query::TyCtxtAt;
Expand Down
2 changes: 1 addition & 1 deletion src/provenance_gc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use either::Either;
use rustc_data_structures::either::Either;
use rustc_data_structures::fx::FxHashSet;

use crate::*;
Expand Down
1 change: 1 addition & 0 deletions src/shims/native_lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::sync::atomic::AtomicBool;
use libffi::low::CodePtr;
use libffi::middle::Type as FfiType;
use rustc_abi::{HasDataLayout, Size};
use rustc_data_structures::either;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, IntTy, Ty, UintTy};
use rustc_span::Symbol;
Expand Down