Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoped impl Trait for Type #3634

Closed
wants to merge 28 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a10729f
Added draft RFC: Scoped `imple Trait for Type`
Tamschi Nov 13, 2023
dfa5a2e
Added section Layout-compatibility
Tamschi Nov 26, 2023
7cd3473
Pre-RFC v2
Tamschi Dec 3, 2023
1c4a5bf
Small wording fix
Tamschi Dec 3, 2023
7aa8966
Pre-RFC v3
Tamschi Dec 5, 2023
d21a6bb
Removed code formatting from circle symbols in table as it looks stra…
Tamschi Dec 5, 2023
b0cd5c2
Added missing parens + Small formatting fix
Tamschi Dec 5, 2023
047fc15
Pre-RFC v4
Tamschi Dec 8, 2023
e73714e
Small formatting fix and clarification
Tamschi Dec 8, 2023
483f22a
Pre-RFC v5
Tamschi Mar 7, 2024
b0fe6b3
Pre-RFC v6
Tamschi May 5, 2024
36da3b5
Final RFC-draft for Scoped `impl Trait for Type`
Tamschi May 12, 2024
aa4985f
Merge branch 'master' into scoped_impl_trait_for_type
Tamschi May 12, 2024
7af6148
Renamed the file with the issue number and updated Start Date and RFC…
Tamschi May 12, 2024
f82162b
Fixed Start Date header
Tamschi May 12, 2024
b7fb5e2
Manually wrapped markdown code blocks
Tamschi May 12, 2024
ef35245
Changed "## Type parameters capture their *implementation environment…
Tamschi May 13, 2024
129e734
Added missing `pub` visibility
Tamschi May 13, 2024
f3589ad
Clarified opaque type of generic type parameter
Tamschi May 13, 2024
9c1ef7a
Clarified lines that produce warnings
Tamschi May 13, 2024
6fc4bf9
Changed "No priority over type-associated methods" into "Resolution p…
Tamschi May 13, 2024
99dc572
Replaced "Static interception of dynamic calls" with "Limitations on …
Tamschi May 25, 2024
308af53
Added "Limitations on bounded opaque types and type variables" as sub…
Tamschi May 25, 2024
360a594
Added "Forbidden implementation combinations" and the error "potentia…
Tamschi May 26, 2024
4d74669
Expanded and corrected "Forbidden implementation combinations"
Tamschi Jun 1, 2024
bf0379f
Further expanded and corrected "Forbidden implementation combinations"
Tamschi Jun 1, 2024
1d5ad36
Wording correction
Tamschi Jun 1, 2024
251e4c4
Further expanded and corrected "Forbidden implementation combinations…
Tamschi Jun 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarified lines that produce warnings
Tamschi authored May 13, 2024
commit 9c1ef7a21dcc3ba93a4b55c5f2b2a36627a85097
6 changes: 4 additions & 2 deletions text/3634-scoped-impl-trait-for-type.md
Original file line number Diff line number Diff line change
@@ -746,15 +746,15 @@ type B = Generic<Type as Trait in nested>;

fn no_bound<T: 'static, U: 'static>(_: Generic<T>, _: Generic<U>) {
assert_eq!(TypeId::of::<T>(), TypeId::of::<U>());
assert_ne!(TypeId::of::<Generic<T>>(), TypeId::of::<Generic<U>>());
assert_ne!(TypeId::of::<Generic<T>>(), TypeId::of::<Generic<U>>()); // ⚠⚠

assert_eq!(TypeId::of::<T>(), TypeId::of::<Type>());
assert_eq!(TypeId::of::<U>(), TypeId::of::<Type>());
}

fn yes_bound<T: Trait + 'static, U: Trait + 'static>(_: Generic<T>, _: Generic<U>) {
assert_ne!(TypeId::of::<T>(), TypeId::of::<U>());
assert_ne!(TypeId::of::<Generic<T>>(), TypeId::of::<Generic<U>>());
assert_ne!(TypeId::of::<Generic<T>>(), TypeId::of::<Generic<U>>()); // ⚠⚠

assert_eq!(TypeId::of::<T>(), TypeId::of::<Type>());
assert_ne!(TypeId::of::<U>(), TypeId::of::<Type>());
@@ -766,6 +766,8 @@ fn main() {
}
```

Tamschi marked this conversation as resolved.
Show resolved Hide resolved
(The lines marked with ` // ⚠⚠` produce two warnings each: [behaviour-changewarning-typeid-of-implementation-aware-generic-discretised-using-generic-type-parameters])

In particular:

- If no bound-relevant scoped implementations are captured in a type parameter, then the `TypeId` of the opaque type of that type parameter is identical to that of the discrete type specified for that type parameter.