Skip to content

Commit d9a4a47

Browse files
committed
Auto merge of rust-lang#136785 - matthiaskrgr:rollup-sdhlna8, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#135488 (Stabilize `vec_pop_if`) - rust-lang#136068 (crashes: more tests) - rust-lang#136694 (Update minifier version to `0.3.4`) - rust-lang#136722 (Visit all debug info in MIR Visitor) - rust-lang#136746 (Emit an error if `-Zdwarf-version=1` is requested) - rust-lang#136760 (Fix unwrap error in overflowing int literal) - rust-lang#136782 (Fix mistake in x86_64-unknown-freebsd platform description) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 124cc92 + cfd65f0 commit d9a4a47

File tree

30 files changed

+308
-18
lines changed

30 files changed

+308
-18
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,9 +2322,9 @@ dependencies = [
23222322

23232323
[[package]]
23242324
name = "minifier"
2325-
version = "0.3.2"
2325+
version = "0.3.4"
23262326
source = "registry+https://github.com/rust-lang/crates.io-index"
2327-
checksum = "bd559bbf5d350ac7f2c1cf92ed71a869b847a92bce0c1318b47932a5b5f65cdd"
2327+
checksum = "1cf47565b1430f5fe6c81d3afcb4b835271348d7eb35294a4d592e38dd09ea22"
23282328

23292329
[[package]]
23302330
name = "minimal-lexical"

compiler/rustc_lint/src/types.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,11 @@ impl<'tcx> LateLintPass<'tcx> for TypeLimits {
543543
lit: &'tcx hir::Lit,
544544
negated: bool,
545545
) {
546-
lint_literal(cx, self, hir_id, lit.span, lit, negated)
546+
if negated {
547+
self.negated_expr_id = Some(hir_id);
548+
self.negated_expr_span = Some(lit.span);
549+
}
550+
lint_literal(cx, self, hir_id, lit.span, lit, negated);
547551
}
548552

549553
fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx hir::Expr<'tcx>) {

compiler/rustc_lint/src/types/literal.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,11 @@ fn lint_int_literal<'tcx>(
250250
lit: &hir::Lit,
251251
t: ty::IntTy,
252252
v: u128,
253-
negated: bool,
254253
) {
255254
let int_type = t.normalize(cx.sess().target.pointer_width);
256255
let (min, max) = int_ty_range(int_type);
257256
let max = max as u128;
258-
let negative = negated ^ (type_limits.negated_expr_id == Some(hir_id));
257+
let negative = type_limits.negated_expr_id == Some(hir_id);
259258

260259
// Detect literal value out of range [min, max] inclusive
261260
// avoiding use of -min to prevent overflow/panic
@@ -374,7 +373,7 @@ pub(crate) fn lint_literal<'tcx>(
374373
ty::Int(t) => {
375374
match lit.node {
376375
ast::LitKind::Int(v, ast::LitIntType::Signed(_) | ast::LitIntType::Unsuffixed) => {
377-
lint_int_literal(cx, type_limits, hir_id, span, lit, t, v.get(), negated)
376+
lint_int_literal(cx, type_limits, hir_id, span, lit, t, v.get())
378377
}
379378
_ => bug!(),
380379
};

compiler/rustc_middle/src/mir/visit.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,9 @@ macro_rules! make_mir_visitor {
527527
target: _,
528528
unwind: _,
529529
call_source: _,
530-
fn_span: _
530+
fn_span,
531531
} => {
532+
self.visit_span($(& $mutability)? *fn_span);
532533
self.visit_operand(func, location);
533534
for arg in args {
534535
self.visit_operand(&$($mutability)? arg.node, location);
@@ -543,8 +544,9 @@ macro_rules! make_mir_visitor {
543544
TerminatorKind::TailCall {
544545
func,
545546
args,
546-
fn_span: _,
547+
fn_span,
547548
} => {
549+
self.visit_span($(& $mutability)? *fn_span);
548550
self.visit_operand(func, location);
549551
for arg in args {
550552
self.visit_operand(&$($mutability)? arg.node, location);
@@ -853,6 +855,8 @@ macro_rules! make_mir_visitor {
853855
local_info: _,
854856
} = local_decl;
855857

858+
self.visit_source_info(source_info);
859+
856860
self.visit_ty($(& $mutability)? *ty, TyContext::LocalDecl {
857861
local,
858862
source_info: *source_info,
@@ -862,7 +866,6 @@ macro_rules! make_mir_visitor {
862866
self.visit_user_type_projection(user_ty);
863867
}
864868
}
865-
self.visit_source_info(source_info);
866869
}
867870

868871
fn super_var_debug_info(

compiler/rustc_mir_transform/src/inline.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,8 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
12571257
// replaced down below anyways).
12581258
if !matches!(terminator.kind, TerminatorKind::Return) {
12591259
self.super_terminator(terminator, loc);
1260+
} else {
1261+
self.visit_source_info(&mut terminator.source_info);
12601262
}
12611263

12621264
match terminator.kind {

compiler/rustc_session/messages.ftl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ session_unstable_virtual_function_elimination = `-Zvirtual-function-elimination`
133133
session_unsupported_crate_type_for_target =
134134
dropping unsupported crate type `{$crate_type}` for target `{$target_triple}`
135135
136-
session_unsupported_dwarf_version = requested DWARF version {$dwarf_version} is greater than 5
136+
session_unsupported_dwarf_version = requested DWARF version {$dwarf_version} is not supported
137+
session_unsupported_dwarf_version_help = supported DWARF versions are 2, 3, 4 and 5
137138
138139
session_unsupported_reg_struct_return_arch = `-Zreg-struct-return` is only supported on x86
139140
session_unsupported_regparm = `-Zregparm={$regparm}` is unsupported (valid values 0-3)

compiler/rustc_session/src/errors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ pub(crate) struct UnstableVirtualFunctionElimination;
161161

162162
#[derive(Diagnostic)]
163163
#[diag(session_unsupported_dwarf_version)]
164+
#[help(session_unsupported_dwarf_version_help)]
164165
pub(crate) struct UnsupportedDwarfVersion {
165166
pub(crate) dwarf_version: u32,
166167
}

compiler/rustc_session/src/session.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,8 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
12511251
}
12521252

12531253
if let Some(dwarf_version) = sess.opts.unstable_opts.dwarf_version {
1254-
if dwarf_version > 5 {
1254+
// DWARF 1 is not supported by LLVM and DWARF 6 is not yet finalized.
1255+
if dwarf_version < 2 || dwarf_version > 5 {
12551256
sess.dcx().emit_err(errors::UnsupportedDwarfVersion { dwarf_version });
12561257
}
12571258
}

library/alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156
#![feature(unicode_internals)]
157157
#![feature(unsize)]
158158
#![feature(unwrap_infallible)]
159-
#![feature(vec_pop_if)]
160159
// tidy-alphabetical-end
161160
//
162161
// Language features:

library/alloc/src/vec/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,16 +2519,14 @@ impl<T, A: Allocator> Vec<T, A> {
25192519
/// # Examples
25202520
///
25212521
/// ```
2522-
/// #![feature(vec_pop_if)]
2523-
///
25242522
/// let mut vec = vec![1, 2, 3, 4];
25252523
/// let pred = |x: &mut i32| *x % 2 == 0;
25262524
///
25272525
/// assert_eq!(vec.pop_if(pred), Some(4));
25282526
/// assert_eq!(vec, [1, 2, 3]);
25292527
/// assert_eq!(vec.pop_if(pred), None);
25302528
/// ```
2531-
#[unstable(feature = "vec_pop_if", issue = "122741")]
2529+
#[stable(feature = "vec_pop_if", since = "CURRENT_RUSTC_VERSION")]
25322530
pub fn pop_if(&mut self, predicate: impl FnOnce(&mut T) -> bool) -> Option<T> {
25332531
let last = self.last_mut()?;
25342532
if predicate(last) { self.pop() } else { None }

0 commit comments

Comments
 (0)