Skip to content

Commit d9a4a47

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

30 files changed

+308
-18
lines changed

Cargo.lock

+2-2
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

+5-1
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

+2-3
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

+6-3
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

+2
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

+2-1
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

+1
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

+2-1
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

-1
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

+1-3
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 }

library/alloc/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#![feature(local_waker)]
3838
#![feature(str_as_str)]
3939
#![feature(strict_provenance_lints)]
40-
#![feature(vec_pop_if)]
4140
#![feature(vec_deque_pop_if)]
4241
#![feature(unique_rc_arc)]
4342
#![feature(macro_metavar_expr_concat)]

src/doc/rustc/src/platform-support.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ target | notes
101101
[`riscv64gc-unknown-linux-gnu`](platform-support/riscv64gc-unknown-linux-gnu.md) | RISC-V Linux (kernel 4.20, glibc 2.29)
102102
[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20, musl 1.2.3)
103103
[`s390x-unknown-linux-gnu`](platform-support/s390x-unknown-linux-gnu.md) | S390x Linux (kernel 3.2, glibc 2.17)
104-
[`x86_64-unknown-freebsd`](platform-support/freebsd.md) | 64-bit amd64 FreeBSD
104+
[`x86_64-unknown-freebsd`](platform-support/freebsd.md) | 64-bit x86 FreeBSD
105105
[`x86_64-unknown-illumos`](platform-support/illumos.md) | illumos
106106
`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.3
107107
[`x86_64-unknown-netbsd`](platform-support/netbsd.md) | NetBSD/amd64

src/librustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rinja = { version = "0.3", default-features = false, features = ["config"] }
1313
base64 = "0.21.7"
1414
itertools = "0.12"
1515
indexmap = "2"
16-
minifier = { version = "0.3.2", default-features = false }
16+
minifier = { version = "0.3.4", default-features = false }
1717
pulldown-cmark-old = { version = "0.9.6", package = "pulldown-cmark", default-features = false }
1818
regex = "1"
1919
rustdoc-json-types = { path = "../rustdoc-json-types" }

tests/crashes/135470.rs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//@ known-bug: #135470
2+
//@ compile-flags: --edition=2021 -Copt-level=0
3+
4+
use std::future::Future;
5+
trait Access {
6+
type Lister;
7+
8+
fn list() -> impl Future<Output = Self::Lister> {
9+
async { todo!() }
10+
}
11+
}
12+
13+
trait Foo {}
14+
impl Access for dyn Foo {
15+
type Lister = ();
16+
}
17+
18+
fn main() {
19+
let svc = async {
20+
async { <dyn Foo>::list() }.await;
21+
};
22+
&svc as &dyn Service;
23+
}
24+
25+
trait UnaryService {
26+
fn call2() {}
27+
}
28+
trait Unimplemented {}
29+
impl<T: Unimplemented> UnaryService for T {}
30+
struct Wrap<T>(T);
31+
impl<T: Send> UnaryService for Wrap<T> {}
32+
33+
trait Service {
34+
fn call(&self);
35+
}
36+
impl<T: Send> Service for T {
37+
fn call(&self) {
38+
Wrap::<T>::call2();
39+
}
40+
}

tests/crashes/135528.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ known-bug: #135528
2+
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
3+
#![feature(type_alias_impl_trait)]
4+
type Tait = impl Copy;
5+
6+
fn set(x: &isize) -> isize {
7+
*x
8+
}
9+
10+
fn d(x: Tait) {
11+
set(x);
12+
}
13+
14+
fn other_define() -> Tait {
15+
()
16+
}
17+
18+
fn main() {}

tests/crashes/135570.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ known-bug: #135570
2+
//@compile-flags: -Zvalidate-mir -Zmir-enable-passes=+Inline -Copt-level=0 -Zmir-enable-passes=+GVN
3+
//@ only-x86_64
4+
5+
fn function_with_bytes<const BYTES: &'static [u8; 0xc7b889180b67b07d_bc1a3c88783d35b5_u128]>(
6+
) -> &'static [u8] {
7+
BYTES
8+
}
9+
10+
fn main() {
11+
function_with_bytes::<b"aa">() == &[];
12+
}

tests/crashes/135617.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ known-bug: #135617
2+
trait Project {
3+
const ASSOC: usize;
4+
}
5+
6+
fn foo()
7+
where
8+
for<'a> (): Project,
9+
{
10+
[(); <() as Project>::ASSOC];
11+
}
12+
13+
pub fn main() {}

tests/crashes/135646.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ known-bug: #135646
2+
//@ compile-flags: --edition=2024 -Zpolonius=next
3+
fn main() {
4+
&{ [1, 2, 3][4] };
5+
}

tests/crashes/135668.rs

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//@ known-bug: #135668
2+
//@ compile-flags: --edition=2021
3+
use std::future::Future;
4+
5+
pub async fn foo() {
6+
let _ = create_task().await;
7+
}
8+
9+
async fn create_task() -> impl Sized {
10+
bind(documentation)
11+
}
12+
13+
async fn documentation() {
14+
include_str!("nonexistent");
15+
}
16+
17+
fn bind<F>(_filter: F) -> impl Sized
18+
where
19+
F: FilterBase,
20+
{
21+
|| -> <F as FilterBase>::Assoc { panic!() }
22+
}
23+
24+
trait FilterBase {
25+
type Assoc;
26+
}
27+
28+
impl<F, R> FilterBase for F
29+
where
30+
F: Fn() -> R,
31+
// Removing the below line makes it correctly error on both stable and beta
32+
R: Future,
33+
// Removing the below line makes it ICE on both stable and beta
34+
R: Send,
35+
// Removing the above two bounds makes it ICE on stable but correctly error on beta
36+
{
37+
type Assoc = F;
38+
}

tests/crashes/135718.rs

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//@ known-bug: #135718
2+
3+
struct Equal;
4+
5+
struct Bar;
6+
7+
trait TwiceNested {}
8+
impl<M> TwiceNested for Bar where Bar: NestMakeEqual<NestEq = M> {}
9+
10+
struct Sum;
11+
12+
trait Not {
13+
fn not();
14+
}
15+
16+
impl<P> Not for Sum
17+
where
18+
Bar: NestMakeEqual<NestEq = P>,
19+
Self: Problem<P>,
20+
{
21+
fn not() {}
22+
}
23+
24+
trait NestMakeEqual {
25+
type NestEq;
26+
}
27+
28+
trait MakeEqual {
29+
type Eq;
30+
}
31+
32+
struct Foo;
33+
impl MakeEqual for Foo {
34+
type Eq = Equal;
35+
}
36+
37+
impl<O> NestMakeEqual for Bar
38+
where
39+
Foo: MakeEqual<Eq = O>,
40+
{
41+
type NestEq = O;
42+
}
43+
44+
trait Problem<M> {}
45+
impl Problem<()> for Sum where Bar: TwiceNested {}
46+
impl Problem<Equal> for Sum where Bar: TwiceNested {}
47+
48+
fn main() {
49+
Sum::not();
50+
}

tests/crashes/135720.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//@ known-bug: #135720
2+
#![feature(generic_const_exprs)]
3+
type S<'l> = [i32; A];
4+
fn lint_me(x: S<()>) {}

tests/crashes/135845.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: #135845
2+
struct S<'a, T: ?Sized>(&'a T);
3+
4+
fn b<'a>() -> S<'static, _> {
5+
S::<'a>(&0)
6+
}

tests/crashes/135863.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ known-bug: #135863
2+
struct A;
3+
4+
impl A {
5+
fn len(self: &&B) {}
6+
}
7+
8+
fn main() {
9+
A.len()
10+
}

tests/crashes/136063.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: #136063
2+
#![feature(generic_const_exprs)]
3+
trait A<const B: u8 = X> {}
4+
impl A<1> for bool {}
5+
fn bar(arg : &dyn A<x>) { bar(true) }
6+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: requested DWARF version 1 is not supported
2+
|
3+
= help: supported DWARF versions are 2, 3, 4 and 5
4+
5+
error: aborting due to 1 previous error
6+

0 commit comments

Comments
 (0)