Commit Graph

82284 Commits

Author SHA1 Message Date
David Wood
2c6b0e5cf7
Label definition of captured variables in errors. 2018-08-14 17:36:03 +02:00
David Wood
51b0552bd7
Added some debug logging. 2018-08-14 17:36:00 +02:00
bors
23f09bbed4 Auto merge of #53085 - ljedrz:cleanup_syntax_structures, r=ljedrz
Move SmallVector and ThinVec out of libsyntax

- move `libsyntax::util::SmallVector` tests to `librustc_data_structures::small_vec`
- remove `libsyntax::util::SmallVector`
- move `libsyntax::util::thin_vec` to `librustc_data_structures::thin_vec`

Other than moving these data structures where they belong it allows modules using `SmallVector<T>` (`SmallVec<[T; 1]>`) to specify their own length (e.g. 8 or 32) independently from `libsyntax`.
2018-08-14 15:09:37 +00:00
memoryruins
f4bed39c5c Add regression test for issue #30104
#30104
2018-08-14 10:26:47 -04:00
memoryruins
a7e877ebdd Add regression test for issue #48697
#48697
2018-08-14 10:25:54 -04:00
Hideki Sekine
ad78c2fc55 add copyright from template 2018-08-14 23:19:12 +09:00
Hideki Sekine
e9c2de89c1 shorten the url to fix tidy error. 2018-08-14 22:54:56 +09:00
Hideki Sekine
10395f3137 change variable definition order (basic thing first). 2018-08-14 22:40:30 +09:00
Hideki Sekine
62b3935298 use TMPDIR instead of custom directory. 2018-08-14 22:38:27 +09:00
Hideki Sekine
5c654f27b7 use a simple script instead of cargo clone. 2018-08-14 22:35:11 +09:00
bors
f45f52532a Auto merge of #53196 - davidtwco:compile-fail-to-ui, r=nikomatsakis
Move `compile-fail` tests to `ui`

Fixes #46841, #52531, #44844.

r? @nikomatsakis
2018-08-14 12:55:23 +00:00
bors
d67ba90dab Auto merge of #53335 - eddyb:issue-53333, r=petrochenkov
rustc_resolve: crates only exist in the type namespace.

Fixes #53333 by resolving `::crate_name` in `TypeNS` alone, which was overlooked in #52923 and didn't break tests, since having `use crate_name;` and a `crate_name` value in the same scope is rare.
2018-08-14 10:41:55 +00:00
David Wood
7b026568f7
Moved problematic tests on x86_64-gnu-nopt back to compile-fail. 2018-08-14 11:12:13 +02:00
David Wood
d775e6132c
Moved problematic tests on x86_64-pc-windows-gnu back to compile-fail. 2018-08-14 11:12:12 +02:00
David Wood
67ec37b608
Moved problematic tests on armhf-gnu back to compile-fail. 2018-08-14 11:12:12 +02:00
David Wood
4b2464592c
Moved problematic tests on wasm32-unknown back to compile-fail. 2018-08-14 11:12:12 +02:00
David Wood
f7f7c1eef3
Moved problematic tests on dist-x86_64-musl back to compile-fail. 2018-08-14 11:12:12 +02:00
David Wood
b8b7a3c30e
Moved problematic tests on i586-unknown-linux-gnu back to compile-fail. 2018-08-14 11:12:12 +02:00
David Wood
768998a8de
Normalize tests for i686 Windows. 2018-08-14 11:12:11 +02:00
David Wood
cd12c82210
Fixed 'no such file or directory' mismatch between Windows and Linux. 2018-08-14 11:12:11 +02:00
David Wood
0cfc17358a
Moved problematic tests on Windows back to compile-fail. 2018-08-14 11:12:11 +02:00
David Wood
a922642455
Moved tests back to compile-test if they don't work on ui. 2018-08-14 11:12:11 +02:00
David Wood
7c13eb42d4
Fix no-link-with-link-args by introducing another normalization. 2018-08-14 11:12:10 +02:00
David Wood
003b5a8b0f
Normalize crateresolve1.rs to support different candidate ordering between executions. 2018-08-14 11:12:10 +02:00
David Wood
8e7b9b8117
Suggested trait implementation ordering is now deterministic. 2018-08-14 11:12:10 +02:00
David Wood
dc5a6571a6
Fixed truncated path not being normalized. 2018-08-14 11:12:10 +02:00
David Wood
2ad663c1cd
Normalize test build directory and root build directory. 2018-08-14 11:12:10 +02:00
David Wood
ed79c31f09
Tidy no longer fails when there are no files or subdirectories in a test directory. 2018-08-14 11:12:09 +02:00
David Wood
3fc7ab2373
Merged migrated compile-fail tests and ui tests. Fixes #46841. 2018-08-14 11:12:09 +02:00
David Wood
3e0a407988
Updated new UI tests to pass with NLL compare-mode
These tests need a review to ensure that those marked as
ignore-compare-mode-nll should be ignored and that this isn't a bug in NLL.
2018-08-14 10:38:00 +02:00
David Wood
b16a30677f
Moved compile-fail tests to ui tests. 2018-08-14 10:38:00 +02:00
David Wood
fe28bcf1db
Check error-patterns on UI tests. Fixes #52531.
Previously, even if no expected errors were supplied, if a test execution failed
then supplied error patterns would not be checked. This commit modifies the
conditional that determines whether error patterns or expected errors are checked
to remedy this.

