Commit Graph

61218 Commits

Author SHA1 Message Date
Niko Matsakis
4b5613cb1d prevent multiple writes to a single entry in a DepTrackingMap 2017-02-02 20:49:21 -05:00
Niko Matsakis
78f7ac561c rejigger how we handle used trait imports
The previous way was not friendly to incremental compilation. The new
plan is to compute, for each body, a set of trait imports used in that
body (slightly subtle: for a closure, we assign the trait imports to the
enclosing fn). Then we walk all bodies and union these sets. The reason
we do this is that we can save the individual sets in the incremental
state, and then recompute only those sets that are needed. Before we
were planning to save only the final union, but in that case if some
components are invalidated we have to recompute *all* of them since we
don't have enough information to "partly" invalidate a result.

In truth, this set probably ought to be part of the `TypeckTables`;
however, I opted not to do that because I don't want to have to
save/restore the entire tables in the incremental state yet (since it
contains a lot of `NodeId` references, and removing those is a
significant refactoring).
2017-02-02 20:48:49 -05:00
Jimmy Cuadra
2add6ac14a Add a name for the parameter to TryFrom::try_from.
Although signatures with anonymous parameters may not be deprecated or
removed at this point, the team seems to agree that the ability to have
an anonymous parameter is unfortunate historical baggage, and that we
shouldn't create new code that uses it.

Context: https://github.com/rust-lang/rust/issues/33417#issuecomment-276933861
2017-02-02 17:40:44 -08:00
Niko Matsakis
fdd7e3c744 remove some of the ways to mutate a DepTrackingMap
It is pretty suspect to insert an entry twice.
2017-02-02 20:38:35 -05:00
Niko Matsakis
d9aaca71cc store typeck lints in the TypeckTables
Otherwise they are a "hidden output"
2017-02-02 20:38:16 -05:00
Niko Matsakis
65b93ebcb8 introduce LintTable 2017-02-02 20:37:13 -05:00
Niko Matsakis
93e0bc6520 change the used_trait_imports map to be a DefIdSet 2017-02-02 20:35:41 -05:00
Niko Matsakis
5a6019429f don't use a mutable field where parameter passing will do 2017-02-02 20:35:41 -05:00
bors
7f294e4c18 Auto merge of #39466 - alexcrichton:fix, r=Manishearth
std: Fix IntoIter::as_mut_slice's signature

This was intended to require `&mut self`, not `&self`, otherwise it's unsound!

Closes #39465
2017-02-03 00:47:58 +00:00
bors
eedaa94e33 Auto merge of #39470 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 9 pull requests

- Successful merges: #38823, #39196, #39299, #39319, #39373, #39383, #39416, #39420, #39427
- Failed merges:
2017-02-02 21:58:10 +00:00
Dirkjan Ochtman
51e5cb525d Fix typo in bootstrap.py info message 2017-02-02 22:28:26 +01:00
Dirkjan Ochtman
8e793eb3c6 Guard against USER not existing in the environment 2017-02-02 22:28:00 +01:00
Dirkjan Ochtman
a0efdf3441 Don't check for sudo environment if vendored sources are already configured 2017-02-02 22:27:15 +01:00
Guillaume Gomez
d09e4de640 Rollup merge of #39427 - steveklabnik:pliniker-mailmap, r=alexcrichton
update mailmap for @pliniker
2017-02-02 22:22:33 +01:00
Guillaume Gomez
a561ad831d Rollup merge of #39420 - oli-obk:sugg, r=pnkfelix
parser: use suggestions instead of helps with code in them
2017-02-02 22:22:29 +01:00
Guillaume Gomez
9559c4d823 Rollup merge of #39416 - tspiteri:ffi-unsafe-icon, r=brson
rustdoc: mark FFI functions with unsafety icon

Currently, in the list of functions, unsafe functions are marked with a superscript ⚠, but unsafe FFI functions are not. This patch treats unsafe FFI functions like other unsafe functions in this regard.
2017-02-02 22:22:28 +01:00
Guillaume Gomez
7bc322281d Rollup merge of #39383 - nagisa:mir-uninhabited-destinations, r=pnkfelix
Remove the workaround for gh32959

This workaround is no longer necessary as Rust, and by extension MIR, now support uninhabited type
properly. This removes the workaround for the gh32959 that was introduced in gh33267.

