diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2023-04-08 09:27:48 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2023-04-08 10:18:48 +0000 |
| commit | 886c0e638806a2541b08ffb1efb88366376aac4b (patch) | |
| tree | c63c2e9c1acbd6eb4b2dbd4593068ac2eb9d9df1 | |
| parent | 954d9a8f8eb2777671395d83c67025488a3b49fa (diff) | |
| download | rust-886c0e638806a2541b08ffb1efb88366376aac4b.tar.gz rust-886c0e638806a2541b08ffb1efb88366376aac4b.zip | |
fix ICE
4 files changed, 25 insertions, 24 deletions
diff --git a/compiler/rustc_traits/src/type_op.rs b/compiler/rustc_traits/src/type_op.rs index e0fd487b3d3..19622112f2a 100644 --- a/compiler/rustc_traits/src/type_op.rs +++ b/compiler/rustc_traits/src/type_op.rs @@ -89,6 +89,7 @@ fn relate_mir_and_user_substs<'tcx>( def_id: hir::def_id::DefId, user_substs: UserSubsts<'tcx>, ) -> Result<(), NoSolution> { + let param_env = param_env.without_const(); let UserSubsts { user_self_ty, substs } = user_substs; let tcx = ocx.infcx.tcx; let cause = ObligationCause::dummy_with_span(span); diff --git a/tests/ui/const-generics/issues/issue-88119.rs b/tests/ui/const-generics/issues/issue-88119.rs index ddc6599a53e..647b0eea86d 100644 --- a/tests/ui/const-generics/issues/issue-88119.rs +++ b/tests/ui/const-generics/issues/issue-88119.rs @@ -1,10 +1,4 @@ -// known-bug: #88119 -// failure-status: 101 -// normalize-stderr-test "note: .*\n" -> "" -// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" -// normalize-stderr-test "\s\d{1,}: .*\n" -> "" -// normalize-stderr-test "\s at .*\n" -> "" -// rustc-env:RUST_BACKTRACE=0 +// check-pass #![allow(incomplete_features)] #![feature(const_trait_impl, generic_const_exprs)] diff --git a/tests/ui/const-generics/issues/issue-88119.stderr b/tests/ui/const-generics/issues/issue-88119.stderr deleted file mode 100644 index b4e18c86b1f..00000000000 --- a/tests/ui/const-generics/issues/issue-88119.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error: internal compiler error: no errors encountered even though `delay_span_bug` issued - -error: internal compiler error: broken MIR in DefId(0:7 ~ issue_88119[4c3c]::name_len) ($DIR/issue-88119.rs:22:5: 22:18 (#0)): ascribe_user_type `&[u8]==TypeOf(DefId(0:4 ~ issue_88119[4c3c]::ConstName::NAME_BYTES), UserSubsts { substs: [T], user_self_ty: None })` failed with `NoSolution` - | - = - -error: internal compiler error: broken MIR in DefId(0:7 ~ issue_88119[4c3c]::name_len) ($DIR/issue-88119.rs:22:5: 22:18 (#0)): ascribe_user_type `&[u8]==TypeOf(DefId(0:4 ~ issue_88119[4c3c]::ConstName::NAME_BYTES), UserSubsts { substs: [T], user_self_ty: None })` failed with `NoSolution` - | - = - - - - -query stack during panic: -end of query stack -error: aborting due to 3 previous errors - diff --git a/tests/ui/rfc-2632-const-trait-impl/trait-method-ptr-in-consts-ice.rs b/tests/ui/rfc-2632-const-trait-impl/trait-method-ptr-in-consts-ice.rs new file mode 100644 index 00000000000..7d7cb967c66 --- /dev/null +++ b/tests/ui/rfc-2632-const-trait-impl/trait-method-ptr-in-consts-ice.rs @@ -0,0 +1,23 @@ +// check-pass + +struct LazyLock<T> { + data: (Option<T>, fn() -> T), +} + +impl<T> LazyLock<T> { + pub const fn new(f: fn() -> T) -> LazyLock<T> { + LazyLock { data: (None, f) } + } +} + +struct A<T = i32>(Option<T>); + +impl<T> Default for A<T> { + fn default() -> Self { + A(None) + } +} + +static EMPTY_SET: LazyLock<A<i32>> = LazyLock::new(A::default); + +fn main() {} |
