Commit graph

69285 commits

Author SHA1 Message Date
bors
b55d290956 Auto merge of #45759 - alexcrichton:update-openssl, r=sfackler
rustbuild: Update the OpenSSL version to link

This updates the OpenSSL tarball download to reflect OpenSSL's newest release.
2017-11-05 14:18:21 +00:00
bors
94ede93467 Auto merge of #44042 - LukasKalbertodt:ascii-methods-on-instrinsics, r=alexcrichton
Copy all `AsciiExt` methods to the primitive types directly in order to deprecate it later

**EDIT:** [this PR is ready now](https://github.com/rust-lang/rust/pull/44042#issuecomment-333883548). I edited this post to reflect the current status of discussion, which is (apart from code review) pretty much settled.

---

This is my current progress in order to prepare stabilization of #39658. As discussed there (and in #39659), the idea is to deprecated `AsciiExt` and copy all methods to the type directly. Apparently there isn't really a reason to have those methods in an extension trait¹.

~~This is **work in progress**: copy&pasting code while slightly modifying the documentation isn't the most exciting thing to do. Therefore I wanted to already open this WIP PR after doing basically 1/4 of the job (copying methods to `&[u8]`, `char` and `&str` is still missing) to get some feedback before I continue. Some questions possibly worth discussing:~~

1. ~~Does everyone agree that deprecating `AsciiExt` is a good idea? Does everyone agree with the goal of this PR?~~ => apparently yes
2. ~~Are my changes OK so far? Did I do something wrong?~~
3. ~~The issue of the unstable-attribute is currently set to 0. I would wait until you say "Ok" to the whole thing, then create a tracking issue and then insert the correct issue id. Is that ok?~~
4. ~~I tweaked `eq_ignore_ascii_case()`: it now takes the argument `other: u8` instead of `other: &u8`. The latter was enforced by the trait. Since we're not bound to a trait anymore, we can drop the reference, ok?~~ => I reverted this, because the interface has to match the `AsciiExt` interface exactly.

¹ ~~Could it be that we can't write `impl [u8] {}`? This might be the reason for `AsciiExt`. If that is the case: is there a good reason we can't write such an impl block? What can we do instead?~~ => we couldn't at the time this PR was opened, but Simon made it possible.

/cc @SimonSapin @zackw
2017-11-05 11:42:59 +00:00
Lukas Kalbertodt
ea55596d5b Relax #[deny(warnings)] in some crate for cargotest
Otherwise changes to the compiler are unable to introduce new
warnings: some crates tested by cargotest deny all warnings and
thus, the CI build fails.

Thanks SimonSapin for the patch!
2017-11-05 10:40:06 +01:00
bors
4efcc660f0 Auto merge of #45754 - scottmcm:checked-npot, r=dtolnay
Fix #18604: next_power_of_two should panic on overflow

Fixes https://github.com/rust-lang/rust/issues/18604

Is it possible to write a test for this?  My experiments showed `x.py test` running in release mode, so my attempt at a `#[should_panic]` didn't work.
2017-11-05 09:11:45 +00:00
bors
16e9b9f15c Auto merge of #45748 - petrochenkov:short, r=alexcrichton
Shorten paths to auxiliary files created by tests

I'm hitting issues with long file paths to object files created by the test suite, similar to https://github.com/rust-lang/rust/issues/45103#issuecomment-335622075.

If we look at the object file path in https://github.com/rust-lang/rust/issues/45103 we can see that the patch contains of few components:
```
specialization-cross-crate-defaults.stage2-x86_64-pc-windows-gnu.run-pass.libaux\specialization_cross_crate_defaults.specialization_cross_crate_defaults0.rust-cgu.o
```
=>

1. specialization-cross-crate-defaults // test name, required
2. stage2 // stage disambiguator, required
3. x86_64-pc-windows-gnu // target disambiguator, required
4. run-pass // mode disambiguator, rarely required
5. libaux // suffix, can be shortened
6. specialization_cross_crate_defaults // required, there may be several libraries in the directory
7. specialization_cross_crate_defaults0 // codegen unit name, can be shortened?
8. rust-cgu // suffix, can be shortened?
9. o // object file extension

This patch addresses items `4`, `5` and `8`.
`libaux` is shortened to `aux`, `rust-cgu` is shortened to `rcgu`, mode disambiguator is omitted unless it's necessary (for pretty-printing and debuginfo tests, see 38d26d811a)

I haven't touched names of codegen units though (`specialization_cross_crate_defaults0`).
Is it useful for them to have descriptive names including the crate name, as opposed to just `0` or `cgu0` or something?
2017-11-05 06:42:17 +00:00
bors
44183f50bc Auto merge of #45710 - alexcrichton:std-symbols, r=michaelwoerister
rustc: Handle some libstd symbole exports better

Right now symbol exports, particularly in a cdylib, are handled by
assuming that `pub extern` combined with `#[no_mangle]` means "export
this". This isn't actually what we want for some symbols that the
standard library uses to implement itself, for example symbols related
to allocation. Additionally other special symbols like
`rust_eh_personallity` have no need to be exported from cdylib crate
types (only needed in dylib crate types).

This commit updates how rustc handles these special symbols by adding to
the hardcoded logic of symbols like `rust_eh_personallity` but also
adding a new attribute, `#[rustc_std_internal_symbol]`, which forces the
export level to be considered the same as all other Rust functions
instead of looking like a C function.

The eventual goal here is to prevent functions like `__rdl_alloc` from
showing up as part of a Rust cdylib as it's just an internal
implementation detail. This then further allows such symbols to get gc'd
by the linker when creating a cdylib.
2017-11-05 04:02:07 +00:00
Alex Crichton
fbf9869702 rustc: Handle some libstd symbole exports better
Right now symbol exports, particularly in a cdylib, are handled by
assuming that `pub extern` combined with `#[no_mangle]` means "export
this". This isn't actually what we want for some symbols that the
standard library uses to implement itself, for example symbols related
to allocation. Additionally other special symbols like
`rust_eh_personallity` have no need to be exported from cdylib crate
types (only needed in dylib crate types).

This commit updates how rustc handles these special symbols by adding to
the hardcoded logic of symbols like `rust_eh_personallity` but also
adding a new attribute, `#[rustc_std_internal_symbol]`, which forces the
export level to be considered the same as all other Rust functions
instead of looking like a C function.

The eventual goal here is to prevent functions like `__rdl_alloc` from
showing up as part of a Rust cdylib as it's just an internal
implementation detail. This then further allows such symbols to get gc'd
by the linker when creating a cdylib.
2017-11-04 20:01:11 -07:00
Scott McMurray
0d745af29a Use Add::add for overflow checks instead of [rustc_inherit_overflow_checks] 2017-11-04 17:10:51 -07:00
bors
12e6b53744 Auto merge of #45711 - tirr-c:unicode-span, r=estebank
Display spans correctly when there are zero-width or wide characters

Hopefully...
* fixes #45211
* fixes #8706

---

Before:
```
error: invalid width `7` for integer literal
  --> unicode_2.rs:12:25
   |
12 |     let _ = ("a̐éö̲", 0u7);
   |                         ^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: invalid width `42` for integer literal
  --> unicode_2.rs:13:20
   |
13 |     let _ = ("아あ", 1i42);
   |                    ^^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: aborting due to 2 previous errors
```

After:
```
error: invalid width `7` for integer literal
  --> unicode_2.rs:12:25
   |
12 |     let _ = ("a̐éö̲", 0u7);
   |                     ^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: invalid width `42` for integer literal
  --> unicode_2.rs:13:20
   |
13 |     let _ = ("아あ", 1i42);
   |                      ^^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: aborting due to 2 previous errors
```

Spans might display incorrectly on the browser.

r? @estebank
2017-11-04 23:09:19 +00:00
Lukas Kalbertodt
deb7360fa7 Remove import of now unused AsciiExt
I also replaced a wildcard import with a specific one, while I was
at it.
2017-11-04 19:16:03 +01:00
bors
d762b1d6c6 Auto merge of #45394 - davidtwco:rfc-2008, r=petrochenkov
RFC 2008: Future-proofing enums/structs with #[non_exhaustive] attribute

This work-in-progress pull request contains my changes to implement [RFC 2008](https://github.com/rust-lang/rfcs/pull/2008). The related tracking issue is #44109.

As of writing, enum-related functionality is not included and there are some issues related to tuple/unit structs. Enum related tests are currently ignored.

WIP PR requested by @nikomatsakis [in Gitter](https://gitter.im/rust-impl-period/WG-compiler-middle?at=59e90e6297cedeb0482ade3e).
2017-11-04 18:07:07 +00:00
David Wood
86c62d02ee
Ignoring pretty print for test due to #37199 2017-11-04 18:01:35 +00:00
bors
98e4b6845f Auto merge of #45709 - nrc:rls-bugs-2, r=eddyb
Fix a bunch of minor save-analysis bugs

r? @eddyb
2017-11-04 15:30:20 +00:00
Alex Crichton
c11ac9441a rustbuild: Update the OpenSSL version to link
This updates the OpenSSL tarball download to reflect OpenSSL's newest release.
2017-11-04 08:05:46 -07:00
bors
dcd343bfbc Auto merge of #45617 - GuillaumeGomez:search-fixes, r=QuietMisdreavus
Search fixes

Fixes #45608.

r? @QuietMisdreavus
2017-11-04 12:54:34 +00:00
bors
a6885cb853 Auto merge of #45605 - Nashenas88:derive-newtype, r=nikomatsakis
Add derive and doc comment capabilities to newtype_index macro

This moves `RustcDecodable` and `RustcEncodable` out of the macro definition and into the macro uses. They were conflicting with `CrateNum`'s impls of `serialize::UseSpecializedEncodable` and `serialize::UseSpecializedDecodable`, and now it's not :). `CrateNum` is now defined with the `newtype_index` macro. I also added support for doc comments on constant definitions and allowed a type to remove the pub specification on the tuple param (otherwise a LOT of code would refuse to compile for `CrateNum`). I was getting dozens of errors like this if `CrateNum` was defined as `pub struct CrateNum(pub u32)`:
```
error[E0530]: match bindings cannot shadow tuple structs
   --> src/librustc/dep_graph/dep_node.rs:624:25
    |
63  | use hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX};
    |                   -------- a tuple struct `CrateNum` is imported here
...
624 |     [] MissingLangItems(CrateNum),
    |                         ^^^^^^^^ cannot be named the same as a tuple struct
```

I also cleaned up the formatting of the macro bodies as they were getting impossibly long. Should I go back and fix the matching rules to this style too?

I also want to see what the test results look like because `CrateNum` used to just derive `Debug`, but the `newtype_index` macro has a custom implementation. This might require further pushes.

Feel free to bikeshed on the macro language, I have no preference here.
2017-11-04 10:24:20 +00:00
bors
9acc3331e1 Auto merge of #45755 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests

- Successful merges: #45548, #45610, #45639, #45669, #45681, #45718, #45722, #45739, #45746
- Failed merges:
2017-11-04 06:59:29 +00:00
kennytm
e3b25a5942 Rollup merge of #45746 - GuillaumeGomez:methods-doc-test, r=steveklabnik
Add tests for methods listing in rust docs

r? @rust-lang/docs
2017-11-04 13:49:33 +08:00
kennytm
606e269e14 Rollup merge of #45739 - rkarp:master, r=petrochenkov
Fix libstd compile error for windows-gnu targets without `backtrace`

This is basically an addition to #44979. Compiling `libstd` still fails when targeting `windows-gnu` with `panic = "abort"` because the items in the `...c::gnu` module are not used. They are only referenced from `backtrace_gnu.rs`, which is indirectly feature gated behind `backtrace` [here](9f3b09116b/src/libstd/sys/windows/mod.rs (L23)).
2017-11-04 13:49:33 +08:00
kennytm
7a766a4a41 Rollup merge of #45722 - mikhail-m1:improve-mir-opt-error-output, r=alexcrichton
improve compiletest output for errors from mir-opt tests

improvement:
1. Report filename against general cannot open error
2. Report current MIR block
2017-11-04 13:49:32 +08:00
kennytm
ff00a5f8fb Rollup merge of #45718 - Ljzn:patch-2, r=BurntSushi
Fix typo

`accomodate` -> `accommodate`
2017-11-04 13:49:31 +08:00
kennytm
2c293922d0 Rollup merge of #45681 - Ljzn:patch-1, r=kennytm
Fix typo.
2017-11-04 13:49:30 +08:00
kennytm
1815265510 Rollup merge of #45669 - cardoe:metadata, r=kennytm
add Cargo metadata to libstd

Add license and repository metadata to libstd
2017-11-04 13:49:29 +08:00
kennytm
ea572657da Rollup merge of #45639 - LaurentMazare:master, r=petrochenkov
Add a nicer error message for missing  in for loop, fixes #40782.

As suggested by @estebank in issue #40782, this works in the same way as #42578: if the in keyword is missing, we continue parsing the expression and if this works correctly an adapted error message is produced. Otherwise we return the old error.

A specific test case has also been added.
This is my first PR on rust-lang/rust so any feedback is very welcome.
2017-11-04 13:49:28 +08:00
kennytm
ae512c4144 Rollup merge of #45610 - strake:atomic_from, r=nagisa
impl From<T> for AtomicT
2017-11-04 13:49:27 +08:00
kennytm
9ca6ee0299 Rollup merge of #45548 - ratmice:master, r=oli-obk
issue #45357 don't build clippy stage 1

#45357
Wasn't sure top_stage was the right thing, but seemed to go ahead building clippy stage 2.
2017-11-04 13:49:26 +08:00
Scott McMurray
1b19e64324 Add overflow tests for next_power_of_two 2017-11-03 22:33:34 -07:00
Scott McMurray
15ea3d80da Fix #18604: next_power_of_two should panic on overflow 2017-11-03 21:48:33 -07:00
bors
a4541525d5 Auto merge of #45514 - gnzlbg:jemalloc_realloc2, r=sfackler
[jemalloc] set correct excess in realloc_excess
2017-11-04 04:28:13 +00:00
bors
95a401609f Auto merge of #45384 - mikhail-m1:mir_add_false_edges_terminator_kind, r=arielb1
add TerminatorKind::FalseEdges and use it in matches

impl #45184 and fixes #45043 right way.

False edges unexpectedly affects uninitialized variables analysis in MIR borrowck.
2017-11-04 00:09:14 +00:00
Lukas Kalbertodt
259c125267 Mark several ascii methods as unstable again
We don't want to stabilize them now already. The goal of this set of
commits is just to add inherent methods to the four types. Stabilizing
all of those methods can be done later.
2017-11-03 21:28:04 +01:00
Lukas Kalbertodt
da57580736 Remove unused AsciiExt imports and fix tests related to ascii methods
Many AsciiExt imports have become useless thanks to the inherent ascii
methods added in the last commits. These were removed. In some places, I
fully specified the ascii method being called to enforce usage of the
AsciiExt trait. Note that some imports are not removed but tagged with
a `#[cfg(stage0)]` attribute. This is necessary, because certain ascii
methods are not yet available in stage0. All those imports will be
removed later.

Additionally, failing tests were fixed. The test suite should exit
successfully now.
2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
1916e3c4aa Copy AsciiExt methods to str directly
This is done in order to deprecate AsciiExt eventually. Note that
this commit contains a bunch of `cfg(stage0)` statements. This is
due to a new compiler feature this commit depends on: the
`slice_u8` lang item. Once this lang item is available in the
stage0 compiler, all those cfg flags (and more) can be removed.
2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
5a1d11a733 Copy AsciiExt methods to [u8] directly
This is done in order to deprecate AsciiExt eventually. Note that
this commit contains a bunch of `cfg(stage0)` statements. This is
due to a new compiler feature I am using: the `slice_u8` lang item.
Once this lang item is available in the stage0 compiler, all those
cfg flags (and more) can be removed.
2017-11-03 21:27:40 +01:00
Simon Sapin
9e441c76f7 Add a lang item to allow impl [u8] {…} in the standard library 2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
8a4fa742a1 Fix lists in doc comments for ascii methods of u8 and char 2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
f373916cb5 Add missing space in match arm 2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
3b13b66351 Tweak documentation for u8::eq_ignore_ascii_case() 2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
a5277622c5 Remove examples in doc-comments of AsciiExt methods
The doc comments were incorrect before: since the inherent ascii methods
shadow the `AsciiExt` methods, the examples didn't use the `AsciiExt` at
all. Since the trait will be deprecated soon anyway, the easiest solution
was to remove the examples and already mention that the methods will be
deprecated in the near future.
2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
6f5556854e Use direct implementation on u8/char to implement AsciiExt
The methods were copied to u8/char, so we can just use it in
AsciiExt impls to avoid duplicate code.
2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
d425f8d226 Copy AsciiExt methods to char directly
This is done in order to deprecate AsciiExt eventually.
2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
5061c9fecb Revert signature of eq_ignore_ascii_case() to original
Since the methods on u8 directly will shadow the AsciiExt methods,
we cannot change the signature without breaking everything. It
would have been nice to take `u8` as argument instead of `&u8`, but
we cannot break stuff! So this commit reverts it to the original
`&u8` version.
2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
04070d1148 Make ascii methods on u8 insta-stable
Those methods will shadow the methods of `AsciiExt`, so if we don't
make them insta-stable, everyone will hitting stability errors. It
is fine adding those as stable, because they are just being moved
around [according to sfackler][1].

OPEN QUESTION: this commit also stabilizes the `AsciiExt` methods
that were previously feature gated by the `ascii_ctype` feature.
Maybe we don't want to stablilize those yet.

[1]: https://github.com/rust-lang/rust/pull/44042#issuecomment-329939279
2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
d3f2be4bd8 Add all methods of AsciiExt to u8 directly
This is the first step in order to deprecate AsciiExt. Since
this is a WIP commit, there is still some code duplication (notably
the static arrays) that will be removed later.
2017-11-03 21:27:17 +01:00
Vadim Petrochenkov
d588f9338d Shorten paths to auxiliary files created by tests 2017-11-03 22:41:15 +03:00
David Wood
d3babe5eaa
Added page to unstable book. 2017-11-03 19:36:19 +00:00
David Wood
059eccb07f
Implemented RFC 2008 for enums (not including variants) and structs. 2017-11-03 19:36:18 +00:00
David Wood
6c19ebe128
Added tests for RFC 2008. 2017-11-03 19:36:18 +00:00
David Wood
d51ea538e4
Added feature gate for RFC 2008. 2017-11-03 19:36:17 +00:00
bors
2278506f68 Auto merge of #45247 - leodasvacas:implement-auto-trait-syntax, r=nikomatsakis
[Syntax] Implement auto trait syntax

Implements `auto trait Send {}` as a substitute for `trait Send {} impl Send for .. {}`.

See the [internals thread](https://internals.rust-lang.org/t/pre-rfc-renaming-oibits-and-changing-their-declaration-syntax/3086) for motivation. Part of #13231.

The first commit is just a rename moving from "default trait" to "auto trait". The rest is parser->AST->HIR work and making it the same as the current syntax for everything below HIR. It's under the `optin_builtin_traits` feature gate.

When can we remove the old syntax? Do we need to wait for a new `stage0`? We also need to formally decide for the new form (even if the keyword is not settled yet).

Observations:
- If you `auto trait Auto {}` and then `impl Auto for .. {}` that's accepted even if it's redundant.
- The new syntax is simpler internally which will allow for a net removal of code, for example well-formedness checks are effectively moved to the parser.
- Rustfmt and clippy are broken, need to fix those.
- Rustdoc just ignores it for now.

ping @petrochenkov @nikomatsakis
2017-11-03 19:07:45 +00:00