This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 9 files changed +14
-12
lines changed
compiler/rustc_error_codes/src/error_codes Expand file tree Collapse file tree 9 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ static X: i32 = 42;
88const Y: i32 = X;
99```
1010
11- In this example, ` Y ` cannot refer to ` X ` here . To fix this, the value can be
11+ In this example, ` Y ` cannot refer to ` X ` . To fix this, the value can be
1212extracted as a const and then used:
1313
1414```
Original file line number Diff line number Diff line change @@ -287,5 +287,5 @@ the method `get_a()` would return an object of unknown type when called on the
287287function. ` Self ` type parameters let us make object safe traits no longer safe,
288288so they are forbidden when specifying supertraits.
289289
290- There's no easy fix for this, generally code will need to be refactored so that
290+ There's no easy fix for this. Generally, code will need to be refactored so that
291291you no longer need to derive from ` Super<Self> ` .
Original file line number Diff line number Diff line change 1- An incorrect number of generic arguments were provided.
1+ An incorrect number of generic arguments was provided.
22
33Erroneous code example:
44
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ You can only define an inherent implementation for a type in the same crate
1010where the type was defined. For example, an ` impl ` block as above is not allowed
1111since ` Vec ` is defined in the standard library.
1212
13- To fix this problem, you can do either of these things :
13+ To fix this problem, you can either:
1414
1515 - define a trait that has the desired associated functions/types/constants and
1616 implement the trait for the type in question
Original file line number Diff line number Diff line change @@ -59,9 +59,9 @@ fn main() {
5959}
6060```
6161
62- Note that the error here is in the definition of the generic function: Although
62+ Note that the error here is in the definition of the generic function. Although
6363we only call it with a parameter that does implement ` Debug ` , the compiler
64- still rejects the function: It must work with all possible input types. In
64+ still rejects the function. It must work with all possible input types. In
6565order to make this example compile, we need to restrict the generic type we're
6666accepting:
6767
Original file line number Diff line number Diff line change 2525
2626The type definition contains some field whose type requires an outlives
2727annotation. Outlives annotations (e.g., ` T: 'a ` ) are used to guarantee that all
28- the data in T is valid for at least the lifetime ` 'a ` . This scenario most
28+ the data in ` T ` is valid for at least the lifetime ` 'a ` . This scenario most
2929commonly arises when the type contains an associated type reference like
3030` <T as SomeTrait<'a>>::Output ` , as shown in the previous code.
3131
Original file line number Diff line number Diff line change 1- This error occurs because a value was dropped while it was still borrowed
1+ This error occurs because a value was dropped while it was still borrowed.
22
33Erroneous code example:
44
@@ -15,7 +15,7 @@ let mut x = Foo { x: None };
1515println!("{:?}", x.x);
1616```
1717
18- In here , ` y ` is dropped at the end of the inner scope, but it is borrowed by
18+ Here , ` y ` is dropped at the end of the inner scope, but it is borrowed by
1919` x ` until the ` println ` . To fix the previous example, just remove the scope
2020so that ` y ` isn't dropped until after the println
2121
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ enum Foo {
1111
1212If you're using a stable or a beta version of rustc, you won't be able to use
1313any unstable features. In order to do so, please switch to a nightly version of
14- rustc (by using rustup).
14+ rustc (by using [ rustup] ).
1515
1616If you're using a nightly version of rustc, just add the corresponding feature
1717to be able to use it:
@@ -24,3 +24,5 @@ enum Foo {
2424 Bar(u64),
2525}
2626```
27+
28+ [ rustup ] : https://rust-lang.github.io/rustup/concepts/channels.html
Original file line number Diff line number Diff line change 1- An non-ascii identifier was used in an invalid context.
1+ A non-ASCII identifier was used in an invalid context.
22
33Erroneous code examples:
44
@@ -13,7 +13,7 @@ fn řųśť() {} // error!
1313fn main() {}
1414```
1515
16- Non-ascii can be used as module names if it is inlined or if a ` #[path] `
16+ Non-ASCII can be used as module names if it is inlined or if a ` #[path] `
1717attribute is specified. For example:
1818
1919```
You can’t perform that action at this time.
0 commit comments