Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 2f77abe

Browse files
authored
Merge pull request #1065 from BGR360/issue-92054
Add some ICEs
2 parents b237a4f + 0707220 commit 2f77abe

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

ices/91380.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
cat > foo.rs << 'EOF'
4+
pub trait Module {
5+
type Algebra;
6+
}
7+
8+
pub trait ChainComplex {
9+
type Algebra;
10+
type Module: Module;
11+
}
12+
13+
pub struct FreeModule<A> {
14+
foo: A,
15+
}
16+
17+
impl<A> Module for FreeModule<A> {
18+
type Algebra = A;
19+
}
20+
21+
pub trait FreeChainComplex:
22+
ChainComplex<Module = FreeModule<<Self as ChainComplex>::Algebra>>
23+
{
24+
}
25+
26+
pub struct ResolutionHomomorphism<CC2>
27+
where
28+
CC2: ChainComplex,
29+
{
30+
maps: CC2::Module,
31+
}
32+
33+
pub struct SecondaryResolutionHomomorphism<
34+
CC2: FreeChainComplex<Algebra = usize>,
35+
> {
36+
underlying: ResolutionHomomorphism<CC2>,
37+
}
38+
EOF
39+
40+
rustdoc foo.rs

ices/92054-1.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(allocator_api)]
2+
3+
use std::alloc::{Allocator, Global, Layout};
4+
5+
fn main() {
6+
let layout: Layout = None.unwrap();
7+
let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
8+
let box_ = unsafe { Box::from_raw_in(ptr, &Global) };
9+
}

ices/92054-2.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![feature(allocator_api)]
2+
3+
use std::alloc::{Allocator, Global, Layout};
4+
5+
fn main() {
6+
let layout: Layout = None.unwrap();
7+
let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
8+
let slice: &mut [u8] = unsafe { std::slice::from_raw_parts_mut(ptr, 0) };
9+
let box_ = unsafe { Box::from_raw_in(slice, &Global) };
10+
box_.len();
11+
}

0 commit comments

Comments
 (0)