Skip to content

Commit a23874a

Browse files
committed
Auto merge of #125289 - WaffleLapkin:never-obligations, r=compiler-errors
Implement lint for obligations broken by never type fallback change This is the second (and probably last major?) lint required for the never type fallback change. The idea is to check if the code errors with `fallback = ()` and if it errors with `fallback = !` and if it went from "ok" to "error", lint. I'm not happy with the diagnostic, ideally we'd highlight what bound is the problem. But I'm really unsure how to do that (cc `@jackh726,` iirc you had some ideas?) r? `@compiler-errors` Thanks `@BoxyUwU` with helping with trait solver stuff when I was implementing the initial version of this lint. Tracking: - rust-lang/rust#123748
2 parents 7524ec2 + bd9a7a2 commit a23874a

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

tests/ui/new_ret_no_self.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,7 @@ mod issue7344 {
390390

391391
impl<T> RetImplTraitSelf2<T> {
392392
// should not trigger lint
393-
fn new(t: T) -> impl Trait2<(), Self> {
394-
unimplemented!()
395-
}
393+
fn new(t: T) -> impl Trait2<(), Self> {}
396394
}
397395

398396
struct RetImplTraitNoSelf2<T>(T);
@@ -401,7 +399,6 @@ mod issue7344 {
401399
// should trigger lint
402400
fn new(t: T) -> impl Trait2<(), i32> {
403401
//~^ ERROR: methods called `new` usually return `Self`
404-
unimplemented!()
405402
}
406403
}
407404

tests/ui/new_ret_no_self.stderr

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,10 @@ LL | | }
9696
| |_________^
9797

9898
error: methods called `new` usually return `Self`
99-
--> tests/ui/new_ret_no_self.rs:402:9
99+
--> tests/ui/new_ret_no_self.rs:400:9
100100
|
101101
LL | / fn new(t: T) -> impl Trait2<(), i32> {
102102
LL | |
103-
LL | | unimplemented!()
104103
LL | | }
105104
| |_________^
106105

0 commit comments

Comments
 (0)