Commit Graph

56568 Commits

Author SHA1 Message Date
bors
8aeb15acc7 Auto merge of #35894 - jseyfried:new_import_semantics, r=nrc
Implement RFC 1560 behind `#![feature(item_like_imports)]`

This implements https://github.com/rust-lang/rfcs/pull/1560 (cc #35120) behind the `item_like_imports` feature gate.

The [RFC text](https://github.com/rust-lang/rfcs/blob/master/text/1560-name-resolution.md#changes-to-name-resolution-rules) describes the changes to name resolution enabled by `#![feature(item_like_imports)` in detail. To summarize,
 - Items and named imports shadow glob imports.
 - Multiple globs can import the same name if the name is unused or the imports are shadowed.
 - Multiple globs can import the same name if the imports are of the same item (following re-exports).
  - The visibility of such a name is the maximum visibility of the imports.
  - Equivalently, adding a glob import will never reduce the visibility of a name, nor will removing one increase it.
 - Non-prelude private imports can be used wherever we currently allow private items to be used.
  - Prelude-imported names are unaffected, i.e. they continue to be usable only in lexical scopes.
 - Globs import all visible names, not just public names.
  - Equivalently, glob importing from an ancestor module imports all of the ancestor's names, and glob importing from other modules is unchanged.

r? @nrc
2016-09-01 19:03:27 -07:00
Jeffrey Seyfried
90ce504c1c Address comments. 2016-09-02 00:35:16 +00:00
Alex Crichton
96283fc083 test: Add a min-llvm-version directive
We've got tests which require a particular version of LLVM to run as they're
testing bug fixes. Our build system, however, supports multiple LLVM versions,
so we can't run these tests on all LLVM versions.

This adds a new `min-llvm-version` directive for tests so they can opt out of
being run on older versions of LLVM. This then namely applies that logic to the
`issue-36023.rs` test case and...

Closes #36138
2016-09-01 16:14:17 -07:00
Eugene R Gonzalez
7cd4e7ff0b Fixed E0528 label and unit test 2016-09-01 19:08:07 -04:00
Jeffrey Seyfried
4f5616e3c4 Avoid cascading name resolution errors caused by an ambiguous module. 2016-09-01 22:30:29 +00:00
Jeffrey Seyfried
32a0cfeb48 Avoid reporting multiple ambiguity errors for a single use of a name. 2016-09-01 22:30:28 +00:00
Jeffrey Seyfried
681a14f29b item_like_imports: Allow unused ambiguous glob imports. 2016-09-01 22:30:27 +00:00
Jeffrey Seyfried
f582fa327e item_like_imports: Allow multiple glob imports of the same item. 2016-09-01 22:30:26 +00:00
Jeffrey Seyfried
245a0c5530 item_like_imports: Make all visible items glob importable. 2016-09-01 22:30:26 +00:00
Jeffrey Seyfried
097b6d62fc item_like_imports: Allow glob imports with a given visibility
to reexport some (but not all) names with less visibility.
2016-09-01 22:30:25 +00:00
Jeffrey Seyfried
c56a5afd4d item_like_imports: Allow single imports with a given visibility
to reexport some (but not all) namespaces with less visibility.
2016-09-01 22:30:24 +00:00
Jeffrey Seyfried
aad1f3cbf3 item_like_imports: Allow glob imports to be shadowed by items and single imports. 2016-09-01 22:30:24 +00:00
Jeffrey Seyfried
efc0bea687 item_like_imports: Treat private imports like private items. 2016-09-01 22:30:21 +00:00
Jeffrey Seyfried
5ba22c0ed6 Add item_like_imports feature. 2016-09-01 22:29:50 +00:00
Jeffrey Seyfried
513e955a18 Add field dummy_binding to Resolver. 2016-09-01 22:29:30 +00:00
Jeffrey Seyfried
95528d1a98 Refactor away resolver.current_vis and add module.normal_ancestor_id. 2016-09-01 22:29:29 +00:00
Jeffrey Seyfried
1e4c8173e1 Improve diagnostics and remove dead code. 2016-09-01 22:29:28 +00:00
Jeffrey Seyfried
87ae68c1d6 Refactor binding.def() to return a Def instead of an Option<Def>. 2016-09-01 22:29:27 +00:00
Jeffrey Seyfried
691d10c3c9 Rename new_binding -> binding. 2016-09-01 22:29:27 +00:00
Jeffrey Seyfried
5dc1196191 Refactor away binding.is_pseudo_public(). 2016-09-01 22:29:26 +00:00
Jeffrey Seyfried
48a435a90f Fix test compile-fail/task-rng-isnt-sendable.rs. 2016-09-01 22:29:25 +00:00
bors
497d67d708 Auto merge of #35761 - nikomatsakis:faster-trans-fulfill-obligation, r=eddyb
Cache projections in trans

This introduces a cache for the results of projection and normalization in trans. This is in addition to the existing cache that is per-inference-context. Trans is an easy place to put the cache because we are guaranteed not to have type parameters and also we don't expect any failures or inference variables, so there is no need to cache or follow-up on obligations that come along with.  (As evidenced by the fact that this particular code would panic if any error occurred.)

That said, I am not sure this is 100% the best place for it; I sort of wanted a cache like we have in the fulfillment context for global names; but that cache only triggers when all subsequent obligations are satisfied, and since projections don't have an entry in the obligation jungle there is no easy place to put it. I considered caching both the result and obligations globally, but haven't really tried implementing it. It might be a good next step.

Regardless, this cache seems to have no real effect on bootstrap time (maybe a slight improvement), but on [the futures.rs test case I was looking at](https://github.com/rust-lang-nursery/rustc-benchmarks/pull/6), it improves performance quite a bit:

| phase | before | after |
| ----- | ------ | ----- |
| collection | 0.79s | 0.46s |
| translation | 6.8s | 3.2s |
| total | 11.92s | 7.15s |

r? @arielb1
2016-09-01 15:25:58 -07:00
bors
933f471710 Auto merge of #34494 - CensoredUsername:allow_sysV64_abi, r=nagisa
Allow specification of the system V AMD64 ABI constraint.

This can be specified using `extern "sysV64" fn` on all platforms.

This ABI is used as the C ABI on unix platforms, but can only be specified there using extern "C". It was impossible to specify on other platforms. Meanwhile the win64 ABI, which was the extern "C" ABI on the windows platform could be specified on other platforms using extern "win64".

This pull request adds the the "sysV64" ABI constraint which exposes this calling convention on platforms where it is not the C ABI.
2016-09-01 11:56:51 -07:00
Florian Gilcher
0f8eb81011 Document try!'s error conversion behaviour 2016-09-01 19:16:19 +02:00
Mohit Agarwal
7d5fa9edc9
configure: check if any of the arguments contain --help
Currently it checks only the first argument.

Fixes #31216
2016-09-01 18:49:35 +05:30
bors
147371f58f Auto merge of #34982 - arielb1:bad-tuples-and-objects, r=nikomatsakis
Turn the RFC1592 warnings into hard errors

The warnings have already reached stable, and I want to improve the trait error reporting code.

Turning warnings into errors, this is obviously a [breaking-change].

r? @nikomatsakis

cc @rust-lang/compiler
2016-09-01 06:05:04 -07:00
Ariel Ben-Yehuda
7b92d05804 turn the RFC1592 warnings into hard errors
The warnings have already reached stable

The test rfc1592_deprecated is covered by `bad_sized` and
`unsized6`.

Fixes #33242
Fixes #33243
2016-09-01 13:34:56 +03:00
bors
b2799a56a1 Auto merge of #35755 - SimonSapin:char_convert, r=alexcrichton
Implement std::convert traits for char

This is motivated by avoiding the `as` operator, which sometimes silently truncates, and instead use conversions that are explicitly lossless and infallible.

I’m less certain that `From<u8> for char` should be implemented: while it matches an existing behavior of `as`, it’s not necessarily the right thing to use for non-ASCII bytes. It effectively decodes bytes as ISO/IEC 8859-1 (since Unicode designed its first 256 code points to be compatible with that encoding), but that is not apparent in the API name.
2016-09-01 02:53:28 -07:00
CensoredUsername
3d766a0779 the win64 calling convention is also used on x86_64-pc-windows-gnu, so ignore windows entirely instead of just msvc 2016-09-01 10:35:37 +02:00
Niko Matsakis
00d208eea8 remove normalize_infer_ctxt constructor 2016-08-31 22:06:01 -04:00
Jonathan Turner
439afcd974 Update error message for lifetime of borrowed values 2016-08-31 17:48:26 -07:00
bors
3135b7877a Auto merge of #36177 - jonathandturner:rollup, r=jonathandturner
Rollup of 13 pull requests

- Successful merges: #35773, #35786, #35911, #35927, #36083, #36087, #36098, #36114, #36118, #36123, #36129, #36152, #36169
- Failed merges:
2016-08-31 17:40:39 -07:00
Jonathan Turner
1b0476297e Special case a few colors for Windows 2016-08-31 15:19:43 -07:00
Matthew Piziak
9a400f0a31 replace ../ with ../../std/ to support core docs 2016-08-31 18:17:44 -04:00
Niko Matsakis
7057c421c0 cache projections in trans 2016-08-31 17:47:33 -04:00
Eduard Burtescu
f5c7752742 Fix optimization regressions for operations on [x; n]-initialized arrays. 2016-09-01 00:27:03 +03:00
Niko Matsakis
c5be6f6cc6 add cache to shared context for proj 2016-08-31 17:05:53 -04:00
Niko Matsakis
72694d5829 give apply_param_substs a SharedCrateContext
I plan to put a cache on the shared context, for now at least.
2016-08-31 17:05:53 -04:00
Jonathan Turner
5c97100058 Rollup merge of #36169 - wdv4758h:librustc_plugin_docs, r=nikomatsakis
Change 'rustc::plugin' to 'rustc_plugin' in doc comment

It looks like there is a missing one.
2016-08-31 13:53:36 -07:00
Jonathan Turner
240d86b631 Rollup merge of #36152 - dns2utf8:man_page_date, r=nikomatsakis
Update man pages

Until I finish #35438
2016-08-31 13:53:35 -07:00
Jonathan Turner
1a1e9b0b6a Rollup merge of #36129 - eddyb:signal-exit-status, r=alexcrichton
Fix run-pass/signal-exit-status to not trigger UB by writing to NULL.

`run-pass/signal-exit-status` has had UB (NULL dereference) since it was introduced in #10109.
Fixes the test failure found by @camlorn while running under Windows Subsystem for Linux.
2016-08-31 13:53:35 -07:00
Jonathan Turner
e69d65cc0b Rollup merge of #36123 - nagisa:unignore-json-tests, r=alexcrichton
Unignore the json tests on 32-bit platforms

cc #14064

r? @alexcrichton
2016-08-31 13:53:35 -07:00
Jonathan Turner
6e045cc2be Rollup merge of #36118 - nagisa:windows-has-no-sprint-again, r=brson
Fix the test_variadic_ptr fn on printf-less sys

Fixes #36076
2016-08-31 13:53:35 -07:00
Jonathan Turner
5dc779ba52 Rollup merge of #36114 - zjhmale:fix-E0393, r=jonathandturner
Update E0393 to new error format

Fixes #35632.
Part of #35233.

r? @jonathandturner

and a wired thing is that if i add another label

```rust
.span_label(span, &format!("missing reference to `{}`", def.name))
.span_label(span, &format!("because of the default `Self` reference, type parameters must be specified on object types"))
```

and add a new note in the test case like

```rust
trait A<T=Self> {}

fn together_we_will_rule_the_galaxy(son: &A) {}
//~^ ERROR E0393
//~| NOTE missing reference to `T`
//~| NOTE because of the default `Self` reference, type parameters must be specified on object types
```

it will complain that

```
running 1 test
test [compile-fail] compile-fail/E0393.rs ... FAILED

failures:

---- [compile-fail] compile-fail/E0393.rs stdout ----

error: /Users/zjh/Documents/rustspace/rust/src/test/compile-fail/E0393.rs:13: unexpected "error": '13:43: 13:44: the type parameter `T` must be explicitly specified [E0393]'

unexpected errors (from JSON output): [
    Error {
        line_num: 13,
        kind: Some(
            Error
        ),
        msg: "13:43: 13:44: the type parameter `T` must be explicitly specified [E0393]"
    }
]
```

it is a little bit confusing and through the blog post we can use `//~^` and `//~|` to support multiple notes, @jonathandturner am i missing something here?
2016-08-31 13:53:34 -07:00
Jonathan Turner
bbb2d1d0ac Rollup merge of #36098 - king6cong:master, r=alexcrichton
fix git submodule status check

None
2016-08-31 13:53:34 -07:00
Jonathan Turner
1afe1ea003 Rollup merge of #36087 - apasel422:issue-28324, r=alexcrichton
Add test for #28324

Closes #28324
2016-08-31 13:53:34 -07:00
Jonathan Turner
e845da90f9 Rollup merge of #36083 - GuillaumeGomez:missing_convert_urls, r=steveklabnik
Add missing urls into convert module

r? @steveklabnik
2016-08-31 13:53:34 -07:00
Jonathan Turner
bfe51295b3 Rollup merge of #35927 - matthew-piziak:bitandassign-example, r=GuillaumeGomez
replace `BitAndAssign` example with something more evocative

This is the augmented-assignment version of PR #35809.

r? @GuillaumeGomez
2016-08-31 13:53:33 -07:00
Jonathan Turner
117cbb879e Rollup merge of #35911 - tbu-:pr_io_errorkind_traits, r=alexcrichton
Implement more traits for `std::io::ErrorKind`

This makes it possible to use it as key in various maps.
2016-08-31 13:53:33 -07:00
Jonathan Turner
4bc5bcd812 Rollup merge of #35786 - GuillaumeGomez:paths_doc, r=steveklabnik
Improve Path and PathBuf docs

r? @steveklabnik
2016-08-31 13:53:33 -07:00