Commit Graph

48462 Commits

Author SHA1 Message Date
bors
eb1d018c01 Auto merge of #25570 - oli-obk:const_indexing, r=nikomatsakis
This PR allows the constant evaluation of index operations on constant arrays and repeat expressions. This allows index expressions to appear in the expression path of the length expression of a repeat expression or an array type.

An example is

```rust
const ARR: [usize; 5] = [1, 2, 3, 4, 5];
const ARR2: [usize; ARR[1]] = [42, 99];
```

In most other locations llvm's const evaluator figures it out already. This is not specific to index expressions and could be remedied in the future.
2015-12-01 19:47:38 +00:00
bors
dfe88bf1e5 Auto merge of #29391 - DanielKeep:syntax-index, r=steveklabnik
* `const`: Add reference to raw pointers
* Change `expr!(...)` etc. examples to use `ident` instead.
  *Technically*, it should be `pat`, but that's not how it works in
  practice.
* `|`: add reference to closure syntax.
* Closure syntax entry.
* Indexing and slicing entries.
* Add history of obsolete and deprecated syntax.

r? @steveklabnik
2015-12-01 17:59:42 +00:00
bors
ed121aa897 Auto merge of #30124 - steveklabnik:doc_string_errors, r=alexcrichton
Part of #29376
2015-12-01 16:09:33 +00:00
Steve Klabnik
546e8f9ff4 Document the Error types in std::string
Part of #29376
2015-12-01 09:59:00 -05:00
bors
4dda364ab3 Auto merge of #30135 - michaelwoerister:interning-checks, r=sanxiyn
This PR adds some safety checks to interning things in `ty::ctxt`. Accidentally re-interning an `AdtDef` has bitten me in the behind just last week (it messes up things in very subtle way only showing up later as an LLVM assertion).

Initially I had also added a check to `ty::ctxt::node_type_insert()` -- but there it seems to be expected that the same table slot is written to multiple times.

Roll-up candidate.
2015-12-01 13:19:41 +00:00
Michael Woerister
f6a1db6199 Add some consistency checks for value interning in ty::ctxt. 2015-12-01 09:50:07 +01:00
Daniel Keep
a34274c8ea trpl: additions & fixes for syntax index.
* `const`: Add reference to raw pointers
* Change `expr!(...)` etc. examples to use `ident` instead.
  *Technically*, it should be `pat`, but that's not how it works in
  practice.
* `|`: add reference to closure syntax.
* Closure syntax entry.
* Indexing and slicing entries.
2015-12-01 19:39:52 +11:00
bors
0bfdedb010 Auto merge of #30118 - alexcrichton:fix-time-again, r=aturon
I believe that because Windows' unit of resolution is 100ns that this unit of
time will ensure that the assertions will hold true as it's representable in the
native format.

cc #29970
2015-12-01 07:40:41 +00:00
bors
c212c0e1d1 Auto merge of #30116 - petrochenkov:exhaust, r=alexcrichton
Fixes https://github.com/rust-lang/rust/pull/29383#issuecomment-160652130

r? @bluss
2015-12-01 05:55:04 +00:00
bors
baf020802f Auto merge of #30057 - steveklabnik:doc_str, r=alexcrichton
Part of #29338
2015-12-01 03:37:58 +00:00
bors
407e8b3aac Auto merge of #30126 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #30108, #30114, #30115, #30119, #30120, #30122
- Failed merges:
2015-12-01 01:05:58 +00:00
bors
a2866e387e Auto merge of #30121 - steveklabnik:fix_trpl_tests, r=alexcrichton
In #29932, I moved the location of TRPL, but I missed making the changes
in mk/tests.mk. This led to #30088 landing with a broken example.

As such, #30113 will need to land before this.
2015-11-30 23:12:14 +00:00
Steve Klabnik
06df5d8042 Rollup merge of #30122 - steveklabnik:last_trpl_fix, r=Manishearth
Along with https://github.com/rust-lang/rust/pull/30121, this should fix the last fallout from https://github.com/rust-lang/rust/pull/29932
2015-11-30 18:02:22 -05:00
Steve Klabnik
9437caff55 Rollup merge of #30120 - steveklabnik:doc_string_parse_error, r=alexcrichton
Part of #29376
2015-11-30 18:02:22 -05:00
Steve Klabnik
06419880a8 Rollup merge of #30119 - steveklabnik:doc_to_string, r=alexcrichton
Part of #29376
2015-11-30 18:02:22 -05:00
Steve Klabnik
30221eaedf Rollup merge of #30115 - nilcons-contrib:fix-book-stack, r=steveklabnik
The `f` argument will reference the actual value in the `d` box, not the box in the `bar`'s stack frame.

I am just learning Rust, so I don't know how to explain this well, but just from `f`'s type it is clear that it will be a pointer to an `i32`, not a pointer to a pointer. Some `println!("{:p}", ...)`'s can easily confirm this.

