Skip to content

rustfmt libcoretest #33790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 179 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
6c3d98a
rustfmt--ing files
srinivasreddy May 22, 2016
3036d78
Efficient trie lookup for boolean Unicode properties
raphlinus Apr 19, 2016
045253a
Fix wrong shift in trie_lookup_range_table
raphlinus Apr 19, 2016
7637676
Add comment, reduce storage requirements
raphlinus Apr 21, 2016
e935409
fix bug in `debug!` output from `rustc::middle::dataflow`
pnkfelix Apr 28, 2016
eb080c5
fixes to `librustc_borrowck::bitslice::bits_to_string`, used for grap…
pnkfelix Apr 28, 2016
698750f
`rustc_mir::pretty`: factor out scope entry/exit annotation computation.
pnkfelix Apr 28, 2016
07a6d6d
`rustc_mir::pretty` refactoring: break `fn write_fn_intro` into two r…
pnkfelix Apr 28, 2016
a5272f2
Expose pretty print routines that accept just `mir` (no need for a `N…
pnkfelix Apr 28, 2016
50bb001
One-line doc clarification for representation of unit type `()`.
pnkfelix Apr 28, 2016
02a8990
Add helper method for getting the dataflow results at exit from a bas…
pnkfelix Apr 28, 2016
228d19a
Remove `&self` parameter from `DataflowOperator::initial_value`.
pnkfelix Apr 28, 2016
06a6b04
Unit struct defns for 3 dataflow analyses for `borrowck::mir::dataflow`.
pnkfelix Apr 28, 2016
cda9c56
`borrowck::mir::gather_moves`: create MovePaths for lvalues even if u…
pnkfelix May 2, 2016
5d9c0bb
Revised mir-dataflow.
pnkfelix May 2, 2016
60bf92c
Adding magic `rustc_peek` intrinsic that other code can repurpose to
pnkfelix May 11, 2016
1ec12b1
Add ability to unit-test dataflow results via `rustc_peek` intrinsic.
pnkfelix May 11, 2016
a629abd
Little unit tests for MIR dataflow analysis.
pnkfelix May 6, 2016
6bba7be
`DefinitelyInitializedLvals` dataflow op (goal: move away from `Maybe…
pnkfelix May 13, 2016
28ed852
core::intrinsics: fix typo noted during review.
pnkfelix May 16, 2016
537c898
Deprecate {f32,f64}::abs_sub.
huonw May 16, 2016
b4cbffe
Fix comments in `mir::dataflow::sanity_check`.
pnkfelix May 17, 2016
f9e6530
Escape asterix in markdown file to side-step it being interpreted as …
pnkfelix May 17, 2016
7263648
`mir::dataflow::sanity_check`: removed hackish `tmp = val` propagatio…
pnkfelix May 17, 2016
bdcf679
always make at least one codegen-unit
nikomatsakis May 19, 2016
0e9d819
Allow `concat_idents!` in type positions as well as in expression pos…
jseyfried May 19, 2016
144c133
Mention that the panic hook will always run
sfackler May 20, 2016
4392497
markdown fix suggested during review.
pnkfelix May 20, 2016
a0db134
`mir::dataflow::sanity_check`: Factor out `fn is_rustc_peek` helper r…
pnkfelix May 20, 2016
743518b
fix comment in `impl DataflowOperator for MaybeUninitializedLvals`.
pnkfelix May 20, 2016
7eb5e04
`borrowck::mir`: alpha-renamed DropFlagState variant names.
pnkfelix May 20, 2016
4ea5b79
Added comment pointing out somewhat subtle initialization in `fn star…
pnkfelix May 20, 2016
6ad8b3c
`mir::dataflow` arielb1 review feedback
pnkfelix May 20, 2016
3ebaf45
Review feedback.
pnkfelix May 20, 2016
2d0b931
review feedback: fix some index-mismatch bugs pointed out by arielb1.
pnkfelix May 20, 2016
5531a63
Fix references links
aaranxu May 20, 2016
2c2eb71
Refactor `bitslice`: distinguish `usize` for indexing vs word type be…
pnkfelix May 20, 2016
0e4c9c2
Added a `rustdoc` shortcut for collapse/expand all
alex-ozdemir May 21, 2016
540c69f
src/doc: Keep the original style of links
aaranxu May 21, 2016
afa3905
Improve internal documentation and code style
ticki Dec 21, 2015
eb54041
Introduce `MacroGenerable` trait
jseyfried May 19, 2016
bd0e1fe
Improve diagnostics
jseyfried May 19, 2016
20a3ee7
Re-fold expanded items in `expand_mac_invoc`
jseyfried May 20, 2016
a88b7f1
Use `expand_mac_invoc` in `expand_pat`
jseyfried May 19, 2016
744877b
Check attributes in `expand_mac_invoc`
jseyfried May 20, 2016
7ac2ae6
Refactor out `mac_result` in `expand_mac_invoc`
jseyfried May 21, 2016
d32b985
Refactor away `expand_item_mac`
jseyfried May 21, 2016
4afdae8
Refactor away `check_attributes`
jseyfried May 21, 2016
67f4fd0
Move `placement_in_syntax` gated feature checking from expansion to t…
jseyfried May 21, 2016
4ed4abc
Test diagnostics
jseyfried May 21, 2016
2314f54
Update repr_simd
GuillaumeGomez May 21, 2016
a235ed3
mk: Add --enable-local-rebuild to bootstrap from the current release
cuviper May 21, 2016
8a299e8
bootstrap: mirror mk's local-rebuild changes
cuviper May 21, 2016
cbd5db3
Add new error code tests
GuillaumeGomez May 20, 2016
61acf1e
run rustfmt on libcollections test module
srinivasreddy May 22, 2016
77ab641
Changed toggle all sections key to `T`
alex-ozdemir May 22, 2016
68753ae
Fix misleading intentation errors on gcc 6.0
locallycompact May 22, 2016
d1e2de8
save-analysis: use a function's short name
nrc May 22, 2016
cecdd90
Don't suggest using fields in a static method
GuillaumeGomez May 13, 2016
9bf603d
Fixed shortcut handling. Reverted to [Shift]+[+=]
alex-ozdemir May 23, 2016
3ff47f8
Use libc::abort, not intrinsics::abort, in rtabort!
lambda Feb 6, 2016
16a86a2
Propagate obligations through projection
soltanmm-google May 13, 2016
b1a64c5
Fixed link in Rust Book (no-stdlib)
tmr232 May 23, 2016
7ffebad
add `indexed_set` mod for typed wrappers around bitarrays representin…
pnkfelix May 23, 2016
c35e4fa
Add explanations about what derived trait implementations do
carols10cents May 20, 2016
51d2fd7
`derive` explanation for PartialOrd should match that for Ord
carols10cents May 21, 2016
ed59f6b
Make `Derivable` header be an h2 instead of an h1
carols10cents May 21, 2016
5f81879
Reorder `Copy` doc sections
carols10cents May 21, 2016
7529f15
Add an explicit "How can I implement `PartialEq`"? doc section
carols10cents May 21, 2016
2db5288
Add an explicit "How can I implement `Eq`" doc section
carols10cents May 21, 2016
9eebf37
Add more detail to `Clone`'s documentation
carols10cents May 22, 2016
8c8aba4
Add more information about implementing `Hash`
carols10cents May 22, 2016
7be6710
Add an explicit "How can I implement `Ord`" doc section
carols10cents May 22, 2016
c01cc02
Add an explicit "How can I implement `PartialOrd`" doc section
carols10cents May 22, 2016
6b00de7
Make the Default docs more like the other traits
carols10cents May 22, 2016
2ca5697
trans::collector: Remove some redundant calls to erase_regions().
michaelwoerister May 22, 2016
05088e7
mk: Bump version number
alexcrichton May 23, 2016
0ed92d6
Do not inject test harness for --cfg test
sanxiyn May 23, 2016
ab86cc4
revised mir-dataflow so bitvectors carry a phantom type for their ind…
pnkfelix May 23, 2016
e59bb79
bootstrap: rename Config.rebuild to .local_rebuild
cuviper May 23, 2016
7f87463
Update error format for readability. Add spacing header<->snippet and…
May 23, 2016
bb6ea4f
Shorten, yet clarify, initial summary sentences
carols10cents May 23, 2016
0a26fbc
Emphasize semantic differences of Copy/Clone rather than impl
carols10cents May 23, 2016
bd11394
"more than 32" => "more than 32 elements"
carols10cents May 23, 2016
572b5e4
Remove unused field and argument
sanxiyn May 23, 2016
9a64fa0
"non equal" => "not equal"; consistent with the surrounding text
carols10cents May 23, 2016
510bfcb
Add some newlines in some code examples
carols10cents May 23, 2016
562b122
Use `()` when referring to functions
carols10cents May 23, 2016
c8a4cf1
Prefer `ClassName` over `Self` in example trait implementations
carols10cents May 23, 2016
2cb3614
Move all `Default` docs from module to trait
carols10cents May 23, 2016
0d749d6
Improve the long explanation of E0207.
May 17, 2016
0112221
Complete `PartialOrd`'s example so it passes make check-docs
carols10cents May 23, 2016
248665c
"the trait `Hash`" => "the `Hash` trait"
carols10cents May 23, 2016
042c37e
Fix #33819 and update ui test
May 23, 2016
18350f6
Fix invalid background color in stability elements
GuillaumeGomez May 23, 2016
e65f55d
format with [rustfmt_skip] and addressed a few comments
srinivasreddy May 23, 2016
87ad845
panic.rs: fix docs (recover -> catch_unwind)
diwic May 24, 2016
6e36ca1
rustbuild: Add support for --enable-local-rust
alexcrichton May 23, 2016
f66840b
Fix asm-misplaced-option on ARM/AArch64
mmatyas May 20, 2016
efaa942
Make sure that macros that didn't pass LHS checking are not expanded.
LeoTestard May 18, 2016
f0e7f83
Avoid iterating two times over the list of LHSes.
LeoTestard May 18, 2016
860afcf
bug fix to `borrowck::indexed_set`: wanted bit-count not byte-count.
pnkfelix May 24, 2016
2d15566
Fix comment within sanity_check.
pnkfelix May 24, 2016
b3f3a89
`mir::dataflow::sanity_check`: extract an `fn each_block` to simplify…
pnkfelix May 24, 2016
0a1b35a
Moved the four impls of `BitDenotation` to their own module, `mod imp…
pnkfelix May 24, 2016
644527d
Move issue-26480 cfail to ui test. Fix #33763
May 24, 2016
fbd66f8
Add comments and fix a nit
jseyfried May 24, 2016
287d10a
syntax/hir: give loop labels a span
birkenfeld May 2, 2016
81243af
move the `tcx` and `mir` parts of associated `Ctxt` onto each `BitDen…
pnkfelix May 24, 2016
c23bcf8
syntax: Make codemap::get_filemap() return an Option
kamalmarhubi May 24, 2016
c576152
Replaced use of `interpret` method in `mir::dataflow::graphviz` with …
pnkfelix May 24, 2016
358850e
Back to single line between errors. Add header space to secondary files
May 24, 2016
9e7e674
Removed `type Bit` and `fn interpret` items from `trait BitDenotation`.
pnkfelix May 24, 2016
51b1e79
Satisfy tidy
May 24, 2016
5e1f56b
std: Stabilize APIs for the 1.10 release
alexcrichton May 17, 2016
85c314f
correct typo in comment
nikomatsakis May 24, 2016
a01c257
Apply visit_path to import prefixes by default
petrochenkov Mar 6, 2016
cd8e828
refactor autoderef to avoid registering obligations
May 24, 2016
8ee22ae
threaded a `ty::ParameterEnvironment` for the current node id via the…
pnkfelix May 24, 2016
53c3b57
placate tidy in `mir::dataflow::graphviz`.
pnkfelix May 24, 2016
d3c0978
placate tidy in `mir::dataflow`.
pnkfelix May 24, 2016
1be936f
placate tidy in `mir::gather_moves`.
pnkfelix May 24, 2016
7a1c230
placate tidy in compile-fail test.
pnkfelix May 24, 2016
bd9d0aa
rustc: use a simpler scheme for plugin registrar symbol names.
eddyb May 10, 2016
d92412f
trans: remove unused symbol_names::exported_name_with_suffix.
eddyb May 10, 2016
5112360
std: Use memalign, not posix_memalign, on Android
alexcrichton May 24, 2016
5753191
trans: move exported_name's logic into symbol_names.
eddyb May 24, 2016
a42d394
trans: force absolute item paths within symbols.
eddyb May 11, 2016
28be4e6
trans: move exported_symbol to Instance::symbol_name.
eddyb May 12, 2016
07ce7f5
trans: move the linker support to compute symbols on-demand.
eddyb May 24, 2016
e1cf422
trans: remove item_symbols from metadata and CrateContext.
eddyb May 12, 2016
2be9df7
Point out the clone operation in summary line docs of `Vec::extend_fr…
liigo May 25, 2016
12012cb
trans: save metadata even with -Z no-trans.
eddyb May 25, 2016
b8aa7e5
Implement Error trait for fmt::Error type
GuillaumeGomez May 24, 2016
5e11d82
Improve E0084 error explanation
GuillaumeGomez May 25, 2016
2855a21
Add new error code tests
GuillaumeGomez May 25, 2016
06174e6
Fix some comments.
pnkfelix May 25, 2016
c19958c
Add notes that data-structures should potentially move to different c…
pnkfelix May 25, 2016
78c4f26
remove unnecessary use of `indexed_set::Indexed` trait.
pnkfelix May 25, 2016
ca5975b
remove `indexed_set::Indexed` trait.
pnkfelix May 25, 2016
43692d3
fixes to `indexed_set`: add comments and fix `PhantomData` def'n.
pnkfelix May 25, 2016
f105218
Alpha rename `OwnIdxSet` to `IdxSetBuf`.
pnkfelix May 25, 2016
2760be4
catch attempts to leak obligations out of snapshots
arielb1 May 25, 2016
07696af
Remove ExplicitSelf from AST
petrochenkov Mar 6, 2016
470e403
Add a new AST-only type variant `ImplicitSelf`
petrochenkov Mar 6, 2016
cf121b7
Fix rebase
petrochenkov Mar 6, 2016
79c1fdc
parser.rs: fix typos in comments
c4rlo May 18, 2016
5dcc8c2
Fix handling of C arguments
nagisa May 25, 2016
6fe1587
Add a regression test
nagisa May 25, 2016
d7ea38d
Fix the fix/hack interaction with debuginfo
nagisa May 26, 2016
0a4439b
Fix nit/Refine the datum construction
nagisa May 26, 2016
f0512ea
Fix ICE on failure to parse token tree
jseyfried May 25, 2016
f7f6135
`EscapeUnicode` and `EscapeDefault` are `ExactSizeIterator`s
ranma42 Dec 30, 2015
f548573
Implement `count` for `EscapeDefault` and `EscapeUnicode`
ranma42 Dec 30, 2015
4ad7272
Move length computation to `ExactSizeIterator` impls
ranma42 Jan 18, 2016
061397e
Explain the order of the enumeration items
ranma42 May 26, 2016
cd1ba6b
Add `make tips` as useful make target
Byron May 26, 2016
7a6fc45
Implement `..` in tuple (struct) patterns
petrochenkov Mar 6, 2016
b11f751
Address review comments
petrochenkov Mar 6, 2016
7f353a3
Replace pat_adjust_pos with an iterator adapter
petrochenkov Mar 6, 2016
726f05c
Do not forget to schedule the drop for the argument
nagisa May 26, 2016
d875a95
Extend the test for `EscapeUnicode`
ranma42 May 26, 2016
42ee0f0
Fix stores codegen pass
nagisa May 26, 2016
9c84a11
Make Ipv4Addr cmp() faster
May 26, 2016
fc2b245
Fix overflow in type checking of tuple patterns
petrochenkov Mar 6, 2016
d74f410
Add and use `HasAttrs` trait
jseyfried May 18, 2016
f6a4ecf
Refactor the `syntax::config::fold_*` functions into methods
jseyfried May 15, 2016
a65b283
Introduce `CfgFolder` trait
jseyfried May 15, 2016
3d94823
Refactor `CfgFolder::in_cfg` -> `CfgFolder::configure`
jseyfried May 16, 2016
fab7d37
Implement `CfgFolder` directly instead of passing a closure to `strip…
jseyfried May 15, 2016
ae66cef
Move cfg_attr processing and stmt/expr attribute gated feature checki…
jseyfried May 16, 2016
a90206c
Process `cfg_attr` attributes on non-optional expressions
jseyfried May 26, 2016
a9bb074
Test that a feature gated cfg variable in a `cfg_attr` on an unconfig…
jseyfried May 18, 2016
8f6938f
Update spans' `expn_id` during the marking fold
jseyfried May 17, 2016
174dfac
Strip unconfigured items during macro expansion
jseyfried May 16, 2016
e415fe9
Refactor `expand_expr`
jseyfried May 26, 2016
82b0a57
rustfmt on liblog
srinivasreddy May 27, 2016
fa084aa
Test that unconfigured macro-expanded macro invocations are not expan…
jseyfried May 18, 2016
b08c570
Comment methods in `CfgFolder`
jseyfried May 24, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ To see a full list of options, run `./configure --help`.

Some common make targets are:

- `make tips` - show useful targets, variables and other tips for working with
the build system.
- `make rustc-stage1` - build up to (and including) the first stage. For most
cases we don't need to build the stage2 compiler, so we can save time by not
building it. The stage1 compiler is a fully functioning compiler and
Expand Down
11 changes: 11 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ opt debug-assertions 0 "build with debugging assertions"
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
opt local-rebuild 0 "use an installed rustc matching the current version, for rebuilds"
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
opt rpath 1 "build rpaths into rustc itself"
opt stage0-landing-pads 1 "enable landing pads during bootstrap with stage0"
Expand Down Expand Up @@ -847,6 +848,16 @@ then
BIN_SUF=.exe
fi

# --enable-local-rebuild implies --enable-local-rust too
if [ -n "$CFG_ENABLE_LOCAL_REBUILD" ]
then
if [ -z "$CFG_ENABLE_LOCAL_RUST" ]
then
CFG_ENABLE_LOCAL_RUST=1
putvar CFG_ENABLE_LOCAL_RUST
fi
fi

if [ -n "$CFG_ENABLE_LOCAL_RUST" ]
then
system_rustc=$(which rustc)
Expand Down
14 changes: 13 additions & 1 deletion mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
######################################################################

# The version number
CFG_RELEASE_NUM=1.10.0
CFG_RELEASE_NUM=1.11.0

# An optional number to put after the label, e.g. '.2' -> '-beta.2'
# NB Make sure it starts with a dot to conform to semver pre-release
Expand All @@ -34,7 +34,14 @@ CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(C
# intentionally not "secure" by any definition, this is largely just a deterrent
# from users enabling unstable features on the stable compiler.
CFG_BOOTSTRAP_KEY=$(CFG_FILENAME_EXTRA)

# The stage0 compiler needs to use the previous key recorded in src/stage0.txt,
# except for local-rebuild when it just uses the same current key.
ifdef CFG_ENABLE_LOCAL_REBUILD
CFG_BOOTSTRAP_KEY_STAGE0=$(CFG_BOOTSTRAP_KEY)
else
CFG_BOOTSTRAP_KEY_STAGE0=$(shell grep 'rustc_key' $(S)src/stage0.txt | sed 's/rustc_key: '//)
endif

ifeq ($(CFG_RELEASE_CHANNEL),stable)
# This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
Expand Down Expand Up @@ -526,6 +533,11 @@ ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
CFGFLAG$(1)_T_$(2)_H_$(3) = stage1

RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR1_T_$(2)_H_$$(CFG_BUILD))
else
ifdef CFG_ENABLE_LOCAL_REBUILD
# Assume the local-rebuild rustc already has stage1 features too.
CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
endif
endif
endif

Expand Down
14 changes: 10 additions & 4 deletions src/bootstrap/build/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ pub struct Config {
pub build: String,
pub host: Vec<String>,
pub target: Vec<String>,
pub rustc: Option<String>,
pub cargo: Option<String>,
pub rustc: Option<PathBuf>,
pub cargo: Option<PathBuf>,
pub local_rebuild: bool,

// libstd features
pub debug_jemalloc: bool,
Expand Down Expand Up @@ -207,8 +208,8 @@ impl Config {
config.target.push(target.clone());
}
}
config.rustc = build.rustc;
config.cargo = build.cargo;
config.rustc = build.rustc.map(PathBuf::from);
config.cargo = build.cargo.map(PathBuf::from);
set(&mut config.compiler_docs, build.compiler_docs);
set(&mut config.docs, build.docs);

Expand Down Expand Up @@ -315,6 +316,7 @@ impl Config {
("RPATH", self.rust_rpath),
("OPTIMIZE_TESTS", self.rust_optimize_tests),
("DEBUGINFO_TESTS", self.rust_debuginfo_tests),
("LOCAL_REBUILD", self.local_rebuild),
}

match key {
Expand Down Expand Up @@ -377,6 +379,10 @@ impl Config {
.or_insert(Target::default());
target.ndk = Some(PathBuf::from(value));
}
"CFG_LOCAL_RUST_ROOT" if value.len() > 0 => {
self.rustc = Some(PathBuf::from(value).join("bin/rustc"));
self.cargo = Some(PathBuf::from(value).join("bin/cargo"));
}
_ => {}
}
}
Expand Down
12 changes: 10 additions & 2 deletions src/bootstrap/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,14 @@ impl Build {
.arg("-j").arg(self.jobs().to_string())
.arg("--target").arg(target);

let stage;
if compiler.stage == 0 && self.config.local_rebuild {
// Assume the local-rebuild rustc already has stage1 features.
stage = 1;
} else {
stage = compiler.stage;
}

// Customize the compiler we're running. Specify the compiler to cargo
// as our shim and then pass it some various options used to configure
// how the actual compiler itself is called.
Expand All @@ -518,7 +526,7 @@ impl Build {
// src/bootstrap/{rustc,rustdoc.rs}
cargo.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
.env("RUSTC_REAL", self.compiler_path(compiler))
.env("RUSTC_STAGE", compiler.stage.to_string())
.env("RUSTC_STAGE", stage.to_string())
.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
.env("RUSTC_CODEGEN_UNITS",
self.config.rust_codegen_units.to_string())
Expand Down Expand Up @@ -744,7 +752,7 @@ impl Build {
// In stage0 we're using a previously released stable compiler, so we
// use the stage0 bootstrap key. Otherwise we use our own build's
// bootstrap key.
let bootstrap_key = if compiler.is_snapshot(self) {
let bootstrap_key = if compiler.is_snapshot(self) && !self.config.local_rebuild {
&self.bootstrap_key_stage0
} else {
&self.bootstrap_key
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/no-stdlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ which do not trigger a panic can be assured that this function is never
called. The second function, `panic_fmt`, is also used by the failure
mechanisms of the compiler.

[unwind]: https://github.com/rust-lang/rust/blob/master/src/libstd/sys/common/unwind/gcc.rs
[unwind]: https://github.com/rust-lang/rust/blob/master/src/libpanic_unwind/gcc.rs
2 changes: 0 additions & 2 deletions src/doc/book/primitive-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ You can use a combo of `&` and `[]` to create a slice from various things. The
detail later in this section. The `[]`s, with a range, let you define the
length of the slice:

[references]: references-and-borrowing.html

```rust
let a = [0, 1, 2, 3, 4];
let complete = &a[..]; // A slice containing all of the elements in a
Expand Down
2 changes: 2 additions & 0 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2433,6 +2433,8 @@ The currently implemented features of the reference compiler are:
* - `abi_vectorcall` - Allows the usage of the vectorcall calling convention
(e.g. `extern "vectorcall" func fn_();`)

* - `dotdot_in_tuple_patterns` - Allows `..` in tuple (struct) patterns.

If a feature is promoted to a language feature, then all existing programs will
start to receive compilation warnings about `#![feature]` directives which enabled
the new feature (because the directive is no longer necessary). However, if a
Expand Down
138 changes: 134 additions & 4 deletions src/etc/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

import fileinput, re, os, sys, operator

bytes_old = 0
bytes_new = 0

preamble = '''// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
Expand Down Expand Up @@ -307,12 +310,137 @@ def emit_table(f, name, t_data, t_type = "&'static [(char, char)]", is_pub=True,
format_table_content(f, data, 8)
f.write("\n ];\n\n")

def emit_trie_lookup_range_table(f):
f.write("""

// BoolTrie is a trie for representing a set of Unicode codepoints. It is
// implemented with postfix compression (sharing of identical child nodes),
// which gives both compact size and fast lookup.
//
// The space of Unicode codepoints is divided into 3 subareas, each
// represented by a trie with different depth. In the first (0..0x800), there
// is no trie structure at all; each u64 entry corresponds to a bitvector
// effectively holding 64 bool values.
//
// In the second (0x800..0x10000), each child of the root node represents a
// 64-wide subrange, but instead of storing the full 64-bit value of the leaf,
// the trie stores an 8-bit index into a shared table of leaf values. This
// exploits the fact that in reasonable sets, many such leaves can be shared.
//
// In the third (0x10000..0x110000), each child of the root node represents a
// 4096-wide subrange, and the trie stores an 8-bit index into a 64-byte slice
// of a child tree. Each of these 64 bytes represents an index into the table
// of shared 64-bit leaf values. This exploits the sparse structure in the
// non-BMP range of most Unicode sets.
pub struct BoolTrie {
// 0..0x800 (corresponding to 1 and 2 byte utf-8 sequences)
r1: [u64; 32], // leaves

// 0x800..0x10000 (corresponding to 3 byte utf-8 sequences)
r2: [u8; 992], // first level
r3: &'static [u64], // leaves

// 0x10000..0x110000 (corresponding to 4 byte utf-8 sequences)
r4: [u8; 256], // first level
r5: &'static [u8], // second level
r6: &'static [u64], // leaves
}

fn trie_range_leaf(c: usize, bitmap_chunk: u64) -> bool {
((bitmap_chunk >> (c & 63)) & 1) != 0
}

fn trie_lookup_range_table(c: char, r: &'static BoolTrie) -> bool {
let c = c as usize;
if c < 0x800 {
trie_range_leaf(c, r.r1[c >> 6])
} else if c < 0x10000 {
let child = r.r2[(c >> 6) - 0x20];
trie_range_leaf(c, r.r3[child as usize])
} else {
let child = r.r4[(c >> 12) - 0x10];
let leaf = r.r5[((child as usize) << 6) + ((c >> 6) & 0x3f)];
trie_range_leaf(c, r.r6[leaf as usize])
}
}\n
""")

def compute_trie(rawdata, chunksize):
root = []
childmap = {}
child_data = []
for i in range(len(rawdata) / chunksize):
data = rawdata[i * chunksize: (i + 1) * chunksize]
child = '|'.join(map(str, data))
if child not in childmap:
childmap[child] = len(childmap)
child_data.extend(data)
root.append(childmap[child])
return (root, child_data)

def emit_bool_trie(f, name, t_data, is_pub=True):
global bytes_old, bytes_new
bytes_old += 8 * len(t_data)
CHUNK = 64
rawdata = [False] * 0x110000;
for (lo, hi) in t_data:
for cp in range(lo, hi + 1):
rawdata[cp] = True

# convert to bitmap chunks of 64 bits each
chunks = []
for i in range(0x110000 / CHUNK):
chunk = 0
for j in range(64):
if rawdata[i * 64 + j]:
chunk |= 1 << j
chunks.append(chunk)

pub_string = ""
if is_pub:
pub_string = "pub "
f.write(" %sconst %s: &'static super::BoolTrie = &super::BoolTrie {\n" % (pub_string, name))
f.write(" r1: [\n")
data = ','.join('0x%016x' % chunk for chunk in chunks[0:0x800 / CHUNK])
format_table_content(f, data, 12)
f.write("\n ],\n")

# 0x800..0x10000 trie
(r2, r3) = compute_trie(chunks[0x800 / CHUNK : 0x10000 / CHUNK], 64 / CHUNK)
f.write(" r2: [\n")
data = ','.join(str(node) for node in r2)
format_table_content(f, data, 12)
f.write("\n ],\n")
f.write(" r3: &[\n")
data = ','.join('0x%016x' % chunk for chunk in r3)
format_table_content(f, data, 12)
f.write("\n ],\n")

# 0x10000..0x110000 trie
(mid, r6) = compute_trie(chunks[0x10000 / CHUNK : 0x110000 / CHUNK], 64 / CHUNK)
(r4, r5) = compute_trie(mid, 64)
f.write(" r4: [\n")
data = ','.join(str(node) for node in r4)
format_table_content(f, data, 12)
f.write("\n ],\n")
f.write(" r5: &[\n")
data = ','.join(str(node) for node in r5)
format_table_content(f, data, 12)
f.write("\n ],\n")
f.write(" r6: &[\n")
data = ','.join('0x%016x' % chunk for chunk in r6)
format_table_content(f, data, 12)
f.write("\n ],\n")

f.write(" };\n\n")
bytes_new += 256 + 992 + 256 + 8 * len(r3) + len(r5) + 8 * len(r6)

def emit_property_module(f, mod, tbl, emit):
f.write("pub mod %s {\n" % mod)
for cat in sorted(emit):
emit_table(f, "%s_table" % cat, tbl[cat])
emit_bool_trie(f, "%s_table" % cat, tbl[cat])
f.write(" pub fn %s(c: char) -> bool {\n" % cat)
f.write(" super::bsearch_range_table(c, %s_table)\n" % cat)
f.write(" super::trie_lookup_range_table(c, %s_table)\n" % cat)
f.write(" }\n\n")
f.write("}\n\n")

Expand Down Expand Up @@ -402,8 +530,9 @@ def emit_norm_module(f, canon, compat, combine, norm_props):
norm_props = load_properties("DerivedNormalizationProps.txt",
["Full_Composition_Exclusion"])

# bsearch_range_table is used in all the property modules below
emit_bsearch_range_table(rf)
# trie_lookup_table is used in all the property modules below
emit_trie_lookup_range_table(rf)
# emit_bsearch_range_table(rf)

# category tables
for (name, cat, pfuns) in ("general_category", gencats, ["N", "Cc"]), \
Expand All @@ -414,3 +543,4 @@ def emit_norm_module(f, canon, compat, combine, norm_props):
# normalizations and conversions module
emit_norm_module(rf, canon_decomp, compat_decomp, combines, norm_props)
emit_conversions_module(rf, to_upper, to_lower, to_title)
#print 'bytes before = %d, bytes after = %d' % (bytes_old, bytes_new)
Loading