@@ -2631,26 +2631,6 @@ struct Bar<S, T> { x: Foo<S, T> }
2631
2631
```
2632
2632
"## ,
2633
2633
2634
- E0569 : r##"
2635
- If an impl has a generic parameter with the `#[may_dangle]` attribute, then
2636
- that impl must be declared as an `unsafe impl. For example:
2637
-
2638
- ```compile_fail,E0569
2639
- #![feature(generic_param_attrs)]
2640
- #![feature(dropck_eyepatch)]
2641
-
2642
- struct Foo<X>(X);
2643
- impl<#[may_dangle] X> Drop for Foo<X> {
2644
- fn drop(&mut self) { }
2645
- }
2646
- ```
2647
-
2648
- In this example, we are asserting that the destructor for `Foo` will not
2649
- access any data of type `X`, and require this assertion to be true for
2650
- overall safety in our program. The compiler does not currently attempt to
2651
- verify this assertion; therefore we must tag this `impl` as unsafe.
2652
- "## ,
2653
-
2654
2634
E0318 : r##"
2655
2635
Default impls for a trait must be located in the same crate where the trait was
2656
2636
defined. For more information see the [opt-in builtin traits RFC][RFC 19].
@@ -3457,6 +3437,56 @@ impl Foo for i32 {
3457
3437
```
3458
3438
"## ,
3459
3439
3440
+ E0436 : r##"
3441
+ The functional record update syntax is only allowed for structs. (Struct-like
3442
+ enum variants don't qualify, for example.)
3443
+
3444
+ Erroneous code example:
3445
+
3446
+ ```compile_fail,E0436
3447
+ enum PublicationFrequency {
3448
+ Weekly,
3449
+ SemiMonthly { days: (u8, u8), annual_special: bool },
3450
+ }
3451
+
3452
+ fn one_up_competitor(competitor_frequency: PublicationFrequency)
3453
+ -> PublicationFrequency {
3454
+ match competitor_frequency {
3455
+ PublicationFrequency::Weekly => PublicationFrequency::SemiMonthly {
3456
+ days: (1, 15), annual_special: false
3457
+ },
3458
+ c @ PublicationFrequency::SemiMonthly{ .. } =>
3459
+ PublicationFrequency::SemiMonthly {
3460
+ annual_special: true, ..c // error: functional record update
3461
+ // syntax requires a struct
3462
+ }
3463
+ }
3464
+ }
3465
+ ```
3466
+
3467
+ Rewrite the expression without functional record update syntax:
3468
+
3469
+ ```
3470
+ enum PublicationFrequency {
3471
+ Weekly,
3472
+ SemiMonthly { days: (u8, u8), annual_special: bool },
3473
+ }
3474
+
3475
+ fn one_up_competitor(competitor_frequency: PublicationFrequency)
3476
+ -> PublicationFrequency {
3477
+ match competitor_frequency {
3478
+ PublicationFrequency::Weekly => PublicationFrequency::SemiMonthly {
3479
+ days: (1, 15), annual_special: false
3480
+ },
3481
+ PublicationFrequency::SemiMonthly{ days, .. } =>
3482
+ PublicationFrequency::SemiMonthly {
3483
+ days, annual_special: true // ok!
3484
+ }
3485
+ }
3486
+ }
3487
+ ```
3488
+ "## ,
3489
+
3460
3490
E0439 : r##"
3461
3491
The length of the platform-intrinsic function `simd_shuffle`
3462
3492
wasn't specified. Erroneous code example:
@@ -3926,6 +3956,28 @@ See [RFC 1522] for more details.
3926
3956
[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md
3927
3957
"## ,
3928
3958
3959
+ E0569 : r##"
3960
+ If an impl has a generic parameter with the `#[may_dangle]` attribute, then
3961
+ that impl must be declared as an `unsafe impl.
3962
+
3963
+ Erroneous code example:
3964
+
3965
+ ```compile_fail,E0569
3966
+ #![feature(generic_param_attrs)]
3967
+ #![feature(dropck_eyepatch)]
3968
+
3969
+ struct Foo<X>(X);
3970
+ impl<#[may_dangle] X> Drop for Foo<X> {
3971
+ fn drop(&mut self) { }
3972
+ }
3973
+ ```
3974
+
3975
+ In this example, we are asserting that the destructor for `Foo` will not
3976
+ access any data of type `X`, and require this assertion to be true for
3977
+ overall safety in our program. The compiler does not currently attempt to
3978
+ verify this assertion; therefore we must tag this `impl` as unsafe.
3979
+ "## ,
3980
+
3929
3981
E0570 : r##"
3930
3982
The requested ABI is unsupported by the current target.
3931
3983
@@ -4655,7 +4707,6 @@ register_diagnostics! {
4655
4707
// E0372, // coherence not object safe
4656
4708
E0377 , // the trait `CoerceUnsized` may only be implemented for a coercion
4657
4709
// between structures with the same definition
4658
- E0436 , // functional record update requires a struct
4659
4710
E0521 , // redundant default implementations of trait
4660
4711
E0533 , // `{}` does not name a unit variant, unit struct or a constant
4661
4712
E0563 , // cannot determine a type for this `impl Trait`: {}
0 commit comments