Skip to content

Commit 19c099b

Browse files
authored
Merge pull request #2617 from rust-lang/rustc-pull
Rustc pull update
2 parents a859b1e + 07b9f40 commit 19c099b

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

tests/fail/layout_cycle.stderr

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,20 @@ error[E0391]: cycle detected when computing layout of `S<S<()>>`
22
|
33
= note: ...which requires computing layout of `<S<()> as Tr>::I`...
44
= note: ...which again requires computing layout of `S<S<()>>`, completing the cycle
5+
note: cycle used when const-evaluating + checking `core::mem::SizedTypeProperties::SIZE`
6+
--> RUSTLIB/core/src/mem/mod.rs:LL:CC
7+
|
8+
LL | const SIZE: usize = intrinsics::size_of::<Self>();
9+
| ^^^^^^^^^^^^^^^^^
510
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
611

7-
error: post-monomorphization error: a cycle occurred during layout computation
12+
error[E0080]: a cycle occurred during layout computation
813
--> RUSTLIB/core/src/mem/mod.rs:LL:CC
914
|
10-
LL | intrinsics::size_of::<T>()
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ post-monomorphization error occurred here
12-
|
13-
= note: BACKTRACE:
14-
= note: inside `std::mem::size_of::<S<S<()>>>` at RUSTLIB/core/src/mem/mod.rs:LL:CC
15-
note: inside `foo::<S<()>>`
16-
--> tests/fail/layout_cycle.rs:LL:CC
17-
|
18-
LL | mem::size_of::<S<T>>()
19-
| ^^^^^^^^^^^^^^^^^^^^^^
20-
note: inside `main`
21-
--> tests/fail/layout_cycle.rs:LL:CC
22-
|
23-
LL | println!("{}", foo::<S<()>>());
24-
| ^^^^^^^^^^^^^^
25-
26-
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
15+
LL | const SIZE: usize = intrinsics::size_of::<Self>();
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `<S<S<()>> as std::mem::SizedTypeProperties>::SIZE` failed here
2717

2818
error: aborting due to 2 previous errors
2919

30-
For more information about this error, try `rustc --explain E0391`.
20+
Some errors have detailed explanations: E0080, E0391.
21+
For more information about an error, try `rustc --explain E0080`.

tests/pass/pattern-types.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![feature(pattern_types, pattern_type_macro, sized_hierarchy)]
2+
#![allow(dead_code)]
3+
4+
use std::marker::PointeeSized;
5+
use std::mem::transmute;
6+
7+
pub struct NonNull<T: PointeeSized> {
8+
pointer: std::pat::pattern_type!(*const T is !null),
9+
}
10+
11+
trait Trait {}
12+
impl Trait for () {}
13+
14+
fn main() {
15+
unsafe {
16+
let _: NonNull<dyn Trait> = NonNull { pointer: transmute(&mut () as *mut dyn Trait) };
17+
}
18+
}

0 commit comments

Comments
 (0)