I would actually suggest to remove/simplify this part of the example. This is a subtle issue that can easily confuse people at the early stages of familiarizing with the language. (As I got confused by it. :))
2015-11-30 18:02:21 -05:00
Steve Klabnik
5000bd25d9 Rollup merge of #30114 - sourcefrog:doc-casts2, r=Manishearth 2015-11-30 18:02:21 -05:00
Steve Klabnik
e4ab0398ff Rollup merge of #30108 - bhargavrpatel:master, r=steveklabnik 2015-11-30 18:02:21 -05:00
Steve Klabnik
23fb9743d3 Document std::string::ParseError
Part of #29376
2015-11-30 16:21:03 -05:00
bors
7269f0e9f3 Auto merge of #30080 - durka:patch-10, r=alexcrichton
Fixes #30073. The input to `cfg!` is a meta attribute, but not _any_ meta attribute (e.g. `cfg!(allow(dead_code))` doesn't compile). But the macro_rules syntax can't quite express this, so I added a note to the doc.
2015-11-30 21:15:56 +00:00
Steve Klabnik
7b30f5c256 Better docs for the str primitive
Part of #29338
2015-11-30 16:10:47 -05:00
Steve Klabnik
4bdb60cc34 Fix path to TRPL in doc README 2015-11-30 15:00:30 -05:00
Steve Klabnik
1a2d1b8d36 Re-enable testing the book
In #29932, I moved the location of TRPL, but I missed making the changes
in mk/tests.mk. This led to #30088 landing with a broken example.

As such, #30113 will need to land before this.
2015-11-30 14:55:26 -05:00
Steve Klabnik
a9b6975c87 Write some docs for ToString
Part of #29376
2015-11-30 14:36:03 -05:00
Alex Crichton
903444015c std: Bump time margin in std::time tests
I believe that because Windows' unit of resolution is 100ns that this unit of
time will ensure that the assertions will hold true as it's representable in the
native format.

cc #29970
2015-11-30 10:53:20 -08:00
bors
7fa4d998df Auto merge of #30113 - sourcefrog:doc-casts, r=steveklabnik
Sorry, thanks to @Ms2ger for pointing this out in https://github.com/rust-lang/rust/pull/30088#discussion_r46142903
2015-11-30 18:41:18 +00:00
Martin Pool
b00b32cdaa Correct grammar
Thanks @Manishearth
2015-11-30 10:16:36 -08:00
Vadim Petrochenkov
23c7e66589 Fix regression in patterns with empty variants 2015-11-30 19:56:19 +03:00
Martin Pool
f183d7a26e Additional text and examples around casting 2015-11-30 08:02:18 -08:00
Mihaly Barasz
7728742a44 Fix pointer value in the 'complex example'
The `f` argument will reference the actual value in the `d` box, not the
box in the `bar`'s stack frame.
2015-11-30 16:51:38 +01:00
Martin Pool
4a63d9fa2c Remove broken explicit coercion example 2015-11-30 07:42:14 -08:00
bors
8bc43ed59d Auto merge of #29929 - michaelwoerister:mir-repr-to-librustc, r=nikomatsakis
This is done mostly so that we can refer to MIR types in csearch and other metadata related area.

Heads up, @rust-lang/compiler!

r? @nikomatsakis
2015-11-30 14:18:28 +00:00
bors
fd2626cc3f Auto merge of #30111 - GuillaumeGomez:patch-3, r=Manishearth
r? @Manishearth

cc @huonw
2015-11-30 10:19:49 +00:00
Guillaume Gomez
1099af732d Reword E0492 2015-11-30 11:13:37 +01:00
Michael Woerister
f28a4e93b4 Also move the MIR visitor to librustc. 2015-11-30 10:03:33 +01:00
Michael Woerister
bbe1d28496 Move the core MIR datastructures to librustc.
This is done mostly so that we can refer to MIR types in csearch and other metadata related area.
2015-11-30 10:03:33 +01:00
Alex Burka
f18bfb3168 tweak cfg! doc comment 2015-11-29 22:53:19 -05:00
Bhargav Patel
968adb287a Merge pull request #1 from bhargavrpatel/master-stack-heap-verbiage-change
Change verbiage in Stack & Heap page
2015-11-29 22:18:34 -05:00
Bhargav Patel
7a93a3a821 Change verbiage in Stack & Heap page
Made a small change in the sentence. It seemed confusing to read the word "actual" twice in the sentence; I removed it completely.
2015-11-29 22:18:13 -05:00
bors
52d95e6448 Auto merge of #30101 - istankovic:fix-typos, r=steveklabnik
Fix some typos in the docs for Peekable.

r? @steveklabnik
2015-11-30 00:41:13 +00:00
bors
b22d7a5d2f Auto merge of #29976 - GuillaumeGomez:patch-5, r=Manishearth
r? @Manishearth
2015-11-29 22:54:43 +00:00
bors
15ad1d199b Auto merge of #30088 - sourcefrog:doc-casts, r=steveklabnik
Based on the description in 219eca11b0/src/librustc_typeck/check/cast.rs (L11) and https://doc.rust-lang.org/nightly/nomicon/casts.html
2015-11-29 21:10:36 +00:00
Martin Pool
797d5433c9 Rephrased description of casting 2015-11-29 12:00:07 -08:00
Martin Pool
34e6995aa3 Add information about numeric casts, from the nomicon 2015-11-29 11:54:29 -08:00
bors
4867df4a23 Auto merge of #30100 - jFransham:patch-1, r=steveklabnik
Fixes #30093 in the most trivial possible way.
2015-11-29 18:13:17 +00:00
bors
3db9bee903 Auto merge of #30059 - androm3da:master, r=bluss 2015-11-29 16:30:15 +00:00
Ivan Stankovic
0cd923ee06 libcore/iter: fix typos 2015-11-29 14:52:29 +01:00
Jack Fransham
6a56147a86 Fix #30093 2015-11-29 13:36:01 +00:00
bors
323781cdf7 Auto merge of #30075 - kyeah:mac-span, r=sanxiyn
Fixes #28424 (item macros), #30067 (impl item macros), and pattern macros.
2015-11-29 06:00:05 +00:00
Kevin Yeh
920120ed4c Use last_span for macro spans 2015-11-28 23:54:54 -06:00