Rollup merge of #89634 - hawkw:eliza/enable-err-warn, r=oli-obk
rustc_driver: Enable the `WARN` log level by default This commit changes the `tracing_subscriber` initialization in `rustc_driver` so that the `WARN` verbosity level is enabled by default when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env variable is set, the filter string in the environment variable is honored, instead. Fixes #76824 Closes #89623 cc ``@eddyb,`` ``@oli-obk``
This commit is contained in:
commit
9d14b6505b
|
@ -843,19 +843,18 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
|
||||||
let msg_bus = "clang: error: unable to execute command: Bus error: 10";
|
let msg_bus = "clang: error: unable to execute command: Bus error: 10";
|
||||||
if out.contains(msg_segv) || out.contains(msg_bus) {
|
if out.contains(msg_segv) || out.contains(msg_bus) {
|
||||||
warn!(
|
warn!(
|
||||||
|
?cmd, %out,
|
||||||
"looks like the linker segfaulted when we tried to call it, \
|
"looks like the linker segfaulted when we tried to call it, \
|
||||||
automatically retrying again. cmd = {:?}, out = {}.",
|
automatically retrying again",
|
||||||
cmd, out,
|
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_illegal_instruction(&output.status) {
|
if is_illegal_instruction(&output.status) {
|
||||||
warn!(
|
warn!(
|
||||||
|
?cmd, %out, status = %output.status,
|
||||||
"looks like the linker hit an illegal instruction when we \
|
"looks like the linker hit an illegal instruction when we \
|
||||||
tried to call it, automatically retrying again. cmd = {:?}, ]\
|
tried to call it, automatically retrying again.",
|
||||||
out = {}, status = {}.",
|
|
||||||
cmd, out, output.status,
|
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1253,12 +1253,16 @@ pub fn init_rustc_env_logger() {
|
||||||
/// tracing crate version. In contrast to `init_rustc_env_logger` it allows you to choose an env var
|
/// tracing crate version. In contrast to `init_rustc_env_logger` it allows you to choose an env var
|
||||||
/// other than `RUSTC_LOG`.
|
/// other than `RUSTC_LOG`.
|
||||||
pub fn init_env_logger(env: &str) {
|
pub fn init_env_logger(env: &str) {
|
||||||
// Don't register a dispatcher if there's no filter to print anything
|
use tracing_subscriber::{
|
||||||
match std::env::var(env) {
|
filter::{self, EnvFilter, LevelFilter},
|
||||||
Err(_) => return,
|
layer::SubscriberExt,
|
||||||
Ok(s) if s.is_empty() => return,
|
};
|
||||||
Ok(_) => {}
|
|
||||||
}
|
let filter = match std::env::var(env) {
|
||||||
|
Ok(env) => EnvFilter::from_env(env),
|
||||||
|
_ => EnvFilter::default().add_directive(filter::Directive::from(LevelFilter::WARN)),
|
||||||
|
};
|
||||||
|
|
||||||
let color_logs = match std::env::var(String::from(env) + "_COLOR") {
|
let color_logs = match std::env::var(String::from(env) + "_COLOR") {
|
||||||
Ok(value) => match value.as_ref() {
|
Ok(value) => match value.as_ref() {
|
||||||
"always" => true,
|
"always" => true,
|
||||||
|
@ -1278,7 +1282,7 @@ pub fn init_env_logger(env: &str) {
|
||||||
"non-Unicode log color value: expected one of always, never, or auto",
|
"non-Unicode log color value: expected one of always, never, or auto",
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
let filter = tracing_subscriber::EnvFilter::from_env(env);
|
|
||||||
let layer = tracing_tree::HierarchicalLayer::default()
|
let layer = tracing_tree::HierarchicalLayer::default()
|
||||||
.with_writer(io::stderr)
|
.with_writer(io::stderr)
|
||||||
.with_indent_lines(true)
|
.with_indent_lines(true)
|
||||||
|
@ -1288,7 +1292,6 @@ pub fn init_env_logger(env: &str) {
|
||||||
#[cfg(parallel_compiler)]
|
#[cfg(parallel_compiler)]
|
||||||
let layer = layer.with_thread_ids(true).with_thread_names(true);
|
let layer = layer.with_thread_ids(true).with_thread_names(true);
|
||||||
|
|
||||||
use tracing_subscriber::layer::SubscriberExt;
|
|
||||||
let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer);
|
let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer);
|
||||||
tracing::subscriber::set_global_default(subscriber).unwrap();
|
tracing::subscriber::set_global_default(subscriber).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2308,7 +2308,7 @@ pub fn is_case_difference(sm: &SourceMap, suggested: &str, sp: Span) -> bool {
|
||||||
let found = match sm.span_to_snippet(sp) {
|
let found = match sm.span_to_snippet(sp) {
|
||||||
Ok(snippet) => snippet,
|
Ok(snippet) => snippet,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("Invalid span {:?}. Err={:?}", sp, e);
|
warn!(error = ?e, "Invalid span {:?}", sp);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -289,7 +289,7 @@ impl<'tcx> RustcPeekAt<'tcx> for MaybeMutBorrowedLocals<'_, 'tcx> {
|
||||||
flow_state: &BitSet<Local>,
|
flow_state: &BitSet<Local>,
|
||||||
call: PeekCall,
|
call: PeekCall,
|
||||||
) {
|
) {
|
||||||
warn!("peek_at: place={:?}", place);
|
info!(?place, "peek_at");
|
||||||
let local = if let Some(l) = place.as_local() {
|
let local = if let Some(l) = place.as_local() {
|
||||||
l
|
l
|
||||||
} else {
|
} else {
|
||||||
|
@ -311,7 +311,7 @@ impl<'tcx> RustcPeekAt<'tcx> for MaybeLiveLocals {
|
||||||
flow_state: &BitSet<Local>,
|
flow_state: &BitSet<Local>,
|
||||||
call: PeekCall,
|
call: PeekCall,
|
||||||
) {
|
) {
|
||||||
warn!("peek_at: place={:?}", place);
|
info!(?place, "peek_at");
|
||||||
let local = if let Some(l) = place.as_local() {
|
let local = if let Some(l) = place.as_local() {
|
||||||
l
|
l
|
||||||
} else {
|
} else {
|
||||||
|
|
1
src/test/ui/consts/const_in_pattern/issue-73431.stderr
Normal file
1
src/test/ui/consts/const_in_pattern/issue-73431.stderr
Normal file
|
@ -0,0 +1 @@
|
||||||
|
WARN rustc_mir_build::thir::pattern::const_to_pat MIR const-checker found novel structural match violation. See #73448.
|
Loading…
Reference in a new issue