Commit Graph

54781 Commits

Author SHA1 Message Date
Jeffrey Seyfried
4e74c181a4 Make ext::base::expr_to_string work correctly with include! macro invocations 2016-07-14 10:27:18 +00:00
bors
db71987ee1 Auto merge of #33642 - xen0n:ergonomic-format-macro, r=alexcrichton
Ergonomic format_args!

Fixes #9456 (at last).

Not a ground-up rewrite of the existing machinery, but more like an added intermediary layer between macro arguments and format placeholders. This is now implementing Rust RFC 1618!
2016-07-13 13:26:57 -07:00
Wang Xuerui
51e54e57a4
syntax_ext: format: better code documentation 2016-07-14 03:10:47 +08:00
Wang Xuerui
03563b12e8
format: add tests for ergonomic format_args!
format: workaround pretty-printer to pass tests
2016-07-14 03:10:46 +08:00
Wang Xuerui
718099435b
syntax_ext: format: de-duplicate argument objects 2016-07-14 03:10:46 +08:00
Wang Xuerui
f457e6c3e0
syntax_ext: format: process counts uniquely and separately 2016-07-14 03:10:46 +08:00
Wang Xuerui
5e55a44116
syntax_ext: format: allow multiple formats for one argument
This commit removed the restriction of only allowing one type per argument.
This is achieved by adding mappings between macro arguments and format
placeholders, then taking the mapping into consideration when emitting
the Arguments expression.

syntax_ext: format: fix implicit positional arguments

syntax_ext: format: don't panic if no args given for implicit positional args

Check the list lengths before use.
Fixes regression of `compile-fail/macro-backtrace-println.rs`.

syntax_ext: format: also map CountIsParam indices to expanded args

syntax_ext: format: fix ICE in case of malformed format args
2016-07-14 03:10:45 +08:00
Wang Xuerui
eb5417bf12
syntax_ext: format: rename variants of ArgumentType for clarity 2016-07-14 03:10:45 +08:00
Wang Xuerui
1ace7f0d49
syntax_ext: format: resolve named arguments early
Converts named argument references into indices, right after
verification as suggested by @alexcrichton. This drastically simplifies
the whole process!
2016-07-14 03:10:44 +08:00
Wang Xuerui
0e2a96321a
syntax_ext: format: separate verification and translation of pieces 2016-07-14 02:55:33 +08:00
Wang Xuerui
06b034ae8b
format: remove all implicit ref handling outside of libfmt_macros
format: beautifully get rid of ArgumentNext and CountIsNextParam

Now that CountIsNextParam and ArgumentNext are resolved during parse,
the need for handling them outside of libfmt_macros is obviated.

Note: *one* instance of implicit reference handling still remains, and
that's for implementing `all_args_simple`. It's trivial enough though,
so in this case it may be tolerable.
2016-07-14 02:54:47 +08:00
Wang Xuerui
71949f3b0d
libfmt_macros: resolve all implicit refs while parsing 2016-07-14 02:44:55 +08:00
bors
0b7fb80e1c Auto merge of #34772 - jseyfried:cleanup_interner, r=eddyb
Start cleaning up the string interner

r? @eddyb
2016-07-13 10:26:18 -07:00
bors
4a12a70a5c Auto merge of #34752 - ollie27:rustdoc_search, r=GuillaumeGomez
rustdoc: Fix methods in seach results

Currently methods from extern crates are sometimes added to the search
index when they shouldn't be or added with the original path rather than
the reexported path. This fixes that by making sure `cache().paths` only
contains local paths like the description for it states. It also fixes a
few minor issues with link rendering and redirect generation which would
point to local crate docs even if the docs for that crate hadn't been
generated.

Also a bug with methods implemented on traits which caused wrong paths and
so dead links in the search results has been fixed.

