Skip to content

Commit 91397a6

Browse files
committed
Replace occurences of illegal in user facing docs
1 parent cf7e825 commit 91397a6

File tree

6 files changed

+23
-21
lines changed

6 files changed

+23
-21
lines changed

src/libcollections/fmt.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@
8585
//! format!("{a} {c} {b}", a="a", b='b', c=3); // => "a 3 b"
8686
//! ```
8787
//!
88-
//! It is illegal to put positional parameters (those without names) after
89-
//! arguments which have names. Like with positional parameters, it is illegal
90-
//! to provide named parameters that are unused by the format string.
88+
//! It is not valid to put positional parameters (those without names) after
89+
//! arguments which have names. Like with positional parameters, it is not
90+
//! valid to provide named parameters that are unused by the format string.
9191
//!
9292
//! ## Argument types
9393
//!
@@ -103,19 +103,21 @@
103103
//! hexadecimal as well as an
104104
//! octal.
105105
//!
106-
//! There are various parameters which do require a particular type, however. Namely, the `{:.*}`
107-
//! syntax, which sets the number of numbers after the decimal in floating-point types:
106+
//! There are various parameters which do require a particular type, however.
107+
//! Namely, the `{:.*}` syntax, which sets the number of numbers after the
108+
//! decimal in floating-point types:
108109
//!
109110
//! ```
110111
//! let formatted_number = format!("{:.*}", 2, 1.234567);
111112
//!
112113
//! assert_eq!("1.23", formatted_number)
113114
//! ```
114115
//!
115-
//! If this syntax is used, then the number of characters to print precedes the actual object being
116-
//! formatted, and the number of characters must have the type `usize`. Although a `usize` can be
117-
//! printed with `{}`, it is illegal to reference an argument as such. For example this is another
118-
//! invalid format string:
116+
//! If this syntax is used, then the number of characters to print precedes the
117+
//! actual object being formatted, and the number of characters must have the
118+
//! type `usize`. Although a `usize` can be printed with `{}`, it is invalid to
119+
//! reference an argument as such. For example this is another invalid format
120+
//! string:
119121
//!
120122
//! ```text
121123
//! {:.*} {0}

src/libcore/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ pub trait Copy : Clone {
205205
/// Any types with interior mutability must also use the `std::cell::UnsafeCell`
206206
/// wrapper around the value(s) which can be mutated when behind a `&`
207207
/// reference; not doing this is undefined behaviour (for example,
208-
/// `transmute`-ing from `&T` to `&mut T` is illegal).
208+
/// `transmute`-ing from `&T` to `&mut T` is invalid).
209209
#[stable(feature = "rust1", since = "1.0.0")]
210210
#[lang = "sync"]
211211
#[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]

src/libcore/num/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,8 @@ macro_rules! int_impl {
479479
/// wrapping around at the boundary of the type.
480480
///
481481
/// Such wrap-around never actually occurs mathematically;
482-
/// implementation artifacts make `x % y` illegal for `MIN /
483-
/// -1` on a signed type illegal (where `MIN` is the negative
482+
/// implementation artifacts make `x % y` invalid for `MIN /
483+
/// -1` on a signed type (where `MIN` is the negative
484484
/// minimal value). In such a case, this function returns `0`.
485485
#[stable(feature = "num_wrapping", since = "1.2.0")]
486486
#[inline(always)]
@@ -1051,8 +1051,8 @@ macro_rules! uint_impl {
10511051
/// wrapping around at the boundary of the type.
10521052
///
10531053
/// Such wrap-around never actually occurs mathematically;
1054-
/// implementation artifacts make `x % y` illegal for `MIN /
1055-
/// -1` on a signed type illegal (where `MIN` is the negative
1054+
/// implementation artifacts make `x % y` invalid for `MIN /
1055+
/// -1` on a signed type (where `MIN` is the negative
10561056
/// minimal value). In such a case, this function returns `0`.
10571057
#[stable(feature = "num_wrapping", since = "1.2.0")]
10581058
#[inline(always)]

src/librustc/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ arms.
4141
"##,
4242

4343
E0002: r##"
44-
This error indicates that an empty match expression is illegal because the type
44+
This error indicates that an empty match expression is invalid because the type
4545
it is matching on is non-empty (there exist values of this type). In safe code
4646
it is impossible to create an instance of an empty type, so empty match
4747
expressions are almost never desired. This error is typically fixed by adding
@@ -1052,7 +1052,7 @@ because the `'static` lifetime is a special built-in lifetime name denoting
10521052
the lifetime of the entire program, this is an error:
10531053
10541054
```
1055-
// error, illegal lifetime parameter name `'static`
1055+
// error, invalid lifetime parameter name `'static`
10561056
fn foo<'static>(x: &'static str) { }
10571057
```
10581058
"##,
@@ -1802,7 +1802,7 @@ For more information about `const fn`'s, see [RFC 911].
18021802
E0394: r##"
18031803
From [RFC 246]:
18041804
1805-
> It is illegal for a static to reference another static by value. It is
1805+
> It is invalid for a static to reference another static by value. It is
18061806
> required that all references be borrowed.
18071807
18081808
[RFC 246]: https://github.com/rust-lang/rfcs/pull/246

src/librustc_resolve/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ mod foo {
106106
use foo::MyTrait::do_something;
107107
```
108108
109-
It's illegal to directly import methods belonging to a trait or concrete type.
109+
It's invalid to directly import methods belonging to a trait or concrete type.
110110
"##,
111111

112112
E0255: r##"

src/librustc_typeck/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ extern "C" {
584584
```
585585
586586
Using this declaration, it must be called with at least one argument, so
587-
simply calling `printf()` is illegal. But the following uses are allowed:
587+
simply calling `printf()` is invalid. But the following uses are allowed:
588588
589589
```
590590
unsafe {
@@ -778,7 +778,7 @@ the pointer the size of the type would need to be unbounded.
778778
Consider the following erroneous definition of a type for a list of bytes:
779779
780780
```
781-
// error, illegal recursive struct type
781+
// error, invalid recursive struct type
782782
struct ListNode {
783783
head: u8,
784784
tail: Option<ListNode>,
@@ -2345,7 +2345,7 @@ register_diagnostics! {
23452345
E0241,
23462346
E0242, // internal error looking up a definition
23472347
E0245, // not a trait
2348-
E0246, // illegal recursive type
2348+
E0246, // invalid recursive type
23492349
E0247, // found module name used as a type
23502350
E0248, // found value name used as a type
23512351
E0319, // trait impls for defaulted traits allowed just for structs/enums

0 commit comments

Comments
 (0)