Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a4e595d

Browse files
committedFeb 23, 2021
Auto merge of #82430 - Dylan-DPC:rollup-nu4kfyc, r=Dylan-DPC
Rollup of 12 pull requests Successful merges: - #79423 (Enable smart punctuation) - #81154 (Improve design of `assert_len`) - #81235 (Improve suggestion for tuple struct pattern matching errors.) - #81769 (Suggest `return`ing tail expressions that match return type) - #81837 (Slight perf improvement on char::to_ascii_lowercase) - #81969 (Avoid `cfg_if` in `std::os`) - #81984 (Make WASI's `hard_link` behavior match other platforms.) - #82091 (use PlaceRef abstractions more consistently) - #82128 (add diagnostic items for OsString/PathBuf/Owned as well as to_vec on slice) - #82166 (add s390x-unknown-linux-musl target) - #82234 (Remove query parameters when skipping search results) - #82255 (Make `treat_err_as_bug` Option<NonZeroUsize>) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents b02a619 + 0e5bca5 commit a4e595d

File tree

68 files changed

+680
-268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+680
-268
lines changed
 

‎compiler/rustc_codegen_ssa/src/mir/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
199199
}
200200

201201
self.visit_local(&place_ref.local, context, location);
202-
self.visit_projection(place_ref.local, place_ref.projection, context, location);
202+
self.visit_projection(*place_ref, context, location);
203203
}
204204
}
205205
}

‎compiler/rustc_errors/src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use rustc_span::{Loc, MultiSpan, Span};
3030

3131
use std::borrow::Cow;
3232
use std::hash::{Hash, Hasher};
33+
use std::num::NonZeroUsize;
3334
use std::panic;
3435
use std::path::Path;
3536
use std::{error, fmt};
@@ -359,7 +360,7 @@ pub struct HandlerFlags {
359360
pub can_emit_warnings: bool,
360361
/// If true, error-level diagnostics are upgraded to bug-level.
361362
/// (rustc: see `-Z treat-err-as-bug`)
362-
pub treat_err_as_bug: Option<usize>,
363+
pub treat_err_as_bug: Option<NonZeroUsize>,
363364
/// If true, immediately emit diagnostics that would otherwise be buffered.
364365
/// (rustc: see `-Z dont-buffer-diagnostics` and `-Z treat-err-as-bug`)
365366
pub dont_buffer_diagnostics: bool,
@@ -396,7 +397,7 @@ impl Handler {
396397
pub fn with_tty_emitter(
397398
color_config: ColorConfig,
398399
can_emit_warnings: bool,
399-
treat_err_as_bug: Option<usize>,
400+
treat_err_as_bug: Option<NonZeroUsize>,
400401
sm: Option<Lrc<SourceMap>>,
401402
) -> Self {
402403
Self::with_tty_emitter_and_flags(
@@ -424,7 +425,7 @@ impl Handler {
424425

425426
pub fn with_emitter(
426427
can_emit_warnings: bool,
427-
treat_err_as_bug: Option<usize>,
428+
treat_err_as_bug: Option<NonZeroUsize>,
428429
emitter: Box<dyn Emitter + sync::Send>,
429430
) -> Self {
430431
Handler::with_emitter_and_flags(
@@ -841,7 +842,7 @@ impl HandlerInner {
841842
}
842843

843844
fn treat_err_as_bug(&self) -> bool {
844-
self.flags.treat_err_as_bug.map_or(false, |c| self.err_count() >= c)
845+
self.flags.treat_err_as_bug.map_or(false, |c| self.err_count() >= c.get())
845846
}
846847

847848
fn print_error_count(&mut self, registry: &Registry) {
@@ -950,7 +951,7 @@ impl HandlerInner {
950951
// This is technically `self.treat_err_as_bug()` but `delay_span_bug` is called before
951952
// incrementing `err_count` by one, so we need to +1 the comparing.
952953
// FIXME: Would be nice to increment err_count in a more coherent way.
953-
if self.flags.treat_err_as_bug.map_or(false, |c| self.err_count() + 1 >= c) {
954+
if self.flags.treat_err_as_bug.map_or(false, |c| self.err_count() + 1 >= c.get()) {
954955
// FIXME: don't abort here if report_delayed_bugs is off
955956
self.span_bug(sp, msg);
956957
}
@@ -1023,7 +1024,7 @@ impl HandlerInner {
10231024

10241025
fn panic_if_treat_err_as_bug(&self) {
10251026
if self.treat_err_as_bug() {
1026-
match (self.err_count(), self.flags.treat_err_as_bug.unwrap_or(0)) {
1027+
match (self.err_count(), self.flags.treat_err_as_bug.map(|c| c.get()).unwrap_or(0)) {
10271028
(1, 1) => panic!("aborting due to `-Z treat-err-as-bug=1`"),
10281029
(0, _) | (1, _) => {}
10291030
(count, as_bug) => panic!(

0 commit comments

Comments
 (0)
Please sign in to comment.