Commit Graph

53897 Commits

Author SHA1 Message Date
Jeffrey Seyfried
6019816da8 Refactor away set_expn_info 2016-05-28 08:43:35 +00:00
Jeffrey Seyfried
074f4c2c91 Fix spans of generated #[derive_*] attributes 2016-05-28 08:43:34 +00:00
bors
f89c0c2f4b Auto merge of #33800 - nrc:save-fn-name, r=eddyb
save-analysis: use a function's short name
2016-05-27 20:45:46 -07:00
Jamey Sharp
80d733385a Inline simple Cursor write calls
Implementing the Write trait for Cursors over slices is so light-weight that under some circumstances multiple writes can be fused into a single instruction. In general I think inlining these functions is a good idea because most of the code can be constant-folded and copy-propagated away.

Closes issue #33916.
2016-05-27 19:34:20 -07:00
bors
8b012ed142 Auto merge of #33706 - jseyfried:refactor_cfg, r=nrc
Perform `cfg` attribute processing during macro expansion and fix bugs

This PR refactors `cfg` attribute processing and fixes bugs. More specifically:
 - It merges gated feature checking for stmt/expr attributes, `cfg_attr` processing, and `cfg` processing into a single fold.
  - This allows feature gated `cfg` variables to be used in `cfg_attr` on unconfigured items. All other feature gated attributes can already be used on unconfigured items.
 - It performs `cfg` attribute processing during macro expansion instead of after expansion so that macro-expanded items are configured the same as ordinary items. In particular, to match their non-expanded counterparts,
  - macro-expanded unconfigured macro invocations are no longer expanded,
  - macro-expanded unconfigured macro definitions are no longer usable, and
  - feature gated `cfg` variables on macro-expanded macro definitions/invocations are now errors.

This is a [breaking-change]. For example, the following would break:
```rust
macro_rules! m {
    () => {
        #[cfg(attr)]
        macro_rules! foo { () => {} }
        foo!(); // This will be an error

        macro_rules! bar { () => { fn f() {} } }
        #[cfg(attr)] bar!(); // This will no longer be expanded ...
        fn g() { f(); } // ... so that `f` will be unresolved.

        #[cfg(target_thread_local)] // This will be a gated feature error
        macro_rules! baz { () => {} }
    }
}

m!();
```

r? @nrc
2016-05-27 17:46:14 -07:00
Jeffrey Seyfried
53ab137841 Comment methods in CfgFolder 2016-05-27 23:57:02 +00:00
Jeffrey Seyfried
6b3edc2f89 Test that unconfigured macro-expanded macro invocations are not expanded. 2016-05-27 23:57:01 +00:00
Vadim Petrochenkov
216f5fba04 Separate bindings from other patterns in HIR 2016-05-28 00:54:29 +03:00
Ty Coghlan
feb0b27e41 Added examples/docs to split in str.rs
Added documentation clarifying the behavior of split when used with the empty string and contiguous separators.
2016-05-27 17:53:13 -04:00
bors
7bddce693c Auto merge of #33798 - locallycompact:lc/misleading-intentation, r=alexcrichton
Fix misleading intentation errors on gcc 6.0

Currently building with latest gcc results in the following error:

    compile: x86_64-unknown-linux-gnu/rt/miniz.o
    /home/lc/rust/src/rt/miniz.c: In function ‘tinfl_decompress’:
    /home/lc/rust/src/rt/miniz.c:578:9: error: this ‘for’ clause does not guard... [-Werror=misleading-indentation]
             for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8;
             ^~~
    /home/lc/rust/src/rt/miniz.c:578:47: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’
             for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8;
                                                   ^~~
    /home/lc/rust/src/rt/miniz.c: In function ‘tdefl_find_match’:
    /home/lc/rust/src/rt/miniz.c:1396:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
         if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break;
         ^~
    /home/lc/rust/src/rt/miniz.c:1396:23: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
         if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break;
                           ^

