Skip to content

Commit ce7ef32

Browse files
committed
Markdown formatting for error explanations.
1 parent af57ec5 commit ce7ef32

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc/diagnostics.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,13 +745,15 @@ variable.
745745
746746
For example:
747747
748+
```
748749
let x: i32 = "I am not a number!";
749750
// ~~~ ~~~~~~~~~~~~~~~~~~~~
750751
// | |
751752
// | initializing expression;
752753
// | compiler infers type `&str`
753754
// |
754755
// type `i32` assigned to variable `x`
756+
```
755757
"##,
756758

757759
E0309: r##"
@@ -760,6 +762,7 @@ how long the data stored within them is guaranteed to be live. This lifetime
760762
must be as long as the data needs to be alive, and missing the constraint that
761763
denotes this will cause this error.
762764
765+
```
763766
// This won't compile because T is not constrained, meaning the data
764767
// stored in it is not guaranteed to last as long as the reference
765768
struct Foo<'a, T> {
@@ -770,6 +773,7 @@ struct Foo<'a, T> {
770773
struct Foo<'a, T: 'a> {
771774
foo: &'a T
772775
}
776+
```
773777
"##,
774778

775779
E0310: r##"
@@ -778,6 +782,7 @@ how long the data stored within them is guaranteed to be live. This lifetime
778782
must be as long as the data needs to be alive, and missing the constraint that
779783
denotes this will cause this error.
780784
785+
```
781786
// This won't compile because T is not constrained to the static lifetime
782787
// the reference needs
783788
struct Foo<T> {
@@ -788,6 +793,7 @@ struct Foo<T> {
788793
struct Foo<T: 'static> {
789794
foo: &'static T
790795
}
796+
```
791797
"##
792798

793799
}

0 commit comments

Comments
 (0)