Implement #[define_opaque] attribute for functions.

This commit is contained in:
Oli Scherer 2024-07-26 10:04:02 +00:00 committed by Oli Scherer
parent 2c6a12ec44
commit cb4751d4b8
653 changed files with 2911 additions and 2580 deletions

View file

@ -364,6 +364,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
generics: lg,
contract: lc,
body: lb,
define_opaque: _,
}),
Fn(box ast::Fn {
defaultness: rd,
@ -371,6 +372,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
generics: rg,
contract: rc,
body: rb,
define_opaque: _,
}),
) => {
eq_defaultness(*ld, *rd)
@ -502,6 +504,7 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
generics: lg,
contract: lc,
body: lb,
define_opaque: _,
}),
Fn(box ast::Fn {
defaultness: rd,
@ -509,6 +512,7 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
generics: rg,
contract: rc,
body: rb,
define_opaque: _,
}),
) => {
eq_defaultness(*ld, *rd)
@ -567,6 +571,7 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
generics: lg,
contract: lc,
body: lb,
define_opaque: _,
}),
Fn(box ast::Fn {
defaultness: rd,
@ -574,6 +579,7 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
generics: rg,
contract: rc,
body: rb,
define_opaque: _,
}),
) => {
eq_defaultness(*ld, *rd)

View file

@ -1,10 +0,0 @@
//@ check-pass
// ICE: #10972
// asked to assemble constituent types of unexpected type: Binder(Foo, [])
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
type Foo = impl Debug;
const FOO2: Foo = 22_u32;
pub fn main() {}

View file

@ -192,6 +192,7 @@ impl Atpit for () {
type Tait = impl DerefMut;
//~^ implied_bounds_in_impls
#[define_opaque(Tait)]
fn define() -> Tait {
&mut [] as &mut [()]
}

View file

@ -192,6 +192,7 @@ impl Atpit for () {
type Tait = impl Deref + DerefMut;
//~^ implied_bounds_in_impls
#[define_opaque(Tait)]
fn define() -> Tait {
&mut [] as &mut [()]
}

View file

@ -207,6 +207,7 @@ mod msrv {
mod with_ty_alias {
type Foo = impl std::fmt::Debug;
#[define_opaque(Foo)]
fn foo(_: Foo) {
let _: Foo = 1;
}

View file

@ -17,6 +17,7 @@ mod issue10041 {
struct Bomb2;
impl Bomb2 {
#[define_opaque(X)]
pub fn new() -> X {
//~^ ERROR: overflow evaluating the requirement
0i32

View file

@ -1,5 +1,5 @@
error[E0275]: overflow evaluating the requirement `<i32 as std::ops::Add>::Output == issue10041::X`
--> tests/ui/new_ret_no_self_overflow.rs:20:25
--> tests/ui/new_ret_no_self_overflow.rs:21:25
|
LL | pub fn new() -> X {
| ^

View file

@ -4058,7 +4058,6 @@ ui/type-alias-enum-variants/issue-63151-dead-code-lint-fields-in-patterns.rs
ui/type-alias-impl-trait/issue-101750.rs
ui/type-alias-impl-trait/issue-104817.rs
ui/type-alias-impl-trait/issue-109054.rs
ui/type-alias-impl-trait/issue-52843-closure-constrain.rs
ui/type-alias-impl-trait/issue-52843.rs
ui/type-alias-impl-trait/issue-53092-2.rs
ui/type-alias-impl-trait/issue-53092.rs