Merge from rustc

This commit is contained in:
The Miri Cronjob Bot 2025-04-26 04:59:48 +00:00
commit 6c2fa0bce7
221 changed files with 3217 additions and 2142 deletions

View file

@ -51,3 +51,12 @@ fn main() {
#[unsafe(naked)] //~ ERROR should be applied to a function definition
|| {};
}
// Check that the path of an attribute without a name is printed correctly (issue #140082)
#[::a]
//~^ ERROR attribute incompatible with `#[unsafe(naked)]`
//~| ERROR failed to resolve: use of unresolved module or unlinked crate `a`
#[unsafe(naked)]
extern "C" fn issue_140082() {
naked_asm!("")
}

View file

@ -1,3 +1,9 @@
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a`
--> $DIR/naked-invalid-attr.rs:56:5
|
LL | #[::a]
| ^ use of unresolved module or unlinked crate `a`
error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:13:1
|
@ -27,6 +33,15 @@ LL | #[unsafe(naked)]
LL | || {};
| ----- not a function definition
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
--> $DIR/naked-invalid-attr.rs:56:1
|
LL | #[::a]
| ^^^^^^ the `{{root}}::a` attribute is incompatible with `#[unsafe(naked)]`
...
LL | #[unsafe(naked)]
| ---------------- function marked with `#[unsafe(naked)]` here
error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:22:5
|
@ -49,5 +64,7 @@ error: attribute should be applied to a function definition
LL | #![unsafe(naked)]
| ^^^^^^^^^^^^^^^^^ cannot be applied to crates
error: aborting due to 6 previous errors
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0433, E0736.
For more information about an error, try `rustc --explain E0433`.

View file

@ -0,0 +1,8 @@
error: unexpected `--cfg target_has_reliable_f128` flag
|
= note: config `target_has_reliable_f128` is only supposed to be controlled by `--target`
= note: manually setting a built-in cfg can and does create incoherent behaviors
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
error: aborting due to 1 previous error

View file

@ -0,0 +1,8 @@
error: unexpected `--cfg target_has_reliable_f128_math` flag
|
= note: config `target_has_reliable_f128_math` is only supposed to be controlled by `--target`
= note: manually setting a built-in cfg can and does create incoherent behaviors
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
error: aborting due to 1 previous error

View file

@ -0,0 +1,8 @@
error: unexpected `--cfg target_has_reliable_f16` flag
|
= note: config `target_has_reliable_f16` is only supposed to be controlled by `--target`
= note: manually setting a built-in cfg can and does create incoherent behaviors
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
error: aborting due to 1 previous error

View file

@ -0,0 +1,8 @@
error: unexpected `--cfg target_has_reliable_f16_math` flag
|
= note: config `target_has_reliable_f16_math` is only supposed to be controlled by `--target`
= note: manually setting a built-in cfg can and does create incoherent behaviors
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
error: aborting due to 1 previous error

View file

@ -8,6 +8,7 @@
//@ revisions: target_thread_local_ relocation_model_
//@ revisions: fmt_debug_
//@ revisions: emscripten_wasm_eh_
//@ revisions: reliable_f16_ reliable_f16_math_ reliable_f128_ reliable_f128_math_
//@ [overflow_checks_]compile-flags: --cfg overflow_checks
//@ [debug_assertions_]compile-flags: --cfg debug_assertions
@ -35,6 +36,10 @@
//@ [relocation_model_]compile-flags: --cfg relocation_model="a"
//@ [fmt_debug_]compile-flags: --cfg fmt_debug="shallow"
//@ [emscripten_wasm_eh_]compile-flags: --cfg emscripten_wasm_eh
//@ [reliable_f16_]compile-flags: --cfg target_has_reliable_f16
//@ [reliable_f16_math_]compile-flags: --cfg target_has_reliable_f16_math
//@ [reliable_f128_]compile-flags: --cfg target_has_reliable_f128
//@ [reliable_f128_math_]compile-flags: --cfg target_has_reliable_f128_math
fn main() {}

View file

