Skip to content

Commit cb044d4

Browse files
committed
Implement #[define_opaque] attribute for functions.
1 parent eac092f commit cb044d4

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

clippy_utils/src/ast_utils/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,15 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
364364
generics: lg,
365365
contract: lc,
366366
body: lb,
367+
define_opaque: _,
367368
}),
368369
Fn(box ast::Fn {
369370
defaultness: rd,
370371
sig: rf,
371372
generics: rg,
372373
contract: rc,
373374
body: rb,
375+
define_opaque: _,
374376
}),
375377
) => {
376378
eq_defaultness(*ld, *rd)
@@ -502,13 +504,15 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
502504
generics: lg,
503505
contract: lc,
504506
body: lb,
507+
define_opaque: _,
505508
}),
506509
Fn(box ast::Fn {
507510
defaultness: rd,
508511
sig: rf,
509512
generics: rg,
510513
contract: rc,
511514
body: rb,
515+
define_opaque: _,
512516
}),
513517
) => {
514518
eq_defaultness(*ld, *rd)
@@ -567,13 +571,15 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
567571
generics: lg,
568572
contract: lc,
569573
body: lb,
574+
define_opaque: _,
570575
}),
571576
Fn(box ast::Fn {
572577
defaultness: rd,
573578
sig: rf,
574579
generics: rg,
575580
contract: rc,
576581
body: rb,
582+
define_opaque: _,
577583
}),
578584
) => {
579585
eq_defaultness(*ld, *rd)

tests/ui/crashes/ice-10972-tait.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/ui/implied_bounds_in_impls.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ impl Atpit for () {
192192

193193
type Tait = impl DerefMut;
194194
//~^ implied_bounds_in_impls
195+
#[define_opaque(Tait)]
195196
fn define() -> Tait {
196197
&mut [] as &mut [()]
197198
}

tests/ui/implied_bounds_in_impls.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ impl Atpit for () {
192192

193193
type Tait = impl Deref + DerefMut;
194194
//~^ implied_bounds_in_impls
195+
#[define_opaque(Tait)]
195196
fn define() -> Tait {
196197
&mut [] as &mut [()]
197198
}

tests/ui/missing_const_for_fn/cant_be_const.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ mod msrv {
207207
mod with_ty_alias {
208208
type Foo = impl std::fmt::Debug;
209209

210+
#[define_opaque(Foo)]
210211
fn foo(_: Foo) {
211212
let _: Foo = 1;
212213
}

tests/ui/new_ret_no_self_overflow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ mod issue10041 {
1717
struct Bomb2;
1818

1919
impl Bomb2 {
20+
#[define_opaque(X)]
2021
pub fn new() -> X {
2122
//~^ ERROR: overflow evaluating the requirement
2223
0i32

tests/ui/new_ret_no_self_overflow.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0275]: overflow evaluating the requirement `<i32 as std::ops::Add>::Output == issue10041::X`
2-
--> tests/ui/new_ret_no_self_overflow.rs:20:25
2+
--> tests/ui/new_ret_no_self_overflow.rs:21:25
33
|
44
LL | pub fn new() -> X {
55
| ^

0 commit comments

Comments
 (0)