forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#123169 - lukas-code:known-panics-ice, r=<try>
skip known panics lint for impossible items fixes rust-lang#123134 For items with impossible predicates like `[u8]: Sized` it's possible to have locals that are "Sized", but cannot be const-propped in any meaningful way. To avoid this issue, we can just skip the known panics lint for items that have impossible predicates.
- Loading branch information
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//@ build-pass | ||
// Regression test for an ICE: https://github.com/rust-lang/rust/issues/123134 | ||
|
||
trait Api: Sized { | ||
type Device: ?Sized; | ||
} | ||
|
||
struct OpenDevice<A: Api> | ||
where | ||
A::Device: Sized, | ||
{ | ||
device: A::Device, | ||
queue: (), | ||
} | ||
|
||
trait Adapter { | ||
type A: Api; | ||
|
||
fn open() -> OpenDevice<Self::A> | ||
where | ||
<Self::A as Api>::Device: Sized; | ||
} | ||
|
||
struct ApiS; | ||
|
||
impl Api for ApiS { | ||
type Device = [u8]; | ||
} | ||
|
||
impl<T> Adapter for T | ||
{ | ||
type A = ApiS; | ||
|
||
// This function has the impossible predicate `[u8]: Sized`. | ||
fn open() -> OpenDevice<Self::A> | ||
where | ||
<Self::A as Api>::Device: Sized, | ||
{ | ||
unreachable!() | ||
} | ||
} | ||
|
||
fn main() {} |