well, I don't know a lot about this stuff myself, but that's my semi-layman understanding

let me go change some code at $WORK

@matklad , wow that is something I never knew, this provenance thing is something complex. I've read this post and if I understood it correct provenance is not something that is standardized but instead used exclusively by the compiler. There is also a post that justifies that pointers are not just integers. I'd make a conclusion that provenance is the static metadata used for optimizations, that is erased in the compiled output, and at runtime, pointers are indeed just integers.

@Christopher Durham , if you project is open-source the link to it and the place where you put { would be helpful. Or otherwise maybe some excerpt of code which triggers this crash

@Christopher Durham, thank you for the detailed answer! While trying to understand the pointer cast from *const [SliceItem] to NonNull<ThinData<Head, SliceItem>> I cloned your repo and ran cargo build, but it failed:

$ rustc --version
rustc 1.40.0 (73528e339 2019-12-16)
$ cargo build
Compiling thin-dst v1.0.0 (/home/veetaha/my/junk/thin-dst)
error[E0210]: type parameter `Head` must be used as the type parameter for some local type (e.g., `MyStruct<Head>`)
--> src/lib.rs:433:6
|
433 | impl<Head, SliceItem> From<ThinArc<Head, SliceItem>> for Arc<ThinData<Head, SliceItem>> {
| ^^^^ type parameter `Head` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error[E0210]: type parameter `Head` must be used as the type parameter for some local type (e.g., `MyStruct<Head>`)
--> src/lib.rs:492:6
|
492 | impl<Head, SliceItem> From<ThinRc<Head, SliceItem>> for Rc<ThinData<Head, SliceItem>> {
| ^^^^ type parameter `Head` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error[E0210]: type parameter `Head` must be used as the type parameter for some local type (e.g., `MyStruct<Head>`)
--> src/lib.rs:574:6
|
574 | impl<Head, SliceItem> From<ThinPtr<Head, SliceItem>> for NonNull<ThinData<Head, SliceItem>> {
| ^^^^ type parameter `Head` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0210`.
error: could not compile `thin-dst`.
To learn more, run the command again with --verbose.
~/my/junk/thin-dst (master) $ rustc --version
rustc 1.40.0 (73528e339 2019-12-16)
~/my/junk/thin-dst (master) $ cargo miri test
error: 'cargo-miri' is not installed for the toolchain 'stable-x86_64-unknown-linux-gnu'
To install, run `rustup component add miri`
~/my/junk/thin-dst (master) $ rustup component add miri
error: component 'miri' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel stable
~/my/junk/thin-dst (master) $ cd ..
~/my/junk $ rm -rf thin-dst/
~/my/junk $ git clone https://github.com/CAD97/thin-dst.git
Cloning into 'thin-dst'...
remote: Enumerating objects: 125, done.
remote: Counting objects: 100% (125/125), done.
remote: Compressing objects: 100% (76/76), done.
remote: Total 125 (delta 46), reused 106 (delta 35), pack-reused 0
Receiving objects: 100% (125/125), 40.70 KiB | 541.00 KiB/s, done.
Resolving deltas: 100% (46/46), done.
~/my/junk $ code thin-dst/
~/my/junk $ cd thin-dst/
~/my/junk/thin-dst (master) $ ls
Cargo.toml CHANGELOG.md LICENSE README.md rustfmt.toml src tests
~/my/junk/thin-dst (master) $ cargo build
Compiling thin-dst v1.0.0 (/home/veetaha/my/junk/thin-dst)
error[E0210]: type parameter `Head` must be used as the type parameter for some local type (e.g., `MyStruct<Head>`)
--> src/lib.rs:433:6
|
433 | impl<Head, SliceItem> From<ThinArc<Head, SliceItem>> for Arc<ThinData<Head, SliceItem>> {
| ^^^^ type parameter `Head` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error[E0210]: type parameter `Head` must be used as the type parameter for some local type (e.g., `MyStruct<Head>`)
--> src/lib.rs:492:6
|
492 | impl<Head, SliceItem> From<ThinRc<Head, SliceItem>> for Rc<ThinData<Head, SliceItem>> {
| ^^^^ type parameter `Head` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error[E0210]: type parameter `Head` must be used as the type parameter for some local type (e.g., `MyStruct<Head>`)
--> src/lib.rs:574:6
|
574 | impl<Head, SliceItem> From<ThinPtr<Head, SliceItem>> for NonNull<ThinData<Head, SliceItem>> {
| ^^^^ type parameter `Head` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0210`.
error: could not compile `thin-dst`.