Commit Graph

54288 Commits

Author SHA1 Message Date
Ted Mielczarek
24e7491660 Add an abs_path member to FileMap, use it when writing debug info.
When items are inlined from extern crates, the filename in the debug info
is taken from the FileMap that's serialized in the rlib metadata.
Currently this is just FileMap.name, which is whatever path is passed to rustc.
Since libcore and libstd are built by invoking rustc with relative paths,
they wind up with relative paths in the rlib, and when linked into a binary
the debug info uses relative paths for the names, but since the compilation
directory for the final binary, tools trying to read source filenames
will wind up with bad paths. We noticed this in Firefox with source
filenames from libcore/libstd having bad paths.

This change stores an absolute path in FileMap.abs_path, and uses that
if available for writing debug info. This is not going to magically make
debuggers able to find the source, but it will at least provide sensible
paths.
2016-06-16 18:08:46 +01:00
bors
12b6345bc2 Auto merge of #34296 - dsprenkels:issue-23122-tests, r=alexcrichton
Add regression tests for #23122

This PR adds two regression tests for #23122.

Closes #23122.
2016-06-16 09:26:36 -07:00
Ariel Ben-Yehuda
a6d694ea00 fix MirSource::Promoted handling 2016-06-16 17:30:09 +03:00
Ariel Ben-Yehuda
5da8bf8402 stop having 'static in dump-mir names 2016-06-16 16:54:20 +03:00
Ariel Ben-Yehuda
63cdd7ab50 use a different filename for original and promoted MIRs 2016-06-16 16:54:20 +03:00
bors
7aba683c76 Auto merge of #34239 - jseyfried:fix_macro_use_scope_regression, r=nrc
Revert a change in the scope of macros imported from crates to fix a regression

Fixes #34212.
The regression was caused by #34032, which changed the scope of macros imported from extern crates to match the scope of macros imported from modules.
r? @nrc
2016-06-16 06:37:18 -07:00
Peter Atashian
e0992df35f
Fix issue where rustbuild expected msvc to have ar
Signed-off-by: Peter Atashian <retep998@gmail.com>
2016-06-16 08:38:06 -04:00
bors
6edea2cfda Auto merge of #34216 - jseyfried:nested_cfg_attr, r=nrc
Support nested `cfg_attr` attributes

Support arbitrarily deeply nested `cfg_attr` attributes (e.g. `#[cfg_attr(foo, cfg_attr(bar, baz))]`).
This makes configuration idempotent.

Currently, the nighties do not support any `cfg_attr` nesting. Stable and beta support just one level of `cfg_attr` nesting (expect for attributes on macro-expanded nodes, where no nesting is supported).

This is a [breaking-change]. For example, the following would break:
```rust
macro_rules! m { () => {
    #[cfg_attr(all(), cfg_attr(all(), cfg(foo)))]
    fn f() {}
} }
m!();

fn main() { f() } //~ ERROR unresolved name `f`
```
r? @nrc
2016-06-16 03:49:55 -07:00
Nick Cameron
a835d7487c save-analysis: add a decl_id for methods
This is non-null if the method is in a (non-inherent) impl and in that case will be the id for the method declaration in the implemented trait.
2016-06-16 11:28:39 +01:00
bors
a479a6a7a6 Auto merge of #34290 - arielb1:short-ladder, r=eddyb
don't generate drop ladder steps for fields that don't need dropping

cc @eddyb

This should help with #34166
2016-06-16 01:01:26 -07:00
Jeffrey Seyfried
c41cf30e9d Strip unconfigured nodes from decorator-generated AST 2016-06-16 07:58:43 +00:00
Daan Sprenkels
7ee3eaa79c Add regression tests for #23122 2016-06-16 09:46:25 +02:00
Jeffrey Seyfried
83d283b67b Avoid expanding decorator-generated items twice 2016-06-16 06:44:38 +00:00
Ariel Ben-Yehuda
68129a682a fix codegen-units fallout 2016-06-16 09:26:44 +03:00
bors
7339eca0cc Auto merge of #34000 - estebank:missingargs, r=jseyfried
Show types of all args when missing args

When there're missing arguments in a function call, present a list of
all the expected types:

```rust
fn main() {
    t("");
}

fn t(a: &str, x: String) {}
```

```bash
% rustc file.rs
file.rs:3:5: 2:8 error: this function takes 2 parameters but 0
parameters were supplied [E0061]
file.rs:3     t();
              ^~~
file.rs:3:5: 2:8 help: run `rustc --explain E0061` to see a detailed explanation
file.rs:3:5: 2:8 note: the following parameter types were expected: &str, std::string::String
error: aborting due to previous error
```

