From 2e0b7f3ee2625af783200ec8f8afe811d12e1910 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Mon, 31 Jul 2023 12:04:36 +0100 Subject: [PATCH 1/4] Update 2023-07-24-report.org Note about sized trait work --- 2023-07-24-report.org | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/2023-07-24-report.org b/2023-07-24-report.org index 528ccda..0ebc77f 100644 --- a/2023-07-24-report.org +++ b/2023-07-24-report.org @@ -17,6 +17,11 @@ Thanks again to [[https://opensrcsec.com/][Open Source Security, inc]] and [[htt 1. Path resolution 2. Module resolution 3. Now looking at it with Pierre-Emmanuel +4. Sized marker trait implemented + 1. Lays ground work for support drop traits + 2. Means out trait system is working well + 3. Fixed ICE's in typesystem thanks to bugs from GSoC Students +5. More error codes and lots of testing going on. ** Completed Activities @@ -116,5 +121,45 @@ Thus the percentage is computed using the sum of issues and tracked items done d - Finish name resolution rework - Look into remaining issues required for proper AST pipeline of `core` +- Continue bug fixing in type system +- Opaue types development ** Detailed changelog + +*** Sized marker trait + +In Rust all generic type parameters implement the Sized marker trait by default. This means for an example such as: + +#+BEGIN_SRC rust +fn foo(a:T) -> X { ... } +#+END_SRC + +Will always get turned into: + +#+BEGIN_SRC rust +#[lang = "sized"] +pub trait Sized {} + +fn foo(a:T) -> X { ... } +#+END_SRC + +Types such as Slices, Dyn traits do not implement sized so we need to use the special syntax of ?Sized to remove the Sized trait obligation + +#+BEGIN_SRC rust +#[lang = "sized"] +pub trait Sized {} + +pub trait Trait { + fn foo(&self) -> Self + where + Self: Sized; +} + +pub fn static_foo(_b: &T) {} + +pub fn dynamic_bar(a: &dyn Trait) { + static_foo(a) +} +#+END_SRC + +This is a key milestone for gccrs as it lays the groundwork to support the other major marker-trait of Drop. From 7ba833ec8f37437e3c40d29212d53786f19736b9 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Mon, 31 Jul 2023 12:08:41 +0100 Subject: [PATCH 2/4] Update 2023-07-24-report.org --- 2023-07-24-report.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/2023-07-24-report.org b/2023-07-24-report.org index 0ebc77f..36a91d5 100644 --- a/2023-07-24-report.org +++ b/2023-07-24-report.org @@ -162,4 +162,6 @@ pub fn dynamic_bar(a: &dyn Trait) { } #+END_SRC +Note in the example, Trait's define an implicit Self type parameter which does not implemented Sized by default. This is because it would cause a recursive trait obligation for Sized to be defined on the Self for the Sized trait itself. + This is a key milestone for gccrs as it lays the groundwork to support the other major marker-trait of Drop. From 6914862d1394cfaf7311be1d7e4bbdb7842c90e6 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Mon, 31 Jul 2023 12:09:51 +0100 Subject: [PATCH 3/4] Update 2023-07-24-report.org --- 2023-07-24-report.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2023-07-24-report.org b/2023-07-24-report.org index 36a91d5..9fe3567 100644 --- a/2023-07-24-report.org +++ b/2023-07-24-report.org @@ -162,6 +162,6 @@ pub fn dynamic_bar(a: &dyn Trait) { } #+END_SRC -Note in the example, Trait's define an implicit Self type parameter which does not implemented Sized by default. This is because it would cause a recursive trait obligation for Sized to be defined on the Self for the Sized trait itself. +Note in the example, traits define an implicit Self type parameter which does not implement Sized by default. This is because it would cause a recursive trait obligation for Sized to be defined on the Self for the Sized trait itself. This is a key milestone for gccrs as it lays the groundwork to support the other major marker-trait of Drop. From b09182f3f3aa9bfd8fdb99d7bb0a26eed15f149e Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Mon, 31 Jul 2023 12:30:57 +0100 Subject: [PATCH 4/4] Update 2023-07-24-report.org --- 2023-07-24-report.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2023-07-24-report.org b/2023-07-24-report.org index 9fe3567..59cc8c5 100644 --- a/2023-07-24-report.org +++ b/2023-07-24-report.org @@ -19,7 +19,7 @@ Thanks again to [[https://opensrcsec.com/][Open Source Security, inc]] and [[htt 3. Now looking at it with Pierre-Emmanuel 4. Sized marker trait implemented 1. Lays ground work for support drop traits - 2. Means out trait system is working well + 2. Means our trait system is working well 3. Fixed ICE's in typesystem thanks to bugs from GSoC Students 5. More error codes and lots of testing going on. @@ -122,7 +122,7 @@ Thus the percentage is computed using the sum of issues and tracked items done d - Finish name resolution rework - Look into remaining issues required for proper AST pipeline of `core` - Continue bug fixing in type system -- Opaue types development +- Opaque types development ** Detailed changelog