Further, this commit modifies the error pattern checking logic so that each pattern
is checked against all lines of the string. This is required for UI tests as the
stderr is in JSON format - all on one line - so in the previous implementation when the
first pattern was found on the first line (which was actually the entire error) then
no other patterns would be found on subsequent lines (as there weren't any).
2018-08-14 10:37:54 +02:00
bors
5bb923988f Auto merge of #53033 - RalfJung:manually_dro, r=SimonSapin
unsized ManuallyDrop

I think this matches what @eddyb had in https://github.com/rust-lang/rust/pull/52711 originally.

~~However, I have never added a `CoerceUnsized` before so I am not sure if I did this right. I copied the `unstable` attribute on the `impl` from elsewhere, but AFAIK it is useless because `impl`'s are insta-stable... so shouldn't this rather say "stable since 1.30"?~~

This is insta-stable and hence requires FCP, at least.

Fixes https://github.com/rust-lang/rust/issues/47034
2018-08-14 08:32:59 +00:00
Eduard-Mihai Burtescu
262392cd32 rustc_resolve: crates only exist in the type namespace. 2018-08-14 11:26:44 +03:00
bors
a8763b5370 Auto merge of #52895 - draganmladjenovic:minmax_qnan, r=alexcrichton
run-pass/simd-intrinsic-float-minmax: Force use of qNaN on Mips

Workaround for #52746.
r? @gnzlbg
2018-08-14 06:31:10 +00:00
bors
3e05f80a37 Auto merge of #52923 - eddyb:relative-imports, r=petrochenkov
#[feature(uniform_paths)]: allow `use x::y;` to resolve through `self::x`, not just `::x`.

_Branch originally by @cramertj, based on @petrochenkov's [description on the internals forum](https://internals.rust-lang.org/t/relative-paths-in-rust-2018/7883/30?u=petrochenkov)._
_(note, however, that the approach has significantly changed since)_

Implements `#[feature(uniform_paths)]` from #53130, by treating unqualified `use` paths as maybe-relative. That is, `use x::y;`, where `x` is a plain identifier (not a keyword), is no longer the same as `use ::y;`, and before picking an external crate named `x`, it first looks for an item named `x` in the same module (i.e. `self::x`) and prefers that local item instead.

Such a "maybe-relative" `x` can only resolve to an external crate if it's listed in "`extern_prelude`" (i.e. `core` / `std` and all the crates passed to `--extern`; the latter includes Cargo dependencies) - this is the same condition as being able to refer to the external crate from an unqualified, non-`use` path.
All other crates must be explicitly imported with an absolute path, e.g. `use ::y;`

To detect an ambiguity between the external crate and the local item with the same name, a "canary" import (e.g. `use self::x as _;`), tagged with the `is_uniform_paths_canary` flag, is injected. As the initial implementation is not sophisticated enough to handle all possible ways in which `self::x` could appear (e.g. from macro expansion), this also guards against accidentally picking the external crate, when it might actually get "shadowed" later.
Also, more canaries are injected for each block scope around the `use`, as `self::x` cannot resolve to any items named `x` in those scopes, but non-`use` paths can, and that could be confusing or even backwards-incompatible.

Errors are emitted only if the main "canary" import succeeds while an external crate exists (or if any of the block-scoped ones succeed at all), and ambiguities have custom error reporting, e.g.:
```rust
#![feature(uniform_paths)]
pub mod foo {
    use std::io;
    pub mod std { pub mod io {} }
}
```
```rust
error: import from `std` is ambiguous
 --> test.rs:3:9
  |
3 |     use std::io;
  |         ^^^ could refer to external crate `::std`
4 |     pub mod std { pub mod io {} }
  |     ----------------------------- could also refer to `self::std`
  |
  = help: write `::std` or `self::std` explicitly instead
  = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
```
Another example, this time with a block-scoped item shadowing a module-scoped one:
```rust
#![feature(uniform_paths)]
enum Foo { A, B }
fn main() {
    enum Foo {}
    use Foo::*;
}
```
```rust
error: import from `Foo` is ambiguous
 --> test.rs:5:9
  |
4 |     enum Foo {}
  |     ----------- shadowed by block-scoped `Foo`
5 |     use Foo::*;
  |         ^^^
  |
  = help: write `::Foo` or `self::Foo` explicitly instead
  = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
```

Additionally, this PR, because replacing "the `finalize_import` hack" was a blocker:
* fixes #52140
* fixes #52141
* fixes #52705

cc @aturon @joshtriplett
2018-08-14 04:22:14 +00:00
Eduard-Mihai Burtescu
13bc0b5a48 rustc_resolve: also inject canaries to detect block scopes shadowing uniform_paths imports. 2018-08-14 07:06:50 +03:00
Eduard-Mihai Burtescu
2ad865d601 rustc_resolve: inject ambiguity "canaries" when #![feature(uniform_paths)] is enabled. 2018-08-14 07:06:50 +03:00
Taylor Cramer
39ce9ef00e #[feature(uniform_paths)]: allow use x::y; to resolve through self::x, not just ::x. 2018-08-14 07:06:50 +03:00
Eduard-Mihai Burtescu
f9b1176eef rustc_resolve: fix special-case for one-segment import paths. 2018-08-14 07:06:50 +03:00
Eduard-Mihai Burtescu
cd47831bf0 syntax: gensym the injected std/core extern crates in the Rust 2018 edition. 2018-08-14 07:06:46 +03:00
memoryruins
e390182602 [nll] add regression test for issue #27868 2018-08-13 22:45:02 -04:00
Alex Crichton
2438cfc755 Fix usage of wasm_target_feature 2018-08-13 18:03:06 -07:00
David Tolnay
69b9c23b38
Address review of RcVec 2018-08-13 17:09:13 -07:00
Esteban Küber
397db46ae3 Mark prior failure to avoid ICE
Fix #53251
2018-08-13 15:28:18 -07:00
Eduard-Mihai Burtescu
5218a5cf35 syntax: add uniform_paths feature-gate. 2018-08-14 01:18:05 +03:00
Tristan Burgess
8895e3bcb0 52985: cause cycle err on inf trait normalization
- If an existential type is defined, but no user code infers the
concrete type behind the existential type, normalization would
infinitely recurse on this existential type which is only defined in
terms of itself.
  - Instead of raising an inf recurse error, we cause a cycle error to
help highlight that the issue is that the type is only defined in terms
of itself.
  - Three known potential improvements:
    - If type folding itself was exposed as a query, used by
normalization and other mechanisms, cases that would cause infinite recursion would
automatically cause a cycle error.
    - The span for the cycle error should be improved to point to user
code that fails to allow inference of the concrete type of the existential type,
assuming that this error occurs because no user code can allow inference the
concrete type.
    - A mechanism to extend the cycle error with a helpful note would be nice. Currently,
the error is built and maintained by src/librustc/ty/query/plumbing,
with no known way to extend the information that the error gets built
with.
2018-08-13 18:09:45 -04:00
Andre Bogus
05ddad37d1 use ? to simplify TransitiveRelation.maybe_map 2018-08-13 23:12:36 +02:00
ljedrz
e5e6375352 Move SmallVec and ThinVec out of libsyntax 2018-08-13 22:11:57 +02:00
Esteban Küber
d35e2677fc review comment 2018-08-13 12:57:21 -07:00