Fixes #33649
2016-06-15 22:12:26 -07:00
Jeffrey Seyfried
58372af058 Add test for MultiItemModifiers that add items 2016-06-16 03:55:57 +00:00
Jeffrey Seyfried
ac1a1d32f6 Allow MultiItemModifiers to expand into zero or many items 2016-06-16 03:55:55 +00:00
Jeffrey Seyfried
34191ed1c8 Refactor MultiModifier expansion 2016-06-16 03:55:53 +00:00
Jeffrey Seyfried
6ba7b7c22d Implement HasAttrs for Annotatable 2016-06-16 03:55:52 +00:00
bors
58adb07607 Auto merge of #34291 - Manishearth:rollup, r=Manishearth
Rollup of 4 pull requests

- Successful merges: #34207, #34268, #34270, #34290
- Failed merges:
2016-06-15 19:25:45 -07:00
Esteban Küber
1020e3036b Show types of all args when missing args
When there're missing arguments in a function call, present a list of
all the expected types:

```rust
fn main() {
    t("");
}

fn t(a: &str, x: String) {}
```

```bash
% rustc file.rs
file.rs:3:5: 2:8 error: this function takes 2 parameters but 0
parameters were supplied [E0061]
file.rs:3     t();
              ^~~
file.rs:3:5: 2:8 help: run `rustc --explain E0061` to see a detailed explanation
file.rs:3:5: 2:8 note: the following parameter types were expected: &str, std::string::String
error: aborting due to previous error
```

Fixes #33649
2016-06-15 18:40:11 -07:00
Manish Goregaokar
e3d6bb1f71 Rollup merge of #34270 - gkoz:error_file_exists, r=alexcrichton
Add ERROR_FILE_EXISTS to ErrorKind conversion on Windows

Bug report: https://users.rust-lang.org/t/detecting-error-kind-for-opening-file/6215
Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx#error_file_exists
2016-06-16 01:39:44 +01:00
Manish Goregaokar
2675a55a8f Rollup merge of #34268 - zackmdavis:if_let_over_none_unit_arm, r=jseyfried
prefer `if let` to match with `None => ()` arm in some places

