Auto merge of #149419 - matthiaskrgr:rollup-v3q93fq, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#147952 (Add a timeout to the `remote-test-client` connection)
 - rust-lang/rust#149321 (Fix ICE when include_str! reads binary files)
 - rust-lang/rust#149398 (add regression test for issue rust-lang/rust#143987)
 - rust-lang/rust#149411 (Tidying up UI tests [5/N])
 - rust-lang/rust#149413 (add test for issue 143821)
 - rust-lang/rust#149415 (Remove test-float-parse from workspace list in tidy)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-11-28 17:26:31 +00:00
commit cc3eee7fbe
46 changed files with 258 additions and 151 deletions

View file

@ -891,12 +891,6 @@ Exercise *Link-Time Optimization* (LTO), involving the flags `-C lto` or `-Z thi
Tests on changes to inference variable lattice LUB/GLB, see <https://github.com/rust-lang/rust/pull/45853>.
## `tests/ui/macro_backtrace/`: `-Zmacro-backtrace`
Contains a single test, checking the unstable command-line flag to enable detailed macro backtraces.
**FIXME**: This could be merged with `ui/macros`, which already contains other macro backtrace tests.
## `tests/ui/macros/`
Broad category of tests on macros.
@ -945,12 +939,6 @@ Something is missing which could be added to fix (e.g. suggestions).
**FIXME**: this is way too vague, tests should be rehomed.
## `tests/ui/missing_non_modrs_mod/`
This directory is a small tree of `mod` dependencies, but the root, `foo.rs`, is looking for a file which does not exist. The test checks that the error is reported at the top-level module.
**FIXME**: Merge with `tests/ui/modules/`.
## `tests/ui/missing-trait-bounds/`
Tests for checking missing trait bounds, and their diagnostics.
@ -963,10 +951,6 @@ Tests on the module system.
**FIXME**: `tests/ui/imports/` should probably be merged with this.
## `tests/ui/modules_and_files_visibility/`
**FIXME**: Merge with `tests/ui/modules/`.
## `tests/ui/moves`
Tests on moves (destructive moves).
@ -1135,12 +1119,6 @@ A large category about function and type public/private visibility, and its impa
**FIXME**: merge with `tests/ui/privacy/`.
## `tests/ui/qualified/`
Contains few tests on qualified paths where a type parameter is provided at the end: `type A = <S as Tr>::A::f<u8>;`. The tests check if this fails during type checking, not parsing.
**FIXME**: Should be rehomed to `ui/typeck`.
## `tests/ui/query-system/`
Tests on Rust methods and functions which use the query system, such as `std::mem::size_of`. These compute information about the current runtime and return it. See [Query system | rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/query.html).
@ -1583,12 +1561,6 @@ Tests on various well-formedness checks, e.g. [Type-checking normal functions](h
Tests on `where` clauses. See [Where clauses | Reference](https://doc.rust-lang.org/reference/items/generics.html#where-clauses).
## `tests/ui/while/`
Tests on the `while` keyword and the `while` construct.
**FIXME**: merge with `ui/for-loop-while`.
## `tests/ui/windows-subsystem/`: `#![windows_subsystem = ""]`
See [the `windows_subsystem` attribute](https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute).

View file

@ -0,0 +1,30 @@
// Regression test for issue https://github.com/rust-lang/rust/issues/143987
// Ensure that using `#[align]` on struct fields produces an error
// instead of causing an ICE (Internal Compiler Error)
// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
#![feature(rustc_attrs)]
#![feature(fn_align)]
struct Data {
#[rustc_align(8)] //~ ERROR `#[rustc_align]` attribute cannot be used on struct fields
x: usize,
}
// Test with invalid type to match the original issue more closely
struct DataInvalid {
#[rustc_align(8)] //~ ERROR `#[rustc_align]` attribute cannot be used on struct fields
x: usize8, //~ ERROR cannot find type `usize8` in this scope
}
// Test with tuple struct
struct TupleData(
#[rustc_align(32)] //~ ERROR `#[rustc_align]` attribute cannot be used on struct fields
u32
);
// Test that it works correctly on functions (no error)
#[rustc_align(16)]
fn aligned_function() {}
fn main() {}

View file