@ -8,9 +8,14 @@ error[E0605]: non-primitive cast: `u32` as `Option<_>`
--> $DIR/issue-73886.rs:4:13
|
LL | let _ = 7u32 as Option<_>;
| ^^^^^^^^^^^^^^^^^ help: consider using the `From` trait instead: `Option<_>::from(7u32)`
| ^^^^^^^^^^^^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
help: consider using the `From` trait instead
|
LL - let _ = 7u32 as Option<_>;
LL + let _ = Option::<_>::from(7u32);
|
error: aborting due to 2 previous errors

View file

@ -0,0 +1,10 @@
//@ run-rustfix
use std::sync::Arc;
fn main() {
let _ = Option::<_>::from(7u32);
//~^ ERROR non-primitive cast: `u32` as `Option<_>`
let _ = Arc::<str>::from("String");
//~^ ERROR non-primitive cast: `&'static str` as `Arc<str>`
}

View file

@ -0,0 +1,10 @@
//@ run-rustfix
use std::sync::Arc;
fn main() {
let _ = 7u32 as Option<_>;
//~^ ERROR non-primitive cast: `u32` as `Option<_>`
let _ = "String" as Arc<str>;
//~^ ERROR non-primitive cast: `&'static str` as `Arc<str>`
}

View file

@ -0,0 +1,29 @@
error[E0605]: non-primitive cast: `u32` as `Option<_>`
--> $DIR/non-primitive-cast-135412.rs:6:13
|
LL | let _ = 7u32 as Option<_>;
| ^^^^^^^^^^^^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
help: consider using the `From` trait instead
|
LL - let _ = 7u32 as Option<_>;
LL + let _ = Option::<_>::from(7u32);
|
error[E0605]: non-primitive cast: `&'static str` as `Arc<str>`
--> $DIR/non-primitive-cast-135412.rs:8:13
|
LL | let _ = "String" as Arc<str>;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
help: consider using the `From` trait instead
|
LL - let _ = "String" as Arc<str>;
LL + let _ = Arc::<str>::from("String");
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0605`.

View file

@ -1,21 +0,0 @@
#[derive(Debug)]
struct Foo {
i: isize,
}
impl Drop for Foo {
fn drop(&mut self) {}
}
fn foo(i:isize) -> Foo {
Foo {
i: i
}
}
fn main() {
let x = foo(10);
let _y = x.clone();
//~^ ERROR no method named `clone` found
println!("{:?}", x);
}

View file

@ -18,13 +18,16 @@ LL | where
LL | T: AsExpression<Self::SqlType>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::check`
error[E0271]: type mismatch resolving `Integer == Text`
error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied
--> $DIR/as_expression.rs:56:5
|
LL | SelectInt.check("bar");
| ^^^^^^^^^^^^^^^^^^^^^^ types differ
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str`
|
= help: the trait `AsExpression<Integer>` is not implemented for `&str`
but trait `AsExpression<Text>` is implemented for it
= help: for that trait implementation, expected `Text`, found `Integer`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0271, E0277.
For more information about an error, try `rustc --explain E0271`.
For more information about this error, try `rustc --explain E0277`.

View file

@ -55,5 +55,5 @@ impl<T> Foo for T where T: Expression {}
fn main() {
SelectInt.check("bar");
//~^ ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied
//[next]~| ERROR type mismatch
//[next]~| ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied
}

View file

@ -0,0 +1,12 @@
//@ compile-flags: --check-cfg=cfg(target_has_reliable_f16,target_has_reliable_f16_math,target_has_reliable_f128,target_has_reliable_f128_math)
fn main() {
cfg!(target_has_reliable_f16);
//~^ ERROR `cfg(target_has_reliable_f16)` is experimental and subject to change
cfg!(target_has_reliable_f16_math);
//~^ ERROR `cfg(target_has_reliable_f16_math)` is experimental and subject to change
cfg!(target_has_reliable_f128);
//~^ ERROR `cfg(target_has_reliable_f128)` is experimental and subject to change
cfg!(target_has_reliable_f128_math);
//~^ ERROR `cfg(target_has_reliable_f128_math)` is experimental and subject to change
}

View file

@ -0,0 +1,39 @@
error[E0658]: `cfg(target_has_reliable_f16)` is experimental and subject to change
--> $DIR/feature-gate-cfg-target-has-reliable-f16-f128.rs:4:10
|
LL | cfg!(target_has_reliable_f16);
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(cfg_target_has_reliable_f16_f128)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: `cfg(target_has_reliable_f16_math)` is experimental and subject to change
--> $DIR/feature-gate-cfg-target-has-reliable-f16-f128.rs:6:10
|
LL | cfg!(target_has_reliable_f16_math);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(cfg_target_has_reliable_f16_f128)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: `cfg(target_has_reliable_f128)` is experimental and subject to change
--> $DIR/feature-gate-cfg-target-has-reliable-f16-f128.rs:8:10
|
LL | cfg!(target_has_reliable_f128);
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(cfg_target_has_reliable_f16_f128)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: `cfg(target_has_reliable_f128_math)` is experimental and subject to change
--> $DIR/feature-gate-cfg-target-has-reliable-f16-f128.rs:10:10
|
LL | cfg!(target_has_reliable_f128_math);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(cfg_target_has_reliable_f16_f128)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,3 +1,5 @@
#![expect(deprecated)] // concat_idents is deprecated
const XY_1: i32 = 10;
fn main() {

View file

@ -1,5 +1,5 @@
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
--> $DIR/feature-gate-concat_idents.rs:5:13
--> $DIR/feature-gate-concat_idents.rs:7:13
|
LL | let a = concat_idents!(X, Y_1);
| ^^^^^^^^^^^^^
@ -9,7 +9,7 @@ LL | let a = concat_idents!(X, Y_1);
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
--> $DIR/feature-gate-concat_idents.rs:6:13
--> $DIR/feature-gate-concat_idents.rs:8:13
|
LL | let b = concat_idents!(X, Y_2);
| ^^^^^^^^^^^^^

View file

@ -1,3 +1,5 @@
#![expect(deprecated)] // concat_idents is deprecated
fn main() {
concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough
//~| ERROR cannot find value `ab` in this scope

View file

@ -1,5 +1,5 @@
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
--> $DIR/feature-gate-concat_idents2.rs:2:5
--> $DIR/feature-gate-concat_idents2.rs:4:5
|
LL | concat_idents!(a, b);
| ^^^^^^^^^^^^^
@ -9,7 +9,7 @@ LL | concat_idents!(a, b);
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0425]: cannot find value `ab` in this scope
--> $DIR/feature-gate-concat_idents2.rs:2:5
--> $DIR/feature-gate-concat_idents2.rs:4:5
|
LL | concat_idents!(a, b);
| ^^^^^^^^^^^^^^^^^^^^ not found in this scope

View file

@ -1,3 +1,5 @@
#![expect(deprecated)] // concat_idents is deprecated
const XY_1: i32 = 10;
fn main() {

View file

@ -1,5 +1,5 @@
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
--> $DIR/feature-gate-concat_idents3.rs:5:20
--> $DIR/feature-gate-concat_idents3.rs:7:20
|
LL | assert_eq!(10, concat_idents!(X, Y_1));
| ^^^^^^^^^^^^^
@ -9,7 +9,7 @@ LL | assert_eq!(10, concat_idents!(X, Y_1));
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change
--> $DIR/feature-gate-concat_idents3.rs:6:20
--> $DIR/feature-gate-concat_idents3.rs:8:20
|
LL | assert_eq!(20, concat_idents!(X, Y_2));
| ^^^^^^^^^^^^^

View file

@ -0,0 +1,31 @@
//@ run-pass
//@ compile-flags: --check-cfg=cfg(target_has_reliable_f16,target_has_reliable_f16_math,target_has_reliable_f128,target_has_reliable_f128_math)
// Verify that the feature gates and config work and are registered as known config
// options.
#![deny(unexpected_cfgs)]
#![feature(cfg_target_has_reliable_f16_f128)]
#[cfg(target_has_reliable_f16)]
pub fn has_f16() {}
#[cfg(target_has_reliable_f16_math)]
pub fn has_f16_math() {}
#[cfg(target_has_reliable_f128 )]
pub fn has_f128() {}
#[cfg(target_has_reliable_f128_math)]
pub fn has_f128_math() {}
fn main() {
if cfg!(target_arch = "aarch64") && cfg!(target_os = "linux") {
// Aarch64+Linux is one target that has support for all features, so use it to spot
// check that the compiler does indeed enable these gates.
assert!(cfg!(target_has_reliable_f16));
assert!(cfg!(target_has_reliable_f16_math));
assert!(cfg!(target_has_reliable_f128));
assert!(cfg!(target_has_reliable_f128_math));
}
}

View file

@ -0,0 +1,23 @@
trait ServerFn {
type Output;
fn run_body() -> impl Sized;
}
struct MyServerFn {}
macro_rules! f {
() => {
impl ServerFn for MyServerFn {
type Output = ();
fn run_body() -> impl Sized {}
}
};
}
f! {}
fn problem<T: ServerFn<Output = i64>>(_: T) {}
fn main() {
problem(MyServerFn {});
//~^ ERROR type mismatch resolving `<MyServerFn as ServerFn>::Output == i64`
}

View file

@ -0,0 +1,26 @@
error[E0271]: type mismatch resolving `<MyServerFn as ServerFn>::Output == i64`
--> $DIR/dont-probe-missing-item-name-4.rs:21:13
|
LL | problem(MyServerFn {});
| ------- ^^^^^^^^^^^^^ type mismatch resolving `<MyServerFn as ServerFn>::Output == i64`
| |
| required by a bound introduced by this call
|
note: expected this to be `i64`
--> $DIR/dont-probe-missing-item-name-4.rs:10:27
|
LL | type Output = ();
| ^^
...
LL | f! {}
| ----- in this macro invocation
note: required by a bound in `problem`
--> $DIR/dont-probe-missing-item-name-4.rs:18:24
|
LL | fn problem<T: ServerFn<Output = i64>>(_: T) {}
| ^^^^^^^^^^^^ required by this bound in `problem`
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0271`.

