From 1ef7a4c74a1f63ac095a2e24799bf2d558482519 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Wed, 24 Jul 2019 18:10:26 +0200 Subject: [PATCH 1/4] Document the abbreviation of zero-sized types. Closes #172 . --- reference/src/glossary.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reference/src/glossary.md b/reference/src/glossary.md index 3b9cf4f7..235f04d3 100644 --- a/reference/src/glossary.md +++ b/reference/src/glossary.md @@ -73,6 +73,13 @@ niches. For example, the "all bits uninitialized" is an invalid bit-pattern for `&mut T`, but this bit-pattern cannot be used by layout optimizations, and is not a niche. +#### Zero-sized type / ZST + +Types with zero size are called zero-sized types, which is abbreviated as "ZST". +When the alignment of the type is relevant, the schema "N-ZST" which stands for +"N-aligned zero-sized type" is used. For example: "1-ZST" stands for +"one-aligned zero-sized type", that is, a type with a size of zero and an +alignment requirement of one. ### TODO From e2a97ac1995028e1ae83ecbe120410534668121f Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 26 Jul 2019 14:21:46 +0200 Subject: [PATCH 2/4] Drop generic notation --- reference/src/glossary.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/reference/src/glossary.md b/reference/src/glossary.md index 235f04d3..6bf756b0 100644 --- a/reference/src/glossary.md +++ b/reference/src/glossary.md @@ -76,10 +76,9 @@ niche. #### Zero-sized type / ZST Types with zero size are called zero-sized types, which is abbreviated as "ZST". -When the alignment of the type is relevant, the schema "N-ZST" which stands for -"N-aligned zero-sized type" is used. For example: "1-ZST" stands for -"one-aligned zero-sized type", that is, a type with a size of zero and an -alignment requirement of one. +This document also uses the "1-ZST" abbreviation, which stands for "one-aligned +zero-sized type", to refer to zero-sized types with an alignment requirement of +1. ### TODO From a4ffcd91b9fcbf64e836d15d1614e4884536631d Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 26 Jul 2019 14:56:02 +0200 Subject: [PATCH 3/4] Add example of 1-ZST and not to the glossary --- reference/src/glossary.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reference/src/glossary.md b/reference/src/glossary.md index 6bf756b0..342e73fd 100644 --- a/reference/src/glossary.md +++ b/reference/src/glossary.md @@ -77,8 +77,10 @@ niche. Types with zero size are called zero-sized types, which is abbreviated as "ZST". This document also uses the "1-ZST" abbreviation, which stands for "one-aligned -zero-sized type", to refer to zero-sized types with an alignment requirement of -1. +zero-sized type", to refer to zero-sized types with an alignment requirement of 1. + +For example, `()` is a "1-ZST" but `[u16; 0]` is not because it has an alignment +requirement of two. ### TODO From 4a4f9644146a6e707c8748336fd7807862f09e2f Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 26 Jul 2019 15:17:10 +0200 Subject: [PATCH 4/4] Update reference/src/glossary.md Co-Authored-By: Ralf Jung --- reference/src/glossary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/src/glossary.md b/reference/src/glossary.md index 342e73fd..19f60f07 100644 --- a/reference/src/glossary.md +++ b/reference/src/glossary.md @@ -80,7 +80,7 @@ This document also uses the "1-ZST" abbreviation, which stands for "one-aligned zero-sized type", to refer to zero-sized types with an alignment requirement of 1. For example, `()` is a "1-ZST" but `[u16; 0]` is not because it has an alignment -requirement of two. +requirement of 2. ### TODO