@ -0,0 +1,33 @@
error[E0412]: cannot find type `usize8` in this scope
--> $DIR/align-on-fields-143987.rs:17:8
|
LL | x: usize8,
| ^^^^^^ help: a builtin type with a similar name exists: `usize`
error: `#[rustc_align]` attribute cannot be used on struct fields
--> $DIR/align-on-fields-143987.rs:10:5
|
LL | #[rustc_align(8)]
| ^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_align]` can only be applied to functions
error: `#[rustc_align]` attribute cannot be used on struct fields
--> $DIR/align-on-fields-143987.rs:16:5
|
LL | #[rustc_align(8)]
| ^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_align]` can only be applied to functions
error: `#[rustc_align]` attribute cannot be used on struct fields
--> $DIR/align-on-fields-143987.rs:22:5
|
LL | #[rustc_align(32)]
| ^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_align]` can only be applied to functions
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0412`.

View file

@ -0,0 +1,39 @@
//@ check-pass
// Regression test for issue https://github.com/rust-lang/rust/issues/143821
// Tests that we don't ICE when borrow-checking nested closures with generic type parameters
// and late-bound lifetime parameters.
fn data_<T: 'static>(_: &()) -> &T {
loop {}
}
fn register<T, F>(f: F) -> IfaceToken<T>
where
T: 'static,
F: FnOnce(&()),
{
loop {}
}
fn method_with_cr_async<CB>(cb: CB)
where
CB: Fn(),
{
loop {}
}
struct IfaceToken<T: 'static>(T);
fn foo<T>() -> IfaceToken<T> {
register::<T, _>(|b: &()| {
method_with_cr_async(|| {
data_::<T>(&());
});
})
}
struct A();
fn main() {
foo::<A>();
}

View file

@ -1,4 +1,5 @@
//@ check-pass
// regression test for #40235
#![allow(unused_variables)]
fn foo() {}

Binary file not shown.

View file

@ -0,0 +1,10 @@
//@ normalize-stderr: "at byte `\d+`" -> "at byte `$$BYTE`"
//@ normalize-stderr: "`[^`\n]*invalid-utf8-binary-file\.bin`" -> "`$DIR/invalid-utf8-binary-file.bin`"
//@ rustc-env:INVALID_UTF8_BIN={{src-base}}/include-macros/invalid-utf8-binary-file.bin
//! Ensure that ICE does not occur when reading an invalid UTF8 file with an absolute path.
//! regression test for issue <https://github.com/rust-lang/rust/issues/149304>
#![doc = include_str!(concat!(env!("INVALID_UTF8_BIN")))] //~ ERROR: wasn't a utf-8 file
fn main() {}

View file

@ -0,0 +1,10 @@
error: `/invalid-utf8-binary-file.bin` wasn't a utf-8 file
--> $DIR/invalid-utf8-binary-file.rs:8:10
|
LL | #![doc = include_str!(concat!(env!("INVALID_UTF8_BIN")))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: invalid utf-8 at byte `$BYTE`
error: aborting due to 1 previous error

View file

@ -1,30 +1,30 @@
// Test that the macro backtrace facility works (supporting file)
// Test that the macro backtrace facility works (supporting macro-backtrace-complex.rs)
// a non-local macro
#[macro_export]
macro_rules! ping {
() => {
pong!();
}
};
}
#[macro_export]
macro_rules! deep {
() => {
foo!();
}
};
}
#[macro_export]
macro_rules! foo {
() => {
bar!();
}
};
}
#[macro_export]
macro_rules! bar {
() => {
ping!();
}
};
}

View file

