@@ -17,10 +17,12 @@ This RFC has two main goals:
17
17
With the release of 1.0, we need to establish clear policy on what
18
18
precisely constitutes a "minor" vs "major" change to the Rust language
19
19
itself (as opposed to libraries, which are covered by [ RFC 1105] ).
20
- ** This RFC proposes that breaking changes are only permitted within a
21
- minor release if they are fix to restore soundness** : this includes
22
- both bug fixes in the compiler itself, as well as changes to the type
23
- system or RFCs that are necessary to close flaws uncovered later.
20
+ ** This RFC proposes that minor releases may only contain breaking
21
+ changes that fix compiler bugs or other type-system
22
+ issues** . Primarily, this means soundness issues where "innocent" code
23
+ can cause undefined behavior (in the technical sense), but it also
24
+ covers cases like compiler bugs and tightening up the semantics of
25
+ "underspecified" parts of the language (more details below).
24
26
25
27
However, simply landing all breaking changes immediately could be very
26
28
disruptive to the ecosystem. Therefore, ** the RFC also proposes
@@ -53,7 +55,7 @@ considering in separate RFCs.
53
55
54
56
# Detailed design
55
57
56
- The detailed design is broken into two major section : how to address
58
+ The detailed design is broken into two major sections : how to address
57
59
soundness changes, and how to address other, opt-in style changes. We
58
60
do not discuss non-breaking changes here, since obviously those are
59
61
safe.
@@ -145,8 +147,8 @@ cause code to compile which should not (because ambiguities
145
147
exist). Finally, there is a list below of areas of the language which
146
148
are generally considered underspecified.
147
149
148
- We expect that there will be cases that fall on a grey line betwen bug
149
- and expected behavior, and discussion will be needed to determine
150
+ We expect that there will be cases that fall on a grey line between
151
+ bug and expected behavior, and discussion will be needed to determine
150
152
where it falls. The recent conflict between ` Rc ` and scoped threads is
151
153
an example of such a discusison: it was clear that both APIs could not
152
154
be legal, but not clear which one was at fault. The results of these
@@ -214,9 +216,10 @@ Known areas where change is expected include the following:
214
216
- Memory allocation in unsafe code is currently unstable. We expect to
215
217
be defining safe interfaces as part of the work on supporting
216
218
tracing garbage collectors (see [ #415 ] ).
217
- - The treatment of hygiene in macros is uneven (see [ #22462 ] , [ #24278 ] ). In some cases,
218
- changes here may be backwards compatible, or may be more appropriate only with explicit opt-in
219
- (or perhaps an alternate macro system altogether).
219
+ - The treatment of hygiene in macros is uneven (see [ #22462 ] ,
220
+ [ #24278 ] ). In some cases, changes here may be backwards compatible,
221
+ or may be more appropriate only with explicit opt-in (or perhaps an
222
+ alternate macro system altogether, such as [ this proposal] [ macro ] ).
220
223
- Lints will evolve over time (both the lints that are enabled and the
221
224
precise cases that lints catch). We expect to introduce a
222
225
[ means to limit the effect of these changes on dependencies] [ #1029 ] .
@@ -242,7 +245,7 @@ Although it is not directly covered by this RFC, it's worth noting in
242
245
passing that some of the CLI flags to the compiler may change in the
243
246
future as well. The ` -Z ` flags are of course explicitly unstable, but
244
247
some of the ` -C ` , rustdoc, and linker-specific flags are expected to
245
- evolve over time.
248
+ evolve over time (see e.g. [ # 24451 ] ) .
246
249
247
250
### Opt-in changes
248
251
@@ -271,8 +274,8 @@ The supplied version is used by the compiler to produce the semantics
271
274
of Rust "as it was" during version ` X.Y ` . RFCs that propose opt-in
272
275
changes should discuss how the older behavior can be supported in the
273
276
compiler, but this is expected to be straightforward: if supporting
274
- older behavior is hard to do, it may indicate that the opt-in change
275
- is too complex and should not be accepted.
277
+ older behavior is hard to do, this may be an indication that the
278
+ opt-in change is too complex and should not be accepted.
276
279
277
280
Note that the supplied version may affect the parser configuration
278
281
used when parsing the initial crate, since it can affect the keywords
@@ -290,9 +293,16 @@ the compiler's version (i.e., the newest version the compiler knows
290
293
about).
291
294
292
295
Cargo will always invoke ` rustc ` with a supplied version. If there is
293
- no version in the ` Cargo.toml ` file, then ` 1.0.0 ` is assumed. Whenever
294
- a new project is created with ` cargo new ` , the new ` Cargo.toml ` will
295
- include the most recent Rust version number by default.
296
+ no version in the ` Cargo.toml ` file, then ` 1.0.0 ` is assumed. (It may
297
+ be a good idea to issue a warning in this case as well.)
298
+
299
+ Whenever a new project is created with ` cargo new ` , the new
300
+ ` Cargo.toml ` will include the most recent Rust version number by
301
+ default. (Since Cargo and rustc are not, at least today, necessarily
302
+ released on the same schedule, we'll have to pick some sensible
303
+ definition of the "most recent" Rust version number; one option is to
304
+ query the ` rustc ` executable in scope. Another is to synchronize the
305
+ release schedules and use the "built-in" notion.)
296
306
297
307
Note that the defaults for ` rustc ` and ` cargo ` differ. ` rustc ` prefers
298
308
the most recent verison of Rust by default, whereas ` cargo ` prefers
@@ -342,6 +352,12 @@ accept an "opt-in" change:
342
352
- What changes are needed to get code compiling again? Are those
343
353
changes obvious from the error message?
344
354
355
+ Another important criterion is the implementation complexity. In
356
+ particular, how easy will it be to maintain both the older behavior
357
+ and the newer behavior? It is important to consider not just the
358
+ complexity today, but possible complexity in the future as the
359
+ compiler changes.
360
+
345
361
# Drawbacks
346
362
347
363
** Allowing unsafe code to continue compiling -- even with warnings --
@@ -481,7 +497,7 @@ introduce an attribute in advance we will not have this problem.
481
497
482
498
[ RFC 1105 ] : https://github.com/rust-lang/rfcs/pull/1105
483
499
[ RFC 320 ] : https://github.com/rust-lang/rfcs/pull/320
484
- [ #774 ] : https://github.com/rust-lang/rfcs/issues/744
500
+ [ #744 ] : https://github.com/rust-lang/rfcs/issues/744
485
501
[ #14875 ] : https://github.com/rust-lang/rust/issues/14875
486
502
[ #16135 ] : https://github.com/rust-lang/rust/issues/16135
487
503
[ #19733 ] : https://github.com/rust-lang/rust/issues/19733
@@ -492,3 +508,5 @@ introduce an attribute in advance we will not have this problem.
492
508
[ #24278 ] : https://github.com/rust-lang/rust/issues/24278
493
509
[ #1029 ] : https://github.com/rust-lang/rfcs/issues/1029
494
510
[ RFC 560 ] : https://github.com/rust-lang/rfcs/pull/560
511
+ [ macro ] : https://internals.rust-lang.org/t/pre-rfc-macro-improvements/2088
512
+ [ #24451 ] : https://github.com/rust-lang/rust/pull/24451
0 commit comments