Casual grepping revealed some places in the codebase (some of which
antedated `if let`'s December 2014 stabilization in c200ae5a) where we
were using a match with a `None => ()` arm where (in the present
author's opinion) an `if let` conditional would be more readable. (Other
places where matching to the unit value did seem to better express the
intent were left alone.)

It's likely that we don't care about making such trivial,
non-functional, sheerly æsthetic changes.

But if we do, this is a patch.
2016-06-16 01:39:44 +01:00
Manish Goregaokar
d84993b054 Rollup merge of #34207 - petrochenkov:nohyg, r=jseyfried
Remove last traces of identifier hygiene from HIR

e783a0a5e3 removed the [last](https://github.com/rust-lang/rust/pull/33654#discussion_r63415218) [use](https://github.com/rust-lang/rust/pull/33654#discussion_r63416284) of hygiene at post-resolve compilation stages, so we can avoid renaming during lowering to HIR and just keep original names.

r? @nrc
2016-06-16 01:39:43 +01:00
Oliver Middleton
195fc5a325 rustdoc: Add stability notices to impl items
Also fixes missing stability notices on methods with no docs.
2016-06-15 23:56:24 +01:00
Ariel Ben-Yehuda
2960bc8246 don't generate drop ladder steps for fields that don't need dropping 2016-06-16 00:48:02 +03:00
bors
bb4a79b087 Auto merge of #34220 - srinivasreddy:rf_cargotest, r=brson
run rustfmt on cargotest folder in src/tools/cargotest
2016-06-15 13:11:19 -07:00
bors
5755936a63 Auto merge of #34218 - srinivasreddy:rf_linkchecker, r=brson
run rustfmt on linkchecker folderin src/tools/linkchecker
2016-06-15 10:28:30 -07:00
Zack M. Davis
8531d58104 prefer if let to match with None => () arm in some places
Casual grepping revealed some places in the codebase (some of which
antedated `if let`'s December 2014 stabilization in c200ae5a) where we
were using a match with a `None => ()` arm where (in the present
author's opinion) an `if let` conditional would be more readable. (Other
places where matching to the unit value did seem to better express the
intent were left alone.)

It's likely that we don't care about making such trivial,
non-functional, sheerly æsthetic changes.

But if we do, this is a patch.
2016-06-15 08:13:10 -07:00
bors
9b06d2ad33 Auto merge of #33300 - seanmonstar:map-entry-take, r=alexcrichton
Map::Entry methods to recover key and value together

See https://github.com/rust-lang/rust/issues/32281#issuecomment-213066344
2016-06-15 07:37:27 -07:00
Sean McArthur
217a964027 Map::Entry::take() method to recover key and value together 2016-06-15 05:45:50 -07:00
bors
a94881563c Auto merge of #34180 - durka:patch-24, r=brson
derive Hash (and not Copy) for ranges

Fixes #34170.

Also, `RangeInclusive` was `Copy` by mistake -- fix that, which is a [breaking-change] to that unstable type.
2016-06-15 04:48:29 -07:00
Gleb Kozyrev
552afd30d0 Fix a docs typo 2016-06-15 13:06:48 +03:00
Gleb Kozyrev
1db97575cc Test ErrorKind::AlreadyExists for files 2016-06-15 13:05:43 +03:00
bors
c5f3706c0d Auto merge of #34263 - ollie27:docs_ip, r=alexcrichton
Improve IP reserved address docs

- Add links to all RFCs to make it clear these are not Rust RFCs.
- Correct RFC numbers to match the numbers in [RFC 6890](https://tools.ietf.org/html/rfc6890)
- Clean up formatting to show addresses and ranges in parentheses like (255.255.255.255)

r? @steveklabnik
2016-06-14 20:36:31 -07:00
bors
1a942f60f0 Auto merge of #34245 - ollie27:rustdoc_redirect_rename, r=alexcrichton
rustdoc: Fix redirect pages for renamed reexports

We need to use the name of the target not the name of the current item
when creating the link.

An example in `std` is [`std::sys::ext`](https://doc.rust-lang.org/nightly/std/sys/ext/index.html).
2016-06-14 17:11:05 -07:00
bors
6b4511755c Auto merge of #34221 - srinivasreddy:rm_redundant, r=alexcrichton
remove redundant test case in bitvector.rs

`bitvec_iter_works_2` does exactly same as `bitvec_iter_works_1`, so i removed it.
2016-06-14 13:42:28 -07:00
bors
be8bd82268 Auto merge of #34234 - GuillaumeGomez:bad_inlining, r=steveklabnik
Fix invalid inlining

r? @steveklabnik

So to put a context. @nox found an issue on the generated doc:

![screenshot from 2016-06-11 19-53-38](https://cloud.githubusercontent.com/assets/3050060/15987898/f7341de0-303b-11e6-9cd7-f2a6df423ee7.png)

So as you can see, the two variants are on the same where they shouldn't. I found out that the issue is also on structs:

![screenshot from 2016-06-11 19-53-31](https://cloud.githubusercontent.com/assets/3050060/15987900/0f66c5de-303c-11e6-90fc-5e49d11b6903.png)

And so such is the result of the PR:

![screenshot from 2016-06-12 01-15-21](https://cloud.githubusercontent.com/assets/3050060/15987904/19d9183c-303c-11e6-91c1-7c3f1163fbb0.png)
![screenshot from 2016-06-12 01-15-24](https://cloud.githubusercontent.com/assets/3050060/15987905/1b5d2db0-303c-11e6-8f43-9a8ad2371007.png)
2016-06-14 07:49:56 -07:00
Oliver Middleton
0c742d263c rustdoc: Fix redirect pages for renamed reexports
We need to use the name of the target not the name of the current item
when creating the link.
2016-06-14 15:24:06 +01:00
Ulrik Sverdrup
5df05c6e22 specialize zip: Use associated type for specialized zip struct data
The associated type must be 'static to avoid dropck related errors.
2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
85cd49fc39 specialize zip: Add benchmarks 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
c2ef20fd38 specialize zip: Add codegen test 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
13f8f40961 specialize zip: TrustedRandomAccess for Enumerate 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
515c4d3c1e specialize zip: TrustedRandomAccess for Zip 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
a8f2e9b359 specialize zip: Specialize .zip() for TrustedRandomAccess iterators
This allows common iterator compositions like a.zip(b) where a, b
are slice::{Iter, IterMut} compile to *much* better code.
2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
592eaa5bb3 specialize zip: Implement TrustedRandomAccess for slice iterators 2016-06-14 15:51:49 +02:00
Ulrik Sverdrup
f8d2fdf02b specialize zip: Introduce TrustedRandomAccess trait 2016-06-14 15:50:49 +02:00
bors
2940eb54bd Auto merge of #34232 - ollie27:rustdoc_inline, r=alexcrichton
rustdoc: Don't inline #[doc(hidden)] pub use

Currently if a `#[doc(hidden)] pub use` item is inlined the `hidden`
attribute is ignored so the item can appear in the docs. By never inlining
such imports, they can be stripped.

An example in `std` is [`__OsLocalKeyInner`](https://doc.rust-lang.org/nightly/std/thread/struct.__OsLocalKeyInner.html) which clearly should not be documented.
2016-06-14 05:04:38 -07:00
Gleb Kozyrev
5db9424de3 Add ERROR_FILE_EXISTS to ErrorKind conversion on Windows
Bug report:
https://users.rust-lang.org/t/detecting-error-kind-for-opening-file/6215
Reference:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx#error_file_exists
2016-06-14 12:10:42 +03:00
bors
1af8f3e362 Auto merge of #34266 - liigo:patch-8, r=Manishearth
reference: link to proper ffi attributes
2016-06-14 00:24:33 -07:00