This patch stops this.
2016-05-27 14:49:10 -07:00
Srinivas Reddy Thatiparthy
3fd0e4c7f2 rustfmt liballoc folder 2016-05-28 02:25:16 +05:30
Guillaume Gomez
4fa84830f8 improve E0152 error explanation 2016-05-27 21:57:06 +02:00
Guillaume Gomez
c848ca1f8d Improve E0133 error explanation 2016-05-27 21:53:38 +02:00
Guillaume Gomez
360d7234c7 Improve E0138 error explanation 2016-05-27 21:47:59 +02:00
Guillaume Gomez
a1e240ccec Improve E0137 error explanatIon 2016-05-27 21:45:15 +02:00
Guillaume Gomez
a850d407b2 Improve E0132 error explanation 2016-05-27 21:29:07 +02:00
bors
17b6261cc4 Auto merge of #33795 - srinivasreddy:lib_coll_test, r=nrc
run rustfmt on libcollections test module
2016-05-27 11:51:53 -07:00
Michael Woerister
4f7ab0e16b Emit "no-frame-pointer-elim" attribute for closures, shims, and glue. 2016-05-27 13:54:43 -04:00
M Farkas-Dyck
db84fc1403 make core::str::next_code_point work on arbitrary iterator 2016-05-27 08:54:52 -08:00
bors
ab7c35fa0f Auto merge of #33900 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 10 pull requests

- Successful merges: #33753, #33815, #33829, #33858, #33865, #33866, #33870, #33874, #33891, #33898
- Failed merges:
2016-05-27 03:56:19 -07:00
flo-l
ef82f78ee9 save-temps was moved under the -C switch 2016-05-27 11:01:27 +02:00
Guillaume Gomez
2c4fd94636 Rollup merge of #33898 - srinivasreddy:rustfmt_liblog, r=Manishearth
rustfmt on liblog
2016-05-27 10:50:05 +02:00
Guillaume Gomez
ee0821a371 Rollup merge of #33891 - polachok:faster-ipv4-cmp, r=bluss
Make Ipv4Addr cmp() faster

Closes #33885
2016-05-27 10:50:05 +02:00
Guillaume Gomez
6636dcc2ca Rollup merge of #33874 - Byron:patch-1, r=alexcrichton
Add `make tips` as useful make target

By accident, I found the `make tips` target, which helped me to gain more insight on how to work with the system more quickly.
2016-05-27 10:50:05 +02:00
Guillaume Gomez
c04e838eb5 Rollup merge of #33870 - jseyfried:ice-issue-33569, r=pnkfelix
Fix ICE on parsing a bad metavariable in a macro definition

Fixes #33569, fixes #33728.
r? @pnkfelix
2016-05-27 10:50:04 +02:00
Guillaume Gomez
43b430ed35 Rollup merge of #33866 - GuillaumeGomez:err-codes, r=jonathandturner
Add new error code tests

r? @steveklabnik
2016-05-27 10:50:04 +02:00
Guillaume Gomez
4ffebe72bf Rollup merge of #33865 - GuillaumeGomez:E0084, r=jonathandturner
Improve E0084 error explanation

r? @Manishearth

cc @steveklabnik
2016-05-27 10:50:03 +02:00
Guillaume Gomez
caa732a725 Rollup merge of #33858 - liigo:patch-7, r=GuillaumeGomez
Point out the clone operation in summary line docs of `Vec::extend_from_slice`
2016-05-27 10:50:03 +02:00
Guillaume Gomez
98e768fa84 Rollup merge of #33829 - GuillaumeGomez:stability-css, r=steveklabnik
Fix invalid background color in stability elements

r? @steveklabnik
2016-05-27 10:50:03 +02:00
Guillaume Gomez
967c3880d8 Rollup merge of #33815 - carols10cents:trait-documentation-clarifications, r=steveklabnik
Trait documentation clarifications

Hi! I've felt a bit of friction lately in figuring out how to write custom implementations of the `derive`able traits, so I decided to add to the docs :)

The docs for `Copy` are already excellent-- clear, useful sections that I only reordered a bit-- they're now:

* General explanation
* When can my type be `Copy`?
* When can my type _not_ be `Copy`?
* When should my type be `Copy`?
* Derivable
* How can I implement `Copy`?

I didn't add all these sections for all the traits, but I did make sure all the derivable traits had a consistent "Derivable" section that explained what the derived implementation does and a "How can I implement" section that has an example.

