Rollup merge of #156082 - danieljofficial:move-tests-associated-types, r=petrochenkov

Move tests associated types

Hi, I have moved some ui tests I feel belong in the associated types folder
This commit is contained in:
Guillaume Gomez
2026-05-05 02:50:09 +02:00
committed by GitHub
30 changed files with 52 additions and 8 deletions
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/23073
#![feature(associated_type_defaults)]
trait Foo { type T; }
@@ -1,5 +1,5 @@
error[E0223]: ambiguous associated type
--> $DIR/issue-23073.rs:6:17
--> $DIR/ambiguous-associated-type-default.rs:8:17
|
LL | type FooT = <<Self as Bar>::Foo>::T;
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/20803
//@ run-pass
use std::ops::Add;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/37051
//@ check-pass
#![feature(associated_type_defaults)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/39970
trait Array<'a> {
type Element: 'a;
}
@@ -1,16 +1,16 @@
error[E0271]: type mismatch resolving `<() as Array<'a>>::Element == ()`
--> $DIR/issue-39970.rs:19:6
--> $DIR/assoc-type-element-mismatch-in-hrtb.rs:21:6
|
LL | <() as Visit>::visit();
| ^^ type mismatch resolving `<() as Array<'a>>::Element == ()`
|
note: expected this to be `()`
--> $DIR/issue-39970.rs:10:20
--> $DIR/assoc-type-element-mismatch-in-hrtb.rs:12:20
|
LL | type Element = &'a ();
| ^^^^^^
note: required for `()` to implement `Visit`
--> $DIR/issue-39970.rs:13:6
--> $DIR/assoc-type-element-mismatch-in-hrtb.rs:15:6
|
LL | impl Visit for () where
| ^^^^^ ^^
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/28983
//@ run-pass
pub trait Test { type T; }
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/19632
//@ check-pass
#![allow(dead_code)]
@@ -1,6 +1,6 @@
//@ build-pass
// Regression test for #20797.
// Regression test for https://github.com/rust-lang/rust/issues/20797
use std::default::Default;
use std::io;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/26127
//@ run-pass
trait Tr { type T; }
impl Tr for u8 { type T=(); }
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/19631
//@ check-pass
#![allow(dead_code)]
@@ -1,5 +1,6 @@
//@ run-pass
// Issue 36036: computing the layout of a type composed from another
// Regression test for https://github.com/rust-lang/rust/issues/36036
// computing the layout of a type composed from another
// trait's associated type caused compiler to ICE when the associated
// type was allowed to be unsized, even though the known instantiated
// type is itself sized.
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/23336
//@ run-pass
pub trait Data { fn doit(&self) {} }
impl<T> Data for T {}
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/17732
//@ check-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/20009
//@ check-pass
// Check that associated types are `Sized`
@@ -1,4 +1,4 @@
// Regression test for Issue #20971.
// Regression test for Issue https://github.com/rust-lang/rust/issues/20971
//@ run-fail
//@ error-pattern:Hello, world!
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/19850
//@ check-pass
#![allow(unused_variables)]
// Test that `<Type as Trait>::Output` and `Self::Output` are accepted as type annotations in let
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/23406
//@ build-pass
#![allow(dead_code)]
trait Inner {
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/37109
//@ run-pass
trait ToRef<'a> {
type Ref: 'a;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/23992
//@ run-pass
pub struct Outer<T: Trait>(T);
pub struct Inner<'a> { value: &'a bool }
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/21909
//@ check-pass
trait A<X> {
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/34839
//@ check-pass
trait RegularExpression: Sized {
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/35600
//@ run-pass
#![allow(non_camel_case_types)]
#![allow(unused_variables)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/27281
//@ check-pass
pub trait Trait<'a> {
type T;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/18809
//@ check-pass
trait Tup {
type T0;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/43357
//@ check-pass
#![allow(dead_code)]
trait Trait {
@@ -1,3 +1,4 @@
// Regression test for https://github.com/rust-lang/rust/issues/19842
// Test that a partially specified trait object with unspecified associated
// type does not type-check.
@@ -1,5 +1,5 @@
error[E0191]: the value of the associated type `A` in `Foo` must be specified
--> $DIR/issue-19482.rs:10:16
--> $DIR/unspecified-assoc-type-in-trait-object.rs:11:16
|
LL | type A;
| ------ `A` defined here