For example:
[before](https://doc.rust-lang.org/nightly/std/?search=is_disjoint) [after](https://ollie27.github.io/rust_doc_test/std/?search=is_disjoint)
[before](https://doc.rust-lang.org/nightly/std/?search=map_or) [after](https://ollie27.github.io/rust_doc_test/std/?search=map_or)
[before](https://doc.rust-lang.org/nightly/std/?search=unsafecell%3A%3Anew) [after](https://ollie27.github.io/rust_doc_test/std/?search=unsafecell%3A%3Anew)
[before](https://doc.rust-lang.org/nightly/std/?search=rng%3A%3Agen_) [after](https://ollie27.github.io/rust_doc_test/std/?search=rng%3A%3Agen_)
[before](https://doc.rust-lang.org/nightly/std/?search=downcast_ref) [after](https://ollie27.github.io/rust_doc_test/std/?search=downcast_ref)

Fixes #20246
2016-07-13 07:27:43 -07:00
bors
362b665bb2 Auto merge of #34608 - apasel422:ll, r=bluss
Replace `LinkedList`'s use of `Box` with `Shared`

Closes #34417
2016-07-13 04:31:30 -07:00
bors
2ab18ce6f7 Auto merge of #34660 - jseyfried:fix_parse_stmt, r=nrc
Fix bugs in macro-expanded statement parsing

Fixes #34543.

This is a [breaking-change]. For example, the following would break:
```rust
macro_rules! m { () => {
    println!("") println!("")
    //^ Semicolons are now required on macro-expanded non-braced macro invocations
    //| in statement positions.
    let x = 0
    //^ Semicolons are now required on macro-expanded `let` statements
    //| that are followed by more statements, so this would break.
    let y = 0 //< (this would still be allowed to reduce breakage in the wild)
}
fn main() { m!() }
```

r? @eddyb
2016-07-13 01:37:07 -07:00
bors
617039bff0 Auto merge of #34756 - habnabit:mutex-refunwindsafe, r=alexcrichton
Mutex and RwLock need RefUnwindSafe too

Incomplete, because I don't know what the appropriate stability annotation is here, but this is an attempt to bring the documentation for `std::panic` in line with reality. Right now, it says:

>Types like `&Mutex<T>`, however, are unwind safe because they implement poisoning by default.

But only `Mutex<T>`, not `&Mutex<T>`, is unwind-safe.
2016-07-12 22:43:31 -07:00
Jeffrey Seyfried
57fac56cb5 Start a best-effort warning cycle. 2016-07-13 04:50:35 +00:00
Jeffrey Seyfried
c1b850d304 cleanup: Refactor parser method finish_parsing_statement -> parse_full_stmt. 2016-07-13 04:49:32 +00:00
Jeffrey Seyfried
759b8a8e7d Allow macro-expanded macros in trailing expression positions to expand into statements:
```rust
macro_rules! m { () => { let x = 1; x } }
macro_rules! n { () => {
    m!() //< This can now expand into statements
}}
fn main() { n!(); }
```

and revert needless fallout fixes.
2016-07-13 04:49:32 +00:00
Jeffrey Seyfried
52d485fe0d Fix bug in the pretty printer. 2016-07-13 04:49:32 +00:00
bors
4bbb1c5c99 Auto merge of #34739 - therealbstern:ipv4unspec, r=alexcrichton
Mark Ipv4Addr is_unspecified as stable and provide reference.

Per [#27709 (comment)](https://github.com/rust-lang/rust/issues/27709#issuecomment-231280999), no RFC is needed here.

IPv4 "unspecified" has been defined in [Stevens], and has been part of the IPv4 stack for quite some time.  This property should become stable, since this use of 0.0.0.0 is not going anywhere.

[Stevens][_UNIX Network Programming Volume 1, Second Edition_.  Stevens, W. Richard.  Prentice-Hall, 1998.  p. 891]

Please let me know if I got the rustdoc wrong or something.  I tried to be as terse as possible while still conveying the appropriate information.

This also has a slight impact on PR #34694, but that one came first, so this shouldn't block it, IMO.
2016-07-12 19:11:02 -07:00
bors
26fd0117f9 Auto merge of #34705 - alexcrichton:clean-deprecated, r=brson
std: Clean out deprecated APIs

This primarily removes a lot of `sync::Static*` APIs and rejiggers the
associated implementations. While doing this it was discovered that the
`is_poisoned` method can actually result in a data race for the Mutex/RwLock
primitives, so the inner `Cell<bool>` was changed to an `AtomicBool` to prevent
the associated data race. Otherwise the usage/gurantees should be the same
they were before.
2016-07-12 15:15:56 -07:00
Alex Crichton
a7220d9046 std: Clean out deprecated APIs
This primarily removes a lot of `sync::Static*` APIs and rejiggers the
associated implementations. While doing this it was discovered that the
`is_poisoned` method can actually result in a data race for the Mutex/RwLock
primitives, so the inner `Cell<bool>` was changed to an `AtomicBool` to prevent
the associated data race. Otherwise the usage/gurantees should be the same
they were before.
2016-07-12 12:51:13 -07:00
bors
3085ec7848 Auto merge of #34757 - sourcefrog:debug-filetype, r=alexcrichton
Derive Debug on FileType.

Partially fixes #32054
2016-07-12 06:54:46 -07:00
Oliver Middleton
b905464668 rustdoc: Fix methods in seach results
Currently methods from extern crates are sometimes added to the search
index when they shouldn't be or added with the original path rather than
the reexported path. This fixes that by making sure `cache().paths` only
contains local paths like the description for it states. It also fixes a
few minor issues with link rendering and redirect generation which would
point to local crate docs even if the docs for that crate hadn't been
generated.

Also a bug with methods implemented on traits which caused wrong paths and
so dead links in the search results has been fixed.
2016-07-12 12:58:06 +01:00
bors
31e9ed5d6c Auto merge of #34778 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

- Successful merges: #34736, #34737, #34740, #34742, #34749, #34750, #34770
- Failed merges: #33951
2016-07-12 03:58:33 -07:00
Guillaume Gomez
23d5f5652c Rollup merge of #34770 - davidko:patch-1, r=steveklabnik
Fixed some typos

I believe these are typos?
2016-07-12 12:08:24 +02:00
Guillaume Gomez
1958e39cca Rollup merge of #34750 - GuillaumeGomez:error_doc, r=steveklabnik
Add examples for std::Error module

Fixes #29352.

r? @steveklabnik
2016-07-12 12:08:24 +02:00
Guillaume Gomez
ea6cb8744a Rollup merge of #34749 - GuillaumeGomez:any_doc, r=steveklabnik
Improve std::any module doc

Fixes #29340.

r? @steveklabnik
2016-07-12 12:08:23 +02:00
Guillaume Gomez
e2e4b82356 Rollup merge of #34742 - abhijeetbhagat:master, r=steveklabnik
Update on struct expressions

Update doc for struct expressions (#32769)
2016-07-12 12:08:23 +02:00
Guillaume Gomez
f02754a2b2 Rollup merge of #34740 - GuillaumeGomez:boxed_doc, r=steveklabnik
Improve boxed docs

Fixes #29343.

r? @steveklabnik
2016-07-12 12:08:23 +02:00
Guillaume Gomez
a94e4c0f10 Rollup merge of #34737 - frewsxcv:libstd-process-child, r=GuillaumeGomez
Various `std::process` doc improvements.

None
2016-07-12 12:08:23 +02:00
Guillaume Gomez
9f4d2b6cd9 Rollup merge of #34736 - GuillaumeGomez:cells_doc, r=steveklabnik
Add missing examples for std::cell types

Fixes #29344.

r? @steveklabnik
2016-07-12 12:08:22 +02:00
bors
5c69a4f619 Auto merge of #34755 - jonas-schievink:minor-differences, r=eddyb
Move variant_size_differences out of trans

Also enhances the error message a bit, fixes #30505 on the way, and adds
a test (which was missing).

Closes #34018
2016-07-12 01:06:34 -07:00
bors
2539c15b49 Auto merge of #34637 - GuillaumeGomez:syntax_codes, r=jonathandturner
Syntax codes

r? @jonathandturner

cc @steveklabnik

This is a first big shot. I'll do the second one later in the week once this one is merged.
2016-07-11 22:09:44 -07:00
Jeffrey Seyfried
337236870d Fix fallout. 2016-07-12 04:31:40 +00:00
Jeffrey Seyfried
57c56dd7e0 Parse macro-expanded statements like ordinary statements. 2016-07-12 04:31:39 +00:00
Jeffrey Seyfried
6189e6cdba Clean up statement parsing without changing the semantics of parse_stmt. 2016-07-12 04:31:13 +00:00
Ben Stern
cd487db63f Mark Ipv4Addr is_unspecified as stable and provide reference. 2016-07-11 23:47:45 -04:00
bors
3265bd54b5 Auto merge of #33971 - bltavares:28322/default-channel-to-stable-on-tarball, r=brson
Use --release-channel=stable by default on releases

> Release tarballs should be compilable with just basic ./configure ;
> make ; sudo make install without having to pass special flags to
> configure. This is the case of the --release-channel option, that must
> be changed in the releases.

This commit detects the presence of .git, as it happens on other parts
of `configure` to assume it is a tarball. Then it changes the default
value stored, before parsing the arguments, while still allowing it to
be overriden before any action verifying the flag is done.

Closes #28322
2016-07-11 17:27:31 -07:00
Jeffrey Seyfried
060b5c5ef2 Factor the RefCell out of the Interner. 2016-07-11 22:25:08 +00:00
Jeffrey Seyfried
752d4419a0 Refactor get_ident_interner -> with_ident_interner. 2016-07-11 22:25:04 +00:00
Jeffrey Seyfried
70e2845230 Avoid passing around the thread-local interner in librustc_metadata. 2016-07-11 22:23:35 +00:00
Jeffrey Seyfried
1eb6d0b485 Remove Interner<T> and rename StrInterner to Interner. 2016-07-11 22:16:00 +00:00
Jeffrey Seyfried
f8a934e971 Encapsulate RcStr in syntax::util::interner. 2016-07-11 22:15:58 +00:00
Jeffrey Seyfried
6d5f85996e Remove unused field interner from the parser. 2016-07-11 22:15:56 +00:00
David
81386cf277 Fixed some typos 2016-07-11 14:43:56 -07:00
Guillaume Gomez
b777f145e6 Move E0533 to E0558 (because of external change) 2016-07-11 23:27:27 +02:00
ggomez
937f072cb4 Fix typos 2016-07-11 23:24:49 +02:00