Please check me for correctness-- I tried to do research to make sure I was saying accurate things but I'm still learning! ❤️ I'd also love suggestions on information to add that is still missing-- I think these traits are important and deserve to have awesome docs!
2016-05-27 10:50:03 +02:00
Guillaume Gomez
575149561e Rollup merge of #33753 - mmatyas:armtestfix, r=alexcrichton
Fix `asm-misplaced-option` on ARM/AArch64

This fixes rust-lang/rust#33737. Of course, since we don't run `make check` for ARM cross builds, you probably won't notice it.
2016-05-27 10:50:02 +02:00
bors
36d5dc7c9b Auto merge of #33864 - Manishearth:breaking-batch, r=Manishearth
Batch up libsyntax breaking changes

cc https://github.com/rust-lang/rust/issues/31645
2016-05-26 22:46:08 -07:00
Manish Goregaokar
63dfbdbc1b Rollup merge of #33839 - kamalmarhubi:codemape-get-filemap-option, r=nmatsakis
This is more idiomatic, putting the caller in charge of whether or not
to panic.
2016-05-27 10:02:45 +05:30
Manish Goregaokar
7905452f08 Rollup merge of #33644 - petrochenkov:selfast, r=nrc
The AST part of https://github.com/rust-lang/rust/pull/33505.
https://github.com/rust-lang/rust/pull/33505 isn't landed yet, so this PR is based on top of it.

r? @nrc

plugin-[breaking-change] cc #31645 @Manishearth
2016-05-27 09:57:11 +05:30
Manish Goregaokar
35785712cd Rollup merge of #33639 - petrochenkov:dotdot, r=nmatsakis
cc https://github.com/rust-lang/rust/issues/33627
r? @nikomatsakis

plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645 @Manishearth
2016-05-27 09:57:00 +05:30
Manish Goregaokar
a70880fea9 Rollup merge of #33351 - birkenfeld:loop-label-spans, r=pnkfelix
This makes the \"shadowing labels\" warning *not* print the entire loop as a span, but only the lifetime.

Also makes #31719 go away, but does not fix its root cause (the span of the expanded loop is still wonky, but not used anymore).
2016-05-27 09:56:47 +05:30
Srinivas Reddy Thatiparthy
38bbb60c8c rustfmt on liblog 2016-05-27 08:06:17 +05:30
Simonas Kazlauskas
f18118702f Rewrite variadic-ffi pass to use test helper
The sprintf used in this test previously isn’t available on some versions of MSVC.

Fixes #32305
2016-05-27 03:05:52 +03:00
Jeffrey Seyfried
0558df24af Refactor expand_expr 2016-05-27 00:01:04 +00:00
Jeffrey Seyfried
1aa34e0b5f Strip unconfigured items during macro expansion 2016-05-27 00:01:04 +00:00
Jeffrey Seyfried
25c733360b Update spans' expn_id during the marking fold 2016-05-27 00:01:04 +00:00
Jeffrey Seyfried
3636ce7875 Test that a feature gated cfg variable in a cfg_attr on an unconfigured item is allowed 2016-05-27 00:01:04 +00:00
Jeffrey Seyfried
15d5074a34 Process cfg_attr attributes on non-optional expressions 2016-05-27 00:01:04 +00:00
Jeffrey Seyfried
d3a0e1783c Move cfg_attr processing and stmt/expr attribute gated feature checking into StripUnconfigured 2016-05-26 23:54:05 +00:00
Jeffrey Seyfried
a306f85df9 Implement CfgFolder directly instead of passing a closure to strip_items 2016-05-26 23:23:11 +00:00
Jeffrey Seyfried
f3e80760e9 Refactor CfgFolder::in_cfg -> CfgFolder::configure 2016-05-26 23:23:09 +00:00
Jeffrey Seyfried
79854395ca Introduce CfgFolder trait 2016-05-26 23:23:07 +00:00
Jeffrey Seyfried
7a42e46eec Refactor the syntax::config::fold_* functions into methods 2016-05-26 23:23:06 +00:00
Jeffrey Seyfried
29c105964b Add and use HasAttrs trait 2016-05-26 23:23:01 +00:00
Guillaume Gomez
abe9961283 * Fix compile_fail tag (in some cases, it compiled whereas it wasn't expected to and was still considered 'ok')
* Fix error explanations tests/tags
2016-05-27 00:39:57 +02:00