View file

@ -1,4 +1,5 @@
#![feature(concat_idents)]
#![expect(deprecated)] // concat_idents is deprecated
#[derive(Debug)]
struct Baz<T>(

View file

@ -1,11 +1,11 @@
error: `derive` cannot be used on items with type macros
--> $DIR/issue-32950.rs:5:5
--> $DIR/issue-32950.rs:6:5
|
LL | concat_idents!(Foo, Bar)
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0412]: cannot find type `FooBar` in this scope
--> $DIR/issue-32950.rs:5:5
--> $DIR/issue-32950.rs:6:5
|
LL | concat_idents!(Foo, Bar)
| ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

View file

@ -1,4 +1,5 @@
#![feature(concat_idents)]
#![expect(deprecated)] // concat_idents is deprecated
fn main() {
let x = concat_idents!(); //~ ERROR `concat_idents!()` takes 1 or more arguments

View file

@ -1,5 +1,5 @@
error: `concat_idents!()` takes 1 or more arguments
--> $DIR/issue-50403.rs:4:13
--> $DIR/issue-50403.rs:5:13
|
LL | let x = concat_idents!();
| ^^^^^^^^^^^^^^^^

View file

@ -5,6 +5,7 @@
#![feature(trace_macros, concat_idents)]
#![feature(stmt_expr_attributes)]
#![expect(deprecated)] // concat_idents is deprecated
use std::arch::asm;

View file

@ -1,5 +1,5 @@
error: the `#[default]` attribute may only be used on unit enum variants
--> $DIR/macros-nonfatal-errors.rs:13:5
--> $DIR/macros-nonfatal-errors.rs:14:5
|
LL | #[default]
| ^^^^^^^^^^
@ -7,7 +7,7 @@ LL | #[default]
= help: consider a manual implementation of `Default`
error: the `#[default]` attribute may only be used on unit enum variants
--> $DIR/macros-nonfatal-errors.rs:18:36
--> $DIR/macros-nonfatal-errors.rs:19:36
|
LL | struct DefaultInnerAttrTupleStruct(#[default] ());
| ^^^^^^^^^^
@ -15,7 +15,7 @@ LL | struct DefaultInnerAttrTupleStruct(#[default] ());
= help: consider a manual implementation of `Default`
error: the `#[default]` attribute may only be used on unit enum variants
--> $DIR/macros-nonfatal-errors.rs:22:1
--> $DIR/macros-nonfatal-errors.rs:23:1
|
LL | #[default]
| ^^^^^^^^^^
@ -23,7 +23,7 @@ LL | #[default]
= help: consider a manual implementation of `Default`
error: the `#[default]` attribute may only be used on unit enum variants
--> $DIR/macros-nonfatal-errors.rs:26:1
--> $DIR/macros-nonfatal-errors.rs:27:1
|
LL | #[default]
| ^^^^^^^^^^
@ -31,7 +31,7 @@ LL | #[default]
= help: consider a manual implementation of `Default`
error: the `#[default]` attribute may only be used on unit enum variants
--> $DIR/macros-nonfatal-errors.rs:36:11
--> $DIR/macros-nonfatal-errors.rs:37:11
|
LL | Foo = #[default] 0,
| ^^^^^^^^^^
@ -39,7 +39,7 @@ LL | Foo = #[default] 0,
= help: consider a manual implementation of `Default`
error: the `#[default]` attribute may only be used on unit enum variants
--> $DIR/macros-nonfatal-errors.rs:37:14
--> $DIR/macros-nonfatal-errors.rs:38:14
|
LL | Bar([u8; #[default] 1]),
| ^^^^^^^^^^
@ -47,7 +47,7 @@ LL | Bar([u8; #[default] 1]),
= help: consider a manual implementation of `Default`
error[E0665]: `#[derive(Default)]` on enum with no `#[default]`
--> $DIR/macros-nonfatal-errors.rs:42:10
--> $DIR/macros-nonfatal-errors.rs:43:10
|
LL | #[derive(Default)]
| ^^^^^^^
@ -67,7 +67,7 @@ LL | #[default] Bar,
| ++++++++++
error[E0665]: `#[derive(Default)]` on enum with no `#[default]`
--> $DIR/macros-nonfatal-errors.rs:48:10
--> $DIR/macros-nonfatal-errors.rs:49:10
|
LL | #[derive(Default)]
| ^^^^^^^
@ -78,7 +78,7 @@ LL | | }
| |_- this enum needs a unit variant marked with `#[default]`
error: multiple declared defaults
--> $DIR/macros-nonfatal-errors.rs:54:10
--> $DIR/macros-nonfatal-errors.rs:55:10
|
LL | #[derive(Default)]
| ^^^^^^^
@ -95,7 +95,7 @@ LL | Baz,
= note: only one variant can be default
error: `#[default]` attribute does not accept a value
--> $DIR/macros-nonfatal-errors.rs:66:5
--> $DIR/macros-nonfatal-errors.rs:67:5
|
LL | #[default = 1]
| ^^^^^^^^^^^^^^
@ -103,7 +103,7 @@ LL | #[default = 1]
= help: try using `#[default]`
error: multiple `#[default]` attributes
--> $DIR/macros-nonfatal-errors.rs:74:5
--> $DIR/macros-nonfatal-errors.rs:75:5
|
LL | #[default]
| ---------- `#[default]` used here
@ -114,13 +114,13 @@ LL | Foo,
|
= note: only one `#[default]` attribute is needed
help: try removing this
--> $DIR/macros-nonfatal-errors.rs:73:5
--> $DIR/macros-nonfatal-errors.rs:74:5
|
LL | #[default]
| ^^^^^^^^^^
error: multiple `#[default]` attributes
--> $DIR/macros-nonfatal-errors.rs:84:5
--> $DIR/macros-nonfatal-errors.rs:85:5
|
LL | #[default]
| ---------- `#[default]` used here
@ -132,7 +132,7 @@ LL | Foo,
|
= note: only one `#[default]` attribute is needed
help: try removing these
--> $DIR/macros-nonfatal-errors.rs:81:5
--> $DIR/macros-nonfatal-errors.rs:82:5
|
LL | #[default]
| ^^^^^^^^^^
@ -142,7 +142,7 @@ LL | #[default]
| ^^^^^^^^^^
error: the `#[default]` attribute may only be used on unit enum variants
--> $DIR/macros-nonfatal-errors.rs:91:5
--> $DIR/macros-nonfatal-errors.rs:92:5
|
LL | Foo {},
| ^^^
@ -150,7 +150,7 @@ LL | Foo {},
= help: consider a manual implementation of `Default`
error: default variant must be exhaustive
--> $DIR/macros-nonfatal-errors.rs:99:5
--> $DIR/macros-nonfatal-errors.rs:100:5
|
LL | #[non_exhaustive]
| ----------------- declared `#[non_exhaustive]` here
@ -160,37 +160,37 @@ LL | Foo,
= help: consider a manual implementation of `Default`
error: asm template must be a string literal
--> $DIR/macros-nonfatal-errors.rs:104:10
--> $DIR/macros-nonfatal-errors.rs:105:10
|
LL | asm!(invalid);
| ^^^^^^^
error: `concat_idents!()` requires ident args
--> $DIR/macros-nonfatal-errors.rs:107:5
--> $DIR/macros-nonfatal-errors.rs:108:5
|
LL | concat_idents!("not", "idents");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: argument must be a string literal
--> $DIR/macros-nonfatal-errors.rs:109:17
--> $DIR/macros-nonfatal-errors.rs:110:17
|
LL | option_env!(invalid);
| ^^^^^^^
error: expected string literal
--> $DIR/macros-nonfatal-errors.rs:110:10
--> $DIR/macros-nonfatal-errors.rs:111:10
|
LL | env!(invalid);
| ^^^^^^^
error: `env!()` takes 1 or 2 arguments
--> $DIR/macros-nonfatal-errors.rs:111:5
--> $DIR/macros-nonfatal-errors.rs:112:5
|
LL | env!(foo, abr, baz);
| ^^^^^^^^^^^^^^^^^^^
error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined at compile time
--> $DIR/macros-nonfatal-errors.rs:112:5
--> $DIR/macros-nonfatal-errors.rs:113:5
|
LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -198,7 +198,7 @@ LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST");
= help: use `std::env::var("RUST_HOPEFULLY_THIS_DOESNT_EXIST")` to read the variable at run time
error: format argument must be a string literal
--> $DIR/macros-nonfatal-errors.rs:114:13
--> $DIR/macros-nonfatal-errors.rs:115:13
|
LL | format!(invalid);
| ^^^^^^^
@ -209,43 +209,43 @@ LL | format!("{}", invalid);
| +++++
error: argument must be a string literal
--> $DIR/macros-nonfatal-errors.rs:116:14
--> $DIR/macros-nonfatal-errors.rs:117:14
|
LL | include!(invalid);
| ^^^^^^^
error: argument must be a string literal
--> $DIR/macros-nonfatal-errors.rs:118:18
--> $DIR/macros-nonfatal-errors.rs:119:18
|
LL | include_str!(invalid);
| ^^^^^^^
error: couldn't read `$DIR/i'd be quite surprised if a file with this name existed`: $FILE_NOT_FOUND_MSG
--> $DIR/macros-nonfatal-errors.rs:119:5
--> $DIR/macros-nonfatal-errors.rs:120:5
|
LL | include_str!("i'd be quite surprised if a file with this name existed");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: argument must be a string literal
--> $DIR/macros-nonfatal-errors.rs:120:20
--> $DIR/macros-nonfatal-errors.rs:121:20
|
LL | include_bytes!(invalid);
| ^^^^^^^
error: couldn't read `$DIR/i'd be quite surprised if a file with this name existed`: $FILE_NOT_FOUND_MSG
--> $DIR/macros-nonfatal-errors.rs:121:5
--> $DIR/macros-nonfatal-errors.rs:122:5
|
LL | include_bytes!("i'd be quite surprised if a file with this name existed");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: trace_macros! accepts only `true` or `false`
--> $DIR/macros-nonfatal-errors.rs:123:5
--> $DIR/macros-nonfatal-errors.rs:124:5
|
LL | trace_macros!(invalid);
| ^^^^^^^^^^^^^^^^^^^^^^
error: default variant must be exhaustive
--> $DIR/macros-nonfatal-errors.rs:133:9
--> $DIR/macros-nonfatal-errors.rs:134:9
|
LL | #[non_exhaustive]
| ----------------- declared `#[non_exhaustive]` here
@ -255,7 +255,7 @@ LL | Foo,
= help: consider a manual implementation of `Default`
error: cannot find macro `llvm_asm` in this scope
--> $DIR/macros-nonfatal-errors.rs:105:5
--> $DIR/macros-nonfatal-errors.rs:106:5
|
LL | llvm_asm!(invalid);
| ^^^^^^^^

View file

@ -1,5 +1,5 @@
error: no rules expected `@`
--> $DIR/fail-simple.rs:2:12
--> $DIR/no-matching-rule.rs:2:12
|
LL | panic!(@);
| ^ no rules expected this token in macro call

View file

@ -0,0 +1,19 @@
// This test checks that calling `.clone()` on a type that does not implement the `Clone` trait
// results in a compilation error. The `Foo` struct does not derive or implement `Clone`,
// so attempting to clone it should fail.
struct Foo {
i: isize,
}
fn foo(i:isize) -> Foo {
Foo {
i: i
}
}
fn main() {
let x = foo(10);
let _y = x.clone();
//~^ ERROR no method named `clone` found
}

View file

@ -1,5 +1,5 @@
error[E0599]: no method named `clone` found for struct `Foo` in the current scope
--> $DIR/copy-a-resource.rs:18:16
--> $DIR/clone-missing.rs:17:16
|
LL | struct Foo {
| ---------- method `clone` not found for this struct

View file

@ -0,0 +1,11 @@
//@ run-pass
// This is a name resolution smoke test that ensures paths with more than one
// segment (e.g., `foo::bar`) resolve correctly.
// It also serves as a basic visibility test — confirming that a `pub` item
// inside a private module can still be accessed from outside that module.
mod foo {
pub fn bar(_offset: usize) {}
}
fn main() { foo::bar(0); }

View file

@ -1,7 +0,0 @@
//@ run-pass
mod foo {
pub fn bar(_offset: usize) { }
}
pub fn main() { foo::bar(0); }

View file

@ -1,5 +1,5 @@
error[E0434]: can't capture dynamic environment in a fn item
--> $DIR/capture1.rs:3:32
--> $DIR/fn-item-cant-capture-dynamic-env.rs:3:32
|
LL | fn foo() -> isize { return bar; }
| ^^^

View file

@ -1,6 +1,6 @@
//@ run-pass
#![feature(repr_simd, core_intrinsics, concat_idents)]
#![feature(repr_simd, core_intrinsics, macro_metavar_expr_concat)]
#![allow(non_camel_case_types)]
use std::intrinsics::simd::{simd_eq, simd_ge, simd_gt, simd_le, simd_lt, simd_ne};
@ -19,7 +19,7 @@ macro_rules! cmp {
($method: ident($lhs: expr, $rhs: expr)) => {{
let lhs = $lhs;
let rhs = $rhs;
let e: u32x4 = concat_idents!(simd_, $method)($lhs, $rhs);
let e: u32x4 = ${concat(simd_, $method)}($lhs, $rhs);
// assume the scalar version is correct/the behaviour we want.
assert!((e.0[0] != 0) == lhs.0[0].$method(&rhs.0[0]));
assert!((e.0[1] != 0) == lhs.0[1].$method(&rhs.0[1]));

View file

@ -1,6 +1,7 @@
//@ run-pass
#![feature(concat_idents)]
#![expect(deprecated)] // concat_idents is deprecated
pub fn main() {
struct Foo;

View file

@ -0,0 +1,44 @@
//@ check-pass
//@ compile-flags: -Znext-solver
// A regression test for trait-system-refactor-initiative#184.
//
// When adding nested goals we replace aliases with infer vars
// and add `AliasRelate` goals to constrain them. When doing this
// for `NormalizesTo` goals, we then first tries to prove the
// `NormalizesTo` goal and then normalized the nested aliases.
trait Trait<T> {
type Assoc;
}
impl<T, U> Trait<U> for T {
type Assoc = ();
}
trait Id {
type This;
}
impl<T> Id for T {
type This = T;
}
trait Relate<T> {
type Alias;
}
impl<T, U> Relate<U> for T {
type Alias = <T as Trait<<U as Id>::This>>::Assoc;
}
fn guide_me<T: Trait<u32>>() {
// Normalizing `<T as Relate<i32>>::Alias` relates the associated type with an unconstrained
// term. This resulted in a `NormalizesTo(<T as Trait<<U as Id>::This>>::Assoc, ?x)` goal.
// We replace `<i32 as Id>::This` with an infer var `?y`, resulting in the following goals:
// - `NormalizesTo(<T as Trait<?y>::Assoc, ?x)`
// - `AliasRelate(<i32 as Id>::This, ?y)`
//
// When proving the `NormalizesTo` goal first, we incompletely constrain `?y` to `u32`,
// causing an unexpected type mismatch.
let _: <T as Relate<i32>>::Alias;
}
fn main() {}

View file

@ -1,4 +1,5 @@
//@ check-pass
//@ compile-flags: -Znext-solver
// When canonicalizing a response in the trait solver, we bail with overflow
// if there are too many non-region inference variables. Doing so in normalizes-to

View file

@ -0,0 +1,10 @@
//@ compile-flags: --remap-path-prefix=/=/non-existent
// helper for ../unnecessary-transmute-path-remap-ice-140277.rs
#[macro_export]
macro_rules! transmute {
($e:expr) => {{
let e = $e;
std::mem::transmute(e)
}};
}

View file

@ -0,0 +1,10 @@
//@ aux-crate: zerocopy=unnecessary-transmute-path-remap-ice-140277-trans.rs
//@ check-pass
// tests for a regression in linting for unnecessary transmutes
// where a span was inacessible for snippet procuring,
// when remap-path-prefix was set, causing a panic.
fn bytes_at_home(x: [u8; 4]) -> u32 {
unsafe { zerocopy::transmute!(x) }
}
fn main() {}

View file

@ -22,7 +22,7 @@ impl<In, Out> Trait<Bar, In> for Out {
type Out = Out;
#[define_opaque(Bar)]
fn convert(_i: In) -> Self::Out {
//[next]~^ ERROR: cannot satisfy `Bar == _`
//[next]~^ ERROR: type annotations needed: cannot satisfy `Bar == _`
//[current]~^^ ERROR: item does not constrain `Bar::{opaque#0}`
unreachable!();
}

View file

@ -0,0 +1,11 @@
//@ run-pass
// This is a smoke test to ensure that type aliases with type parameters
// are accepted by the compiler and that the parameters are correctly
// resolved in the aliased item type.
#![allow(dead_code)]
type Foo<T> = extern "C" fn(T) -> bool;
type Bar<T> = fn(T) -> bool;
fn main() {}

View file

@ -1,10 +0,0 @@
//@ run-pass
#![allow(non_camel_case_types)]
#![allow(dead_code)]
type lteq<T> = extern "C" fn(T) -> bool;
pub fn main() { }

View file

@ -839,6 +839,7 @@ mod types {
}
/// TyKind::MacCall
#[expect(deprecated)] // concat_idents is deprecated
fn ty_mac_call() {
let _: concat_idents!(T);
let _: concat_idents![T];

View file

@ -359,6 +359,7 @@ mod expressions {
// concat_idents is deprecated
@ -674,6 +675,7 @@ mod types {
/*! there is no syntax for this */
}
/// TyKind::MacCall
#[expect(deprecated)]
fn ty_mac_call() { let _: T; let _: T; let _: T; }
/// TyKind::CVarArgs
fn ty_c_var_args() {