Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 126cdf6

Browse files
authoredMar 9, 2024
Merge branch 'rust-lang:master' into bibliography.md
2 parents 28b2823 + f863101 commit 126cdf6

11 files changed

+597
-223
lines changed
 

‎src/SUMMARY.md

+3
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
- [Interactions with turbofishing](./turbofishing-and-early-late-bound.md)
121121
- [Higher-ranked trait bounds](./traits/hrtb.md)
122122
- [Caching subtleties](./traits/caching.md)
123+
- [Implied bounds](./traits/implied-bounds.md)
123124
- [Specialization](./traits/specialization.md)
124125
- [Chalk-based trait solving](./traits/chalk.md)
125126
- [Lowering to logic](./traits/lowering-to-logic.md)
@@ -131,8 +132,10 @@
131132
- [The solver](./solve/the-solver.md)
132133
- [Canonicalization](./solve/canonicalization.md)
133134
- [Coinduction](./solve/coinduction.md)
135+
- [Caching](./solve/caching.md)
134136
- [Proof trees](./solve/proof-trees.md)
135137
- [Normalization](./solve/normalization.md)
138+
- [Opaque types](./solve/opaque-types.md)
136139
- [`Unsize` and `CoerceUnsized` traits](./traits/unsize.md)
137140
- [Type checking](./type-checking.md)
138141
- [Method Lookup](./method-lookup.md)

‎src/building/suggested.md

+24-57
Original file line numberDiff line numberDiff line change
@@ -276,67 +276,34 @@ If you're using nix, you can use the following nix-shell to work on Rust:
276276

277277
```nix
278278
{ pkgs ? import <nixpkgs> {} }:
279-
280-
# This file contains a development shell for working on rustc.
281-
let
282-
# Build configuration for rust-lang/rust. Based on `config.example.toml` (then called
283-
# `config.toml.example`) from `1bd30ce2aac40c7698aa4a1b9520aa649ff2d1c5`
284-
config = pkgs.writeText "rustc-config" ''
285-
profile = "compiler" # you may want to choose a different profile, like `library` or `tools`
286-
287-
[build]
288-
patch-binaries-for-nix = true
289-
# The path to (or name of) the GDB executable to use. This is only used for
290-
# executing the debuginfo test suite.
291-
gdb = "${pkgs.gdb}/bin/gdb"
292-
python = "${pkgs.python3Full}/bin/python"
293-
294-
[rust]
295-
debug = true
296-
incremental = true
297-
deny-warnings = false
298-
299-
# Indicates whether some LLVM tools, like llvm-objdump, will be made available in the
300-
# sysroot.
301-
llvm-tools = true
302-
303-
# Print backtrace on internal compiler errors during bootstrap
304-
backtrace-on-ice = true
305-
'';
306-
307-
ripgrepConfig =
308-
let
309-
# Files that are ignored by ripgrep when searching.
310-
ignoreFile = pkgs.writeText "rustc-rgignore" ''
311-
configure
312-
config.example.toml
313-
x.py
314-
LICENSE-MIT
315-
LICENSE-APACHE
316-
COPYRIGHT
317-
**/*.txt
318-
**/*.toml
319-
**/*.yml
320-
**/*.nix
321-
*.md
322-
src/ci
323-
src/etc/
324-
src/llvm-emscripten/
325-
src/llvm-project/
326-
src/rtstartup/
327-
src/rustllvm/
328-
src/stdsimd/
329-
src/tools/rls/rls-analysis/test_data/
330-
'';
331-
in
332-
pkgs.writeText "rustc-ripgreprc" "--ignore-file=${ignoreFile}";
333-
in
334279
pkgs.mkShell {
335280
name = "rustc";
336281
nativeBuildInputs = with pkgs; [
337-
gcc_multi binutils cmake ninja openssl pkgconfig python39 git curl cacert patchelf nix psutils
282+
binutils cmake ninja pkg-config python3 git curl cacert patchelf nix
283+
];
284+
buildInputs = with pkgs; [
285+
openssl glibc.out glibc.static
338286
];
339-
RIPGREP_CONFIG_PATH = ripgrepConfig;
287+
# Avoid creating text files for ICEs.
288+
RUSTC_ICE = "0";
289+
}
290+
```
291+
292+
Note that when using nix on a not-NixOS distribution, it may be necessary to set
293+
**`patch-binaries-for-nix = true` in `config.toml`**.
294+
Bootstrap tries to detect whether it's running in nix and enable patching automatically,
295+
but this detection can have false negatives.
296+
297+
You can also use your nix shell to manage `config.toml`:
298+
299+
```nix
300+
let
301+
config = pkgs.writeText "rustc-config" ''
302+
# Your config.toml content goes here
303+
''
304+
pkgs.mkShell {
305+
/* ... */
306+
# This environment varaible tells bootstrap where our config.toml is.
340307
RUST_BOOTSTRAP_CONFIG = config;
341308
}
342309
```

‎src/implementing_new_features.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ a new unstable feature:
123123

124124
1. Add the feature name to `rustc_span/src/symbol.rs` in the `Symbols {...}` block.
125125

126+
Note that this block must be in alphbetical order.
127+
126128
1. Add a feature gate declaration to `rustc_feature/src/unstable.rs` in the unstable
127129
`declare_features` block.
128130

@@ -171,9 +173,13 @@ a new unstable feature:
171173
For an example of adding an error, see [#81015].
172174

173175
For features introducing new syntax, pre-expansion gating should be used instead.
174-
To do so, extend the [`GatedSpans`] struct, add spans to it during parsing,
175-
and then finally feature-gate all the spans in
176-
[`rustc_ast_passes::feature_gate::check_crate`].
176+
During parsing, when the new syntax is parsed, the symbol must be inserted to the
177+
current crate's [`GatedSpans`] via `self.sess.gated_span.gate(sym::my_feature, span)`.
178+
179+
After being inserted to the gated spans, the span must be checked in the
180+
[`rustc_ast_passes::feature_gate::check_crate`] function, which actually denies
181+
features. Exactly how it is gated depends on the exact type of feature, but most
182+
likely will use the `gate_all!()` macro.
177183

178184
1. Add a test to ensure the feature cannot be used without
179185
a feature gate, by creating `tests/ui/feature-gates/feature-gate-$feature_name.rs`.

0 commit comments

Comments
 (0)
Please sign in to comment.