Fixes #32959
2017-02-02 22:22:26 +01:00
Guillaume Gomez
a768827c24 Rollup merge of #39373 - Mark-Simulacrum:remove-toprimitive, r=aturon
Remove ToPrimitive trait.

It is no longer used.
2017-02-02 22:22:24 +01:00
Guillaume Gomez
bcfa2f1cce Rollup merge of #39319 - nagisa:remove-rustsetpersonalityfn, r=pnkfelix
Remove unnecessary LLVMRustPersonalityFn binding

LLVM Core C bindings provide this function for all the versions back to what we support (3.7), and
helps to avoid this unnecessary builder->function transition every time. Also a negative diff.

Fixes #38462 (although it was pretty much fixed already)
2017-02-02 22:22:23 +01:00
Guillaume Gomez
b03436d2e3 Rollup merge of #39299 - federicomenaquintero:master, r=GuillaumeGomez
In std:rc, clarify the lack of mutability inside an Rc

Also, point to the example in Cell's docs for how to do it.
2017-02-02 22:22:22 +01:00
Guillaume Gomez
38ae9233b5 Rollup merge of #39196 - apasel422:nomicon, r=petrochenkov
Update nomicon to describe `#[may_dangle]`

CC #34761
r? @pnkfelix
2017-02-02 22:22:21 +01:00
Guillaume Gomez
5ada328d81 Rollup merge of #38823 - Freyskeyd:doc-missingInformationCfgTest, r=steveklabnik
Improve doc cfg(test) and tests directory

Hi,

I was facing a problem with my code organisation. I was using a tests directory and i defined some `#[cfg(test)]` in my `src/`. But i was not able to use it in my `tests` folder.

```bash
.
├── Cargo.lock
├── Cargo.toml
├── src
│   ├── lib.rs
│   └── test.rs
└── tests
    └── x.rs
```
> src/lib.rs
```rust
pub mod test;

fn tesst() {
    assert!(test::t());
}
```
> src/test.rs
```rust
pub fn t() -> bool { true }
```
> test/x.rs
```rust
extern crate testt;

use testt::test;
fn tesst() {
    assert!(test::t());
}
```

I was unable to compile using `cargo test`:
```bash
error[E0432]: unresolved import `testt::test`
 --> tests/x.rs:3:5
  |
3 | use testt::test;
  |     ^^^^^^^^^^^ no `test` in `testt`
```

If i remove the `tests` directory everything works fine. To use an utils module in your `tests` directory, you need to create a module in the directory (like `tests/utils.rs`). My `tests/x.rs` look like this now:

```rust
extern crate testt;

mod utils;

fn tesst() {
    assert!(utils::t());
}
```

And my tree:
```bash
.
├── Cargo.lock
├── Cargo.toml
├── src
│   └── lib.rs
└── tests
    ├── utils.rs
    └── x.rs
```

I think that thing must be documented in the book.

Ping:
- @badboy : Because he's the one who showed me the path
- @shahn : Because he helped me too to find the solution

Signed-off-by: Freyskeyd <simon.paitrault@iadvize.com>
2017-02-02 22:22:19 +01:00
Vadim Petrochenkov
b4abb72ef0 Fixup crate versions 2017-02-02 23:55:42 +03:00
Vadim Petrochenkov
a5b603b1bf Build libbacktrace/jemalloc only when their timestamps are older than sources 2017-02-02 22:40:42 +03:00
Vadim Petrochenkov
c0253304ea Fix build in cross-compilation scenarios 2017-02-02 22:40:42 +03:00
Vadim Petrochenkov
6c2ef5201a rustbuild: Build jemalloc and libbacktrace only once (take 2) 2017-02-02 22:40:42 +03:00
Alex Crichton
80f7db63b6 std: Fix IntoIter::as_mut_slice's signature
This was intended to require `&mut self`, not `&self`, otherwise it's unsound!

Closes #39465
2017-02-02 11:27:52 -08:00
bors
a47a6ea771 Auto merge of #39411 - tamird:match-arm-statics-ICE, r=alexcrichton
statics in match arm: compile with -g

Resubmission of #29700.