@ -1,5 +1,5 @@
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:10:20
--> $DIR/macro-backtrace-complex.rs:12:20
|
LL | / macro_rules! pong {
LL | | () => { syntax error };
@ -11,7 +11,7 @@ LL | pong!();
| ------- in this macro invocation
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:10:20
--> $DIR/macro-backtrace-complex.rs:12:20
|
LL | / macro_rules! pong {
LL | | () => { syntax error };
@ -31,7 +31,7 @@ LL | pong!();
| ------- in this macro invocation (#2)
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:10:20
--> $DIR/macro-backtrace-complex.rs:12:20
|
LL | / macro_rules! pong {
LL | | () => { syntax error };

View file

@ -1,5 +1,5 @@
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:10:20
--> $DIR/macro-backtrace-complex.rs:12:20
|
LL | () => { syntax error };
| ^^^^^ expected one of 8 possible tokens
@ -10,7 +10,7 @@ LL | pong!();
= note: this error originates in the macro `pong` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:10:20
--> $DIR/macro-backtrace-complex.rs:12:20
|
LL | () => { syntax error };
| ^^^^^ expected one of 8 possible tokens
@ -21,7 +21,7 @@ LL | ping!();
= note: this error originates in the macro `pong` which comes from the expansion of the macro `ping` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error`
--> $DIR/main.rs:10:20
--> $DIR/macro-backtrace-complex.rs:12:20
|
LL | () => { syntax error };
| ^^^^^ expected one of 8 possible tokens

View file

@ -1,9 +1,11 @@
// Test that the macro backtrace facility works
// Test the unstable command-line flag (-Z macro-backtrace) to enable detailed macro backtraces
// across nested local and external macros.
//@ aux-build:ping.rs
//@ revisions: default -Zmacro-backtrace
//@[-Zmacro-backtrace] compile-flags: -Z macro-backtrace
#[macro_use] extern crate ping;
#[macro_use]
extern crate ping;
// a local macro
macro_rules! pong {

View file

@ -1,4 +0,0 @@
mod foo;
fn main() {}
//~? ERROR file not found for module `missing`

View file

@ -1,4 +0,0 @@
mod foo_inline;
fn main() {}
//~? ERROR file not found for module `missing`

View file

@ -1,3 +1,3 @@
//@ ignore-auxiliary (used by `./missing_non_modrs_mod.rs`)
// looking for a file which does not exist.
mod missing;

View file

@ -1,5 +1,5 @@
//@ ignore-auxiliary (used by `./missing_non_modrs_mod_inline.rs`)
// looking for a file which does not exist.
mod inline {
mod missing;
}

View file

@ -0,0 +1,5 @@
//! Tests the error reporting when a declared module file is missing.
mod missing_mod;
fn main() {}
//~? ERROR file not found for module `missing`

View file

@ -1,10 +1,10 @@
error[E0583]: file not found for module `missing`
--> $DIR/foo.rs:3:1
--> $DIR/missing_mod.rs:3:1
|
LL | mod missing;
| ^^^^^^^^^^^^
|
= help: to create the module `missing`, create file "$DIR/foo/missing.rs" or "$DIR/foo/missing/mod.rs"
= help: to create the module `missing`, create file "$DIR/missing_mod/missing.rs" or "$DIR/missing_mod/missing/mod.rs"
= note: if there is a `mod missing` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to 1 previous error

View file

@ -0,0 +1,5 @@
//! Tests the error reporting when a declared module file is missing.
mod missing_mod_inline;
fn main() {}
//~? ERROR file not found for module `missing`

View file

@ -1,10 +1,10 @@
error[E0583]: file not found for module `missing`
--> $DIR/foo_inline.rs:4:5
--> $DIR/missing_mod_inline.rs:4:5
|
LL | mod missing;
| ^^^^^^^^^^^^
|
= help: to create the module `missing`, create file "$DIR/foo_inline/inline/missing.rs" or "$DIR/foo_inline/inline/missing/mod.rs"
= help: to create the module `missing`, create file "$DIR/missing_mod_inline/inline/missing.rs" or "$DIR/missing_mod_inline/inline/missing/mod.rs"
= note: if there is a `mod missing` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to 1 previous error

View file

@ -1,3 +1,4 @@
//@ ignore-auxiliary (used by `./mod_file_with_path_attr.rs` and `mod_file.rs`)
//@ ignore-auxiliary (used by `./mod_file_with_path_attr.rs` and `mod_file.rs` and `mod_file_correct_spans.rs`)
// ignore-tidy-linelength
pub fn foo() -> isize { 10 }

View file

@ -0,0 +1,5 @@
//! related issue <https://github.com/rust-lang/rust/issues/4116>
mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0761]: file for module `mod_file_disambig_aux` found at both "$DIR/mod_file_disambig_aux.rs" and "$DIR/mod_file_disambig_aux/mod.rs"
--> $DIR/mod_file_disambig.rs:3:1
|
LL | mod mod_file_disambig_aux;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: delete or rename one of them to remove the ambiguity
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0761`.

View file

@ -1,3 +0,0 @@
//@ ignore-auxiliary (used by `./mod_file_correct_spans.rs`)
pub fn foo() -> isize { 10 }

View file

@ -1,6 +0,0 @@
mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both
fn main() {
assert_eq!(mod_file_aux::bar(), 10);
//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `mod_file_aux`
}

View file

@ -1,23 +0,0 @@
error[E0761]: file for module `mod_file_disambig_aux` found at both "$DIR/mod_file_disambig_aux.rs" and "$DIR/mod_file_disambig_aux/mod.rs"
--> $DIR/mod_file_disambig.rs:1:1
|
LL | mod mod_file_disambig_aux;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: delete or rename one of them to remove the ambiguity
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `mod_file_aux`
--> $DIR/mod_file_disambig.rs:4:16
|
LL | assert_eq!(mod_file_aux::bar(), 10);
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `mod_file_aux`
|
help: to make use of source file $DIR/mod_file_aux.rs, use `mod mod_file_aux` in this file to declare the module
|
LL + mod mod_file_aux;
|
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0433, E0761.
For more information about an error, try `rustc --explain E0433`.

View file

@ -1,21 +0,0 @@
// Check that qualified paths with type parameters
// fail during type checking and not during parsing
struct S;
trait Tr {
type A;
}
impl Tr for S {
type A = S;
}
impl S {
fn f<T>() {}
}
type A = <S as Tr>::A::f<u8>;
//~^ ERROR ambiguous associated type
fn main() {}

View file

@ -1,15 +0,0 @@
error[E0223]: ambiguous associated type
--> $DIR/qualified-path-params-2.rs:18:10
|
LL | type A = <S as Tr>::A::f<u8>;
| ^^^^^^^^^^^^^^^^^^^
|
help: if there were a trait named `Example` with associated type `f` implemented for `<S as Tr>::A`, you could use the fully-qualified path
|
LL - type A = <S as Tr>::A::f<u8>;
LL + type A = <<S as Tr>::A as Example>::f<u8>;
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0223`.

View file

@ -1,18 +0,0 @@
error[E0533]: expected unit struct, unit variant or constant, found associated function `<<S as Tr>::A>::f<u8>`
--> $DIR/qualified-path-params.rs:20:9
|
LL | <S as Tr>::A::f::<u8> => {}
| ^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant
error[E0029]: only `char` and numeric types are allowed in range patterns
--> $DIR/qualified-path-params.rs:22:15
|
LL | 0 ..= <S as Tr>::A::f::<u8> => {}
| - ^^^^^^^^^^^^^^^^^^^^^ this is of type `fn() {S::f::<u8>}` but it should be `char` or numeric
| |
| this is of type `{integer}`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0029, E0533.
For more information about an error, try `rustc --explain E0029`.

View file

@ -15,11 +15,14 @@ impl S {
fn f<T>() {}
}
type A = <S as Tr>::A::f<u8>;
//~^ ERROR ambiguous associated type
fn main() {
match 10 {
<S as Tr>::A::f::<u8> => {}
//~^ ERROR expected unit struct, unit variant or constant, found associated function
0 ..= <S as Tr>::A::f::<u8> => {}
0..=<S as Tr>::A::f::<u8> => {}
//~^ ERROR only `char` and numeric types are allowed in range
}
}

View file

@ -0,0 +1,30 @@
error[E0223]: ambiguous associated type
--> $DIR/qualified-path-params.rs:18:10
|
LL | type A = <S as Tr>::A::f<u8>;
| ^^^^^^^^^^^^^^^^^^^
|
help: if there were a trait named `Example` with associated type `f` implemented for `<S as Tr>::A`, you could use the fully-qualified path
|
LL - type A = <S as Tr>::A::f<u8>;
LL + type A = <<S as Tr>::A as Example>::f<u8>;
|
error[E0533]: expected unit struct, unit variant or constant, found associated function `<<S as Tr>::A>::f<u8>`
--> $DIR/qualified-path-params.rs:23:9
|
LL | <S as Tr>::A::f::<u8> => {}
| ^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant
error[E0029]: only `char` and numeric types are allowed in range patterns
--> $DIR/qualified-path-params.rs:25:13
|
LL | 0..=<S as Tr>::A::f::<u8> => {}
| - ^^^^^^^^^^^^^^^^^^^^^ this is of type `fn() {S::f::<u8>}` but it should be `char` or numeric
| |
| this is of type `{integer}`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0029, E0223, E0533.
For more information about an error, try `rustc --explain E0029`.