Skip to content

Commit 5605d58

Browse files
committed
move extended info for E0569 to numerical-order location in file
We want the error explanations to appear in numerical order so that they're easy to find. (Also, any other order would be arbitrary and thus not constitute a Schelling point.) Bizarrely, the extended information for E0569 was placed between E0244 and E0318 in librustc_typeck/diagnostics.rs (when the code was introduced in 9a649c3). This commit moves it to be between E0562 and E0570, where it belongs. (Also, at reviewer request, say "Erroneous code example", the standard verbiage that it has been decided that we say everywhere.)
1 parent 6f14ff1 commit 5605d58

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

Diff for: src/librustc_typeck/diagnostics.rs

+22-20
Original file line numberDiff line numberDiff line change
@@ -2631,26 +2631,6 @@ struct Bar<S, T> { x: Foo<S, T> }
26312631
```
26322632
"##,
26332633

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-
26542634
E0318: r##"
26552635
Default impls for a trait must be located in the same crate where the trait was
26562636
defined. For more information see the [opt-in builtin traits RFC][RFC 19].
@@ -3976,6 +3956,28 @@ See [RFC 1522] for more details.
39763956
[RFC 1522]: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md
39773957
"##,
39783958

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+
39793981
E0570: r##"
39803982
The requested ABI is unsupported by the current target.
39813983

0 commit comments

Comments
 (0)