r? @alexcrichton
2017-02-02 18:20:37 +00:00
bors
1a2428fc88 Auto merge of #39402 - king6cong:master, r=nrc
comment rewording and argument unifying
2017-02-02 15:41:19 +00:00
bors
d5f54743db Auto merge of #39386 - tbu-:pr_pipe_less_syscalls, r=alexcrichton
Use less syscalls in `anon_pipe()`

Save a `ENOSYS` failure from `pipe2` and don't try again.

Use `cvt` instead of `cvt_r` for `pipe2` - `EINTR` is not an error
`pipe2` can return.
2017-02-02 13:04:53 +00:00
Son
c4cd4e19d9 Wrap 80 columns 2017-02-02 22:24:50 +11:00
Giang Nguyen
a7b65f1578 Add doc field init shorthand 2017-02-02 22:19:41 +11:00
Giang Nguyen
3388855443 Add explain struct field init shorthand 2017-02-02 22:19:24 +11:00
Giang Nguyen
897029d072 Update grammar struct field init shorthand 2017-02-02 22:18:43 +11:00
Son
823e185a40 Suggest only if resolution was previously resolved 2017-02-02 22:05:49 +11:00
bors
3b24c70012 Auto merge of #39384 - wesleywiser:fix_fixmes, r=alexcrichton
Resolve a bunch of fixmes

Resolves 56 fixmes in test code related to `box` syntax.
2017-02-02 10:40:13 +00:00
bors
6abe64871e Auto merge of #39116 - mgattozzi:better-string-message, r=nrc
Add clearer error message using `&str + &str`

This is the first part of #39018. One of the common things for new users
coming from more dynamic languages like JavaScript, Python or Ruby is to
use `+` to concatenate strings. However, this doesn't work that way in
Rust unless the first type is a `String`. This commit adds a check for
this use case and outputs a new error as well as a suggestion to guide
the user towards the desired behavior. It also adds a new test case to
test the output of the error.
2017-02-02 07:39:07 +00:00
bors
1b6b20ac17 Auto merge of #38932 - petrochenkov:privctor, r=jseyfried
Privatize constructors of tuple structs with private fields

This PR implements the strictest version of such "privatization" - it just sets visibilities for struct constructors, this affects everything including imports.
```
visibility(struct_ctor) = min(visibility(struct), visibility(field_1), ..., visibility(field_N))
```
Needs crater run before proceeding.

Resolves https://github.com/rust-lang/rfcs/issues/902

r? @nikomatsakis
2017-02-02 05:10:40 +00:00
Austin Bonander
89f9767356 Change tracking issue for proc_macro feature to #38356 2017-02-01 20:11:10 -08:00
Wesley Wiser
8b947a37c8 Update Cell references in the book 2017-02-01 22:53:39 -05:00
Wesley Wiser
daa509109f Update cell docs 2017-02-01 22:51:52 -05:00
Nick Cameron
395f23c9f7 save-analysis: be more paranoid about generated paths
fixes https://github.com/rust-lang-nursery/rls/issues/160
2017-02-02 16:23:27 +13:00
bors
2a6f7e41fc Auto merge of #38661 - frewsxcv:vec-deque-partial-eq, r=aturon
Implement `PartialEq<[A]>` for `VecDeque<A>`.

Fixes https://github.com/rust-lang/rust/issues/38625.
2017-02-02 02:42:07 +00:00
Michał Krasnoborski
ecda7f314f remove the wrapping arithmetics 2017-02-02 03:38:12 +01:00
Michał Krasnoborski
7403ee9d07 Adjust heuristics to better handle "{}..." format strings. 2017-02-01 23:47:03 +01:00
f001
dfcca546fc std: Add ToString trait specialization for Cow<'a, str> and String
r? @bluss
2017-02-01 19:17:51 +08:00
Wesley Wiser
94687aaf58 Removes FIXMEs related to #22405 2017-01-31 21:27:13 -05:00
Federico Mena Quintero
4a07e722c0 In std:rc, clarify the lack of mutability inside an Rc
Also, point to the example in Cell's docs for how to do it.
2017-01-31 18:02:41 -06:00
Sean McArthur
cd603e4324 add From<(I, u16)> for SocketAddr where I: Into<IpAddr> 2017-01-31 15:07:22 -08:00
Steve Klabnik
4b52600b15 update mailmap for @pliniker 2017-01-31 13:19:03 -05:00