Commit Graph

75315 Commits

Author SHA1 Message Date
bors
257ec08e10 Auto merge of #48757 - alexcrichton:fix-msbuild-build, r=Mark-Simulacrum
rustbuild: Fix MSBuild location of `llvm-config.exe`

For LLD integration the path to `llvm-config` needed to change to inside the
build directory itself (for whatever reason) but the build directory is
different on MSBuild than it is on `ninja` for MSVC builds, so the path to
`llvm-config.exe` was actually wrong and not working!

This commit removes the `Build::llvm_config` function in favor of the source of
truth, the `Llvm` build step itself. The build step was then updated to find the
right build directory for MSBuild as well as `ninja` for where `llvm-config.exe`
is located.

Closes #48749
2018-03-09 19:02:13 +00:00
Alex Crichton
be902e7168 rustbuild: Fix MSBuild location of llvm-config.exe
For LLD integration the path to `llvm-config` needed to change to inside the
build directory itself (for whatever reason) but the build directory is
different on MSBuild than it is on `ninja` for MSVC builds, so the path to
`llvm-config.exe` was actually wrong and not working!

This commit removes the `Build::llvm_config` function in favor of the source of
truth, the `Llvm` build step itself. The build step was then updated to find the
right build directory for MSBuild as well as `ninja` for where `llvm-config.exe`
is located.

Closes #48749
2018-03-09 07:29:08 -08:00
bors
fedce67cd2 Auto merge of #48326 - RalfJung:generic-bounds, r=petrochenkov
Warn about ignored generic bounds in `for`

This adds a new lint to fix #42181. For consistency and to avoid code duplication, I also moved the existing "bounds in type aliases are ignored" here.

Questions to the reviewer:
* Is it okay to just remove a diagnostic error code like this? Should I instead keep the warning about type aliases where it is? The old code provided a detailed explanation of what's going on when asked, that information is now lost. On the other hand, `span_warn!` seems deprecated (after this patch, it has exactly one user left!).
* Did I miss any syntactic construct that can appear as `for` in the surface syntax? I covered function types (`for<'a> fn(...)`), generic traits (`for <'a> Fn(...)`, can appear both as bounds as as trait objects) and bounds (`for<'a> F: ...`).
* For the sake of backwards compatibility, this adds a warning, not an error. @nikomatsakis suggested an error in https://github.com/rust-lang/rust/issues/42181#issuecomment-306924389, but I feel that can only happen in a new epoch -- right?

Cc @eddyb
2018-03-09 10:45:29 +00:00
bors
2079a084df Auto merge of #48860 - Manishearth:rollup, r=Manishearth
Rollup of 5 pull requests

- Successful merges: #48527, #48588, #48801, #48856, #48857
- Failed merges:
2018-03-09 03:59:42 +00:00
Manish Goregaokar
b65b171f44
Rollup merge of #48857 - Songbird0:improve_column_macro_documentation, r=joshtriplett
Modify part of `column!` documentation.

Just like `line!` documentation, I've replaced:

> The returned column is not the invocation of the `column!` macro itself

By

> The returned column is *not necessarily* the line of the `column!` invocation itself

See #46997.
2018-03-08 17:25:59 -08:00
Manish Goregaokar
5ab485599d
Rollup merge of #48856 - Songbird0:improve_line_macro_documentation, r=joshtriplett
Modify part of `line!` documentation.

In accordance with #46997, I've replaced:

> The returned line is not the invocation of the line! macro itself [...]

By

> The returned line is *not necessarily* the line of the `line!` invocation itself [...]
2018-03-08 17:25:58 -08:00
Manish Goregaokar
68e7282aa8
Rollup merge of #48801 - Manishearth:epoch-features, r=nikomatsakis
Add functionality for gating feature flags on epochs ; rejigger epoch lints

fixes #48794

r? @nikomatsakis
2018-03-08 17:25:57 -08:00
Manish Goregaokar
b0bc601dcc
Rollup merge of #48588 - alexcrichton:termcolor, r=BurntSushi
rustc: Migrate to `termcolor` crate from `term`

This crate moves the compiler's error reporting to using the `termcolor` crate
from crates.io. Previously rustc used a super-old version of the `term` crate
in-tree which is basically unmaintained at this point, but Cargo has been using
`termcolor` for some time now and tools like `rg` are using `termcolor` as well,
so it seems like a good strategy to take!

Note that the `term` crate remains in-tree for libtest. Changing libtest will be
a bit tricky due to how the build works, but we can always tackle that later.

cc #45728
2018-03-08 17:25:56 -08:00
Manish Goregaokar
b228b053ec
Rollup merge of #48527 - zackmdavis:and_the_social_construction_of_tuples, r=estebank
in which parentheses are suggested for should-have-been-tuple-patterns

![destructure_suggest_parens](https://user-images.githubusercontent.com/1076988/36638335-48b082d4-19a7-11e8-9726-0d043544df2f.png)

Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.

Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).

Instead, let's look for that comma when parsing the pattern, and if we
see it, make-believe that we're parsing the remaining elements in a
tuple pattern, so that we can suggest wrapping it all in parentheses. We
need to do this in a separate wrapper method called on a "top-level"
pattern, rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.

~~We could also do this for `match` arms, `if let`, and `while let`, but
we elect not to in this patch, as it seems less likely for users to make
the mistake in those contexts.~~

Resolves #48492.

r? @petrochenkov
2018-03-08 17:25:55 -08:00
Manish Goregaokar
a08cfc4cb6 Add rust_2018_idioms lint group 2018-03-08 17:10:06 -08:00
Manish Goregaokar
667973204d Note the future epoch for epoch lints 2018-03-08 17:10:06 -08:00
Manish Goregaokar
fbe57cf13e Make bare_trait_object not be an epoch lint 2018-03-08 17:10:06 -08:00
Manish Goregaokar
ae5ae846cd Make tyvar_behind_raw_pointer an epoch lint 2018-03-08 17:10:05 -08:00
Manish Goregaokar
29542ec85a Add test 2018-03-08 17:10:05 -08:00
Manish Goregaokar
197f35c3e0 Make bare_trait_lint allow for now 2018-03-08 17:10:05 -08:00
Manish Goregaokar
b88a61e36e Make it possible to ungate features by epoch 2018-03-08 17:10:05 -08:00
Manish Goregaokar
c3fe3a56c2 Allow mentioning an optional epoch on features 2018-03-08 17:10:05 -08:00
Manish Goregaokar
4338bd178d Move epochs to libsyntax 2018-03-08 17:10:03 -08:00
Anthony Defranceschi
a0758cdcff Modify part of column! documentation.
Just like `line!` documentation, I've replaced:

> The returned column is not the invocation of the `column!` macro itself

By

> The returned column is *not necessarily* the line of the `column!` invocation itself

See #46997.
2018-03-09 00:43:54 +01:00
Anthony Defranceschi
2d7472fadc Modify part of line! documentation.
In accordance with #46997, I've replaced:

> The returned line is not the invocation of the line! macro itself [...]

By

> The returned line is *not necessarily* the line of the `line!` invocation itself [...]
2018-03-09 00:36:07 +01:00
bors
604d4ce757 Auto merge of #48849 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests

- Successful merges: #48292, #48682, #48699, #48738, #48752, #48789, #48808
- Failed merges:
2018-03-08 22:08:21 +00:00
Zack M. Davis
1f04597c3c in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.

Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).

Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.

Resolves #48492.
2018-03-08 11:30:34 -08:00
Manish Goregaokar
457975369b
Rollup merge of #48808 - Zoxc:reg-diag, r=michaelwoerister
Move REGISTERED_DIAGNOSTICS to a ParseSess field

r? @michaelwoerister
2018-03-08 11:26:02 -08:00
Manish Goregaokar
d17eb8f68e
Rollup merge of #48789 - GuillaumeGomez:horizontal-scroll, r=QuietMisdreavus
Fix sidebar horizontal scroll

Just like @onur said.

r? @QuietMisdreavus
2018-03-08 11:26:00 -08:00
Manish Goregaokar
c8a73e438a
Rollup merge of #48752 - alexcrichton:fix-target-feature, r=michaelwoerister
rustc: Fix ICE with `#[target_feature]` on module

This commit fixes an ICE in rustc when `#[target_feature]` was applied to items
other than functions due to the way the feature was validated.
2018-03-08 11:25:59 -08:00
Manish Goregaokar
7c581b08fa
Rollup merge of #48738 - Songbird0:parseinterror_potential_cause, r=joshtriplett
Add a potential cause raising `ParseIntError`.

Initially, I wanted to add it directly to the documentation of `str. parse()` method, I finally found that it was more relevant (I hope so?) to directly document the structure in question. I've added a scenario, in which we could all get caught at least once, to make it easier to diagnose the problem when parsing integers.
2018-03-08 11:25:58 -08:00
Manish Goregaokar
6d0d34336d
Rollup merge of #48699 - frewsxcv:frewsxcv-impl-trait, r=nikomatsakis
Replace iterator structures with `impl Trait`.

Two commits:

* Replace iterator structures with `impl Trait`.
* Run rustfmt on `src/librustc_data_structures/graph/mod.rs`.
2018-03-08 11:25:57 -08:00
Manish Goregaokar
d7f44ac52c
Rollup merge of #48682 - spastorino:make_causal_lazy, r=nikomatsakis
[NLL] Make causal tracking lazy

Close #46590

cc @nikomatsakis
2018-03-08 11:25:56 -08:00
Manish Goregaokar
f12d5aa517
Rollup merge of #48292 - topecongiro:from_str-for-path-and-pathbuf, r=alexcrichton
Implement FromStr for PathBuf

Closes #44431.
2018-03-08 11:25:54 -08:00
bors
c90f68224b Auto merge of #46882 - oli-obk:miri3, r=eddyb
Replace all const evaluation with miri

* error reporting in constants prints a stacktrace through all called const fns
* Trivial constant propagation and folding in MIR (always active, irrelevant of the optimization level)
* can now use floating constants in patterns (previously only floating point literals were allowed)
    * the future compat lint is still produced for both cases
* can index into constant arrays during const eval (previously feature gated)
* can create a constant union value with field `a` and read from field `b`
* can dereference references into constants
* can create references inside constants (`const X: &u32 = &22`)
* Tuple struct constructors can be used in constants
* regression in const eval errors spans (some of these need improvements in mir debug info)
* can cast floats to ints and vice versa (in constants, and even nan/inf constants)
* Mir dump prints false/true instead of 0u8/1u8
* `1i8 >> [8][0]` does not lint about exceeding bitshifts anymore.
    * Needs const propagation across projections
* `foo[I]` produces a const eval lint if `foo: [T; N]` and `N < I`
    * Essentially all builtin panics produce lints if they can be statically proven to trigger at runtime. This is on a best effort basis, so there might be some complex cases that don't trigger. (The runtime panic stays there, irrelevant of whether the lint is produced or not)
* can use `union`s to implement `transmute` for `Copy` types in constants without a feature gate. With all the greatness and nasal demons that come with this.
* can convert integers to `&'static T` in constants (useful for embedded)

fixes #34997 (stack overflow with many constants)
fixes #25574 (deref byte strings in patterns)
fixes #27918 (broken mir ICE)
fixes #46114 (ICE on struct constructors in patterns)
fixes #37448 (`SomeStruct { foo } as SomeStruct`)
fixes #43754 (`return` in const fn)
fixes #41898 (tuple struct constructors)
fixes #31364 (infinite recursion with const fn, fixed by miri's recursion limit)
closes #29947 (const indexing stabilization)
fixes #45044 (pattern matching repeat expressions)
fixes #47971 (ICE on const fn + references)
fixes #48081 (ICE on cyclic assoc const error)
fixes #48746 (nonhelpful error message with unions)

r? @eddyb

even though 1k loc are added in tests, this PR reduces the loc in this repository by 700
2018-03-08 08:52:23 +00:00
Oliver Schneider
52dec0e1c9
Don't derive traits on packed structs 2018-03-08 08:35:39 +01:00
Oliver Schneider
47e0bb59db
Clean up the binary hex lint 2018-03-08 08:35:39 +01:00
Oliver Schneider
c0fc6a8b6b
simplify constant value pair field access 2018-03-08 08:35:39 +01:00
Oliver Schneider
b5ace9a906
Unify the const folding errors
before they differed depending on whether optimizations were on or not
2018-03-08 08:35:39 +01:00
Oliver Schneider
edc5f73433
Correct the shift overflow check in miri 2018-03-08 08:35:39 +01:00
Oliver Schneider
aedd4c61ea
Regenerate tests 2018-03-08 08:35:38 +01:00
Oliver Schneider
6cfda078bf
Use clearer name for integer bit width helper function 2018-03-08 08:35:38 +01:00
Oliver Schneider
eb18d39a04
Reuse Integer::from_attr 2018-03-08 08:35:38 +01:00
Oliver Schneider
273025675d
Remove unused error code 2018-03-08 08:35:38 +01:00
Oliver Schneider
3dc7e93db6
Generator assertions are unconditionally triggered 2018-03-08 08:35:38 +01:00
Oliver Schneider
47913ee8f4
Address review comments 2018-03-08 08:35:38 +01:00
Oliver Schneider
208d764833
Adjust test which differs between 32 bit and 64 bit
The differences are not part of what the test is testing, so they were simply removed.
2018-03-08 08:35:38 +01:00
Oliver Schneider
e8d357f070
Decide signdedness on the layout instead of the type 2018-03-08 08:35:37 +01:00
Oliver Schneider
889a4ebfa9
Deduplicate some code 2018-03-08 08:34:18 +01:00
Oliver Schneider
df283df887
Don't use the undefined bytes of PrimVal::Bytes 2018-03-08 08:34:18 +01:00
Oliver Schneider
7218836500
Fix mozjs crater failure 2018-03-08 08:34:18 +01:00
Oliver Schneider
134c2910ec
Const eval will oom together with rustc now 2018-03-08 08:34:18 +01:00
Oliver Schneider
0ca4b45a0c
Step limit is now terminator limit 2018-03-08 08:34:17 +01:00
Oliver Schneider
b63c6bbfee
Add regression test 2018-03-08 08:34:17 +01:00
Oliver Schneider
d98a2b90b2
Rebase fallout 2018-03-08 08:34:17 +01:00