Add test batch 5

This commit is contained in:
Oneirical 2025-08-20 14:03:03 -04:00
parent a171994070
commit 926599a45c
55 changed files with 157 additions and 34 deletions

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/mismatched-types-in-trait-implementation-87490.rs:10:5
--> $DIR/mismatched-types-in-associated-type-87490.rs:10:5
|
LL | fn follow(_: &str) -> <&str as StreamOnce>::Position {
| ------------------------------ expected `usize` because of return type

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/72076
trait X {
type S;
fn f() -> Self::S {} //~ ERROR mismatched types

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-72076.rs:3:23
--> $DIR/missing-default-associated-type-72076.rs:4:23
|
LL | fn f() -> Self::S {}
| ^^ expected associated type, found `()`

View file

@ -1,5 +1,5 @@
error[E0070]: invalid left-hand side of assignment
--> $DIR/invalid-assignment-in-while-loop-77218.rs:5:19
--> $DIR/invalid-assignment-in-while-77218.rs:5:19
|
LL | while Some(0) = value.get(0) {}
| - ^

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/70724
fn a() -> i32 {
3
}

View file

@ -1,5 +1,5 @@
error[E0369]: binary operation `==` cannot be applied to type `fn() -> i32 {a}`
--> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5
--> $DIR/binary-operation-error-on-function-70724.rs:7:5
|
LL | assert_eq!(a, 0);
| ^^^^^^^^^^^^^^^^
@ -10,7 +10,7 @@ LL | assert_eq!(a, 0);
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5
--> $DIR/binary-operation-error-on-function-70724.rs:7:5
|
LL | assert_eq!(a, 0);
| ^^^^^^^^^^^^^^^^ expected fn item, found integer
@ -20,7 +20,7 @@ LL | assert_eq!(a, 0);
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `fn() -> i32 {a}` doesn't implement `Debug`
--> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5
--> $DIR/binary-operation-error-on-function-70724.rs:7:5
|
LL | fn a() -> i32 {
| - consider calling this function

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/72002
//@ check-pass
struct Indexable;

View file

@ -0,0 +1,9 @@
// https://github.com/rust-lang/rust/issues/54410
extern "C" {
pub static mut symbol: [i8];
//~^ ERROR the size for values of type `[i8]` cannot be known at compilation time
}
fn main() {
println!("{:p}", unsafe { &symbol });
}

View file

@ -0,0 +1,12 @@
error[E0277]: the size for values of type `[i8]` cannot be known at compilation time
--> $DIR/extern-static-mut-slice-54410.rs:3:5
|
LL | pub static mut symbol: [i8];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[i8]`
= note: statics and constants must have a statically known size
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/70381
// Test that multi-byte unicode characters with missing parameters do not ICE.
fn main() {

View file

@ -1,5 +1,5 @@
error: 1 positional argument in format string, but no arguments were given
--> $DIR/issue-70381.rs:4:16
--> $DIR/unicode-format-string-missing-parameter-70381.rs:5:16
|
LL | println!("\r¡{}")
| ^^

View file

@ -0,0 +1,20 @@
// https://github.com/rust-lang/rust/issues/60218
// Regression test for #60218
//
// This was reported to cause ICEs.
use std::iter::Map;
pub trait Foo {}
pub fn trigger_error<I, F>(iterable: I, functor: F)
where
for<'t> &'t I: IntoIterator,
for<'t> Map<<&'t I as IntoIterator>::IntoIter, F>: Iterator,
for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo,
{
}
fn main() {
trigger_error(vec![], |x: &u32| x) //~ ERROR E0277
}

View file

@ -0,0 +1,25 @@
error[E0277]: the trait bound `&u32: Foo` is not satisfied
--> $DIR/higher-trait-bounds-ice-60218.rs:19:19
|
LL | trigger_error(vec![], |x: &u32| x)
| ------------- ^^^^^^ the trait `Foo` is not implemented for `&u32`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/higher-trait-bounds-ice-60218.rs:8:1
|
LL | pub trait Foo {}
| ^^^^^^^^^^^^^
note: required by a bound in `trigger_error`
--> $DIR/higher-trait-bounds-ice-60218.rs:14:72
|
LL | pub fn trigger_error<I, F>(iterable: I, functor: F)
| ------------- required by a bound in this function
...
LL | for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo,
| ^^^ required by this bound in `trigger_error`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.

View file

@ -1,3 +1,5 @@
// https://github.com/rust-lang/rust/issues/72278
// and https://github.com/rust-lang/rust/issues/42868
//@ run-pass
#![allow(unused)]

View file

@ -1,5 +1,5 @@
warning: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
--> $DIR/issue-72278.rs:14:14
--> $DIR/late-bound-lifetime-arguments-warning-72278.rs:16:14
|
LL | fn func<'a, U>(&'a self) -> U {
| -- the late bound lifetime parameter is introduced here

View file

@ -0,0 +1,3 @@
pub struct S;
mod m { pub struct S; }
pub use crate::m::S as S2;

View file

@ -0,0 +1,28 @@
// https://github.com/rust-lang/rust/issues/67039
// Pin's PartialEq implementation allowed to access the pointer allowing for
// unsoundness by using Rc::get_mut to move value within Rc.
// See https://internals.rust-lang.org/t/unsoundness-in-pin/11311/73 for more details.
use std::ops::Deref;
use std::pin::Pin;
use std::rc::Rc;
struct Apple;
impl Deref for Apple {
type Target = Apple;
fn deref(&self) -> &Apple {
&Apple
}
}
impl PartialEq<Rc<Apple>> for Apple {
fn eq(&self, _rc: &Rc<Apple>) -> bool {
unreachable!()
}
}
fn main() {
let _ = Pin::new(Apple) == Rc::pin(Apple);
//~^ ERROR type mismatch resolving
}

View file

@ -0,0 +1,13 @@
error[E0271]: type mismatch resolving `<Rc<Apple> as Deref>::Target == Rc<Apple>`
--> $DIR/pin-deref-target-partial-eq-67039.rs:26:29
|
LL | let _ = Pin::new(Apple) == Rc::pin(Apple);
| ^^ expected `Rc<Apple>`, found `Apple`
|
= note: expected struct `Rc<Apple>`
found struct `Apple`
= note: required for `Pin<Apple>` to implement `PartialEq<Pin<Rc<Apple>>>`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0271`.

View file

@ -1,5 +1,5 @@
error: pattern requires `..` due to inaccessible fields
--> $DIR/inaccessible-fields-pattern-matching-76077.rs:14:9
--> $DIR/inaccessible-private-fields-76077.rs:14:9
|
LL | let foo::Foo {} = foo::Foo::default();
| ^^^^^^^^^^^
@ -10,7 +10,7 @@ LL | let foo::Foo { .. } = foo::Foo::default();
| ++
error: pattern requires `..` due to inaccessible fields
--> $DIR/inaccessible-fields-pattern-matching-76077.rs:17:9
--> $DIR/inaccessible-private-fields-76077.rs:17:9
|
LL | let foo::Bar { visible } = foo::Bar::default();
| ^^^^^^^^^^^^^^^^^^^^

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/74082
#![allow(dead_code)]
#[repr(i128)] //~ ERROR: attribute should be applied to an enum

View file

@ -1,5 +1,5 @@
error[E0517]: attribute should be applied to an enum
--> $DIR/issue-74082.rs:3:8
--> $DIR/invalid-repr-on-structs-74082.rs:4:8
|
LL | #[repr(i128)]
| ^^^^
@ -7,7 +7,7 @@ LL | struct Foo;
| ----------- not an enum
error[E0517]: attribute should be applied to an enum
--> $DIR/issue-74082.rs:6:8
--> $DIR/invalid-repr-on-structs-74082.rs:7:8
|
LL | #[repr(u128)]
| ^^^^

View file

@ -1,9 +1,10 @@
//@ aux-build:issue-73112.rs
// https://github.com/rust-lang/rust/issues/73112
//@ aux-build:aux-73112.rs
extern crate issue_73112;
extern crate aux_73112;
fn main() {
use issue_73112::PageTable;
use aux_73112::PageTable;
#[repr(C, packed)]
struct SomeStruct {

View file

@ -1,11 +1,11 @@
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> $DIR/issue-73112.rs:9:5
--> $DIR/packed-struct-contains-aligned-type-73112.rs:10:5
|
LL | struct SomeStruct {
| ^^^^^^^^^^^^^^^^^
|
note: `PageTable` has a `#[repr(align)]` attribute
--> $DIR/auxiliary/issue-73112.rs:8:1
--> $DIR/auxiliary/aux-73112.rs:8:1
|
LL | pub struct PageTable {
| ^^^^^^^^^^^^^^^^^^^^

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/71406
use std::sync::mpsc;
fn main() {

View file

@ -1,5 +1,5 @@
error[E0433]: failed to resolve: expected type, found function `channel` in `mpsc`
--> $DIR/issue-71406.rs:4:26
--> $DIR/function-module-ambiguity-error-71406.rs:5:26
|
LL | let (tx, rx) = mpsc::channel::new(1);
| ^^^^^^^ expected type, found function `channel` in `mpsc`

View file

@ -1,23 +1,23 @@
error: bound modifier `?` can only be applied to `Sized`
--> $DIR/relaxed-bounds-assumed-unsized-87199.rs:9:11
--> $DIR/invalid-bound-modifier-87199.rs:9:11
|
LL | fn arg<T: ?Send>(_: T) {}
| ^^^^^
error: bound modifier `?` can only be applied to `Sized`
--> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:15
--> $DIR/invalid-bound-modifier-87199.rs:11:15
|
LL | fn ref_arg<T: ?Send>(_: &T) {}
| ^^^^^
error: bound modifier `?` can only be applied to `Sized`
--> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40
--> $DIR/invalid-bound-modifier-87199.rs:13:40
|
LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() }
| ^^^^^
error: bound modifier `?` can only be applied to `Sized`
--> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40
--> $DIR/invalid-bound-modifier-87199.rs:13:40
|
LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() }
| ^^^^^
@ -25,14 +25,14 @@ LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() }
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/relaxed-bounds-assumed-unsized-87199.rs:20:15
--> $DIR/invalid-bound-modifier-87199.rs:20:15
|
LL | ref_arg::<[i32]>(&[5]);
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[i32]`
note: required by an implicit `Sized` bound in `ref_arg`
--> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:12
--> $DIR/invalid-bound-modifier-87199.rs:11:12
|
LL | fn ref_arg<T: ?Send>(_: &T) {}
| ^ required by the implicit `Sized` requirement on this type parameter in `ref_arg`

View file

@ -1,5 +1,5 @@
error[E0284]: type annotations needed
--> $DIR/issue-69455.rs:29:41
--> $DIR/projection-predicate-not-satisfied-69455.rs:29:41
|
LL | println!("{}", 23u64.test(xs.iter().sum()));
| ---- ^^^ cannot infer type of the type parameter `S` declared on the method `sum`
@ -13,7 +13,7 @@ LL | println!("{}", 23u64.test(xs.iter().sum::<S>()));
| +++++
error[E0283]: type annotations needed
--> $DIR/issue-69455.rs:29:41
--> $DIR/projection-predicate-not-satisfied-69455.rs:29:41
|
LL | println!("{}", 23u64.test(xs.iter().sum()));
| ---- ^^^ cannot infer type of the type parameter `S` declared on the method `sum`
@ -21,7 +21,7 @@ LL | println!("{}", 23u64.test(xs.iter().sum()));
| required by a bound introduced by this call
|
note: multiple `impl`s satisfying `u64: Test<_>` found
--> $DIR/issue-69455.rs:11:1
--> $DIR/projection-predicate-not-satisfied-69455.rs:11:1
|
LL | impl Test<u32> for u64 {
| ^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/73229
//@ check-pass
fn any<T>() -> T {

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/69602
trait TraitA {
const VALUE: usize;
}

View file

@ -1,11 +1,11 @@
error[E0437]: type `M` is not a member of trait `TraitB`
--> $DIR/issue-69602-type-err-during-codegen-ice.rs:17:5
--> $DIR/trait-implementation-ambiguity-69602.rs:18:5
|
LL | type M = A;
| ^^^^^^^^^^^^^ not a member of trait `TraitB`
error[E0046]: not all trait items implemented, missing: `MyA`
--> $DIR/issue-69602-type-err-during-codegen-ice.rs:16:1
--> $DIR/trait-implementation-ambiguity-69602.rs:17:1
|
LL | type MyA: TraitA;
| ---------------- `MyA` from trait

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/69683
pub trait Element<S> {
type Array;
}

View file

@ -1,5 +1,5 @@
error[E0284]: type annotations needed
--> $DIR/issue-69683.rs:30:10
--> $DIR/type-inference-for-associated-types-69683.rs:31:10
|
LL | 0u16.foo(b);
| ^^^
@ -12,13 +12,13 @@ LL + <u16 as Foo<I>>::foo(0u16, b);
|
error[E0283]: type annotations needed
--> $DIR/issue-69683.rs:30:10
--> $DIR/type-inference-for-associated-types-69683.rs:31:10
|
LL | 0u16.foo(b);
| ^^^
|
note: multiple `impl`s satisfying `u8: Element<_>` found
--> $DIR/issue-69683.rs:5:1
--> $DIR/type-inference-for-associated-types-69683.rs:6:1
|
LL | impl<T> Element<()> for T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -26,7 +26,7 @@ LL | impl<T> Element<()> for T {
LL | impl<T: Element<S>, S> Element<[S; 3]> for T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `Foo::foo`
--> $DIR/issue-69683.rs:15:9
--> $DIR/type-inference-for-associated-types-69683.rs:16:9
|
LL | u8: Element<I>,
| ^^^^^^^^^^ required by this bound in `Foo::foo`

View file

@ -1,3 +1,4 @@
// https://github.com/rust-lang/rust/issues/70746
//@ check-pass
pub trait Trait1 {

View file

@ -1,5 +1,5 @@
error[E0268]: `break` outside of a loop or labeled block
--> $DIR/break-outside-loop-error-83048.rs:5:5
--> $DIR/thir-tree-break-outside-loop-83048.rs:5:5
|
LL | break;
| ^^^^^ cannot `break` outside of a loop or labeled block