Commit Graph

73897 Commits

Author SHA1 Message Date
Vadzim Dambrouski
98dee04bae Add run-make test for no_integrated_as flag. 2018-01-16 16:00:31 +03:00
Robin Kruppe
9eb473579a Compute LLVM argument indices correctly in face of padding
Closes #47278
2018-01-16 12:49:38 +01:00
Pulkit Goyal
1e436eb236 return the boolean value directly instead of using if-else
Previous patch introduced something like if x {true} else {false} which can be
simply replaced by returning x here.

Thanks to @kennytm for spotting it.
2018-01-16 15:02:29 +05:30
Pulkit Goyal
fd075c6f21 implement "only-<platforms>" for test headers
This patch implements "only-<platforms>" for tests headers using which one can
specify just the platforms on which the test should run rather than listing all
the platforms to ignore using "ignore-<platforms>".

This is a fix for issues #33581 and #47459.
2018-01-16 14:37:05 +05:30
Zack M. Davis
661e03383c in which the private no-mangle lints receive a valued lesson in humility
The incompetent fool who added these suggestions in 38e5a964f2 apparently
thought it was safe to assume that, because the offending function or
static was unreachable, it would therefore have not have any existing
visibility modifiers, making it safe for us to unconditionally suggest
inserting `pub`. This isn't true.

This resolves #47383.
2018-01-16 00:31:43 -08:00
bors
da569fa9dd Auto merge of #47209 - eddyb:ccx, r=nikomatsakis
rustc_trans: reorganize CrateContext and rename context types.

Firstly, the `{Shared,Local}CrateContext` hasn't been meaningful for a while now, and this PR resolves it by moving all their fields to `CrateContext` and removing redundant accessor methods.

Secondly, this PR contains the following mass-renames:
* `ccx: CrateContext` -> `cx: CodegenCx`
* `mircx: MirContext` -> `fx: FunctionCx`
* `bcx: Builder` -> `bx: Builder`

r? @nikomatsakis
2018-01-16 08:06:15 +00:00
Robin Kruppe
2be697bc21 Implement repr(transparent) 2018-01-16 08:58:32 +01:00
Esteban Küber
a4660dfea2 Point at unused arguments for format string
Avoid overlapping spans by only pointing at the arguments that are not
being used in the argument string. Enable libsyntax to have diagnostics
with multiple primary spans by accepting `Into<MultiSpan>` instead of
`Span`.
2018-01-15 21:38:12 -08:00
Segev Finer
bfde33f2fb Add "-lmsvcrt" twice to get rustc to build with the latest mingw64 2018-01-16 07:27:04 +02:00
Wesley Wiser
45bd091e76 [incremental] Cache ty::Slice<T> hashes
Fixes #47294
2018-01-15 20:16:40 -05:00
Wesley Wiser
14780b310e [incremental] Cache AdtDef hashes
Part of #47294
2018-01-15 20:16:40 -05:00
Esteban Küber
282f75a4ce Review comments: remove enum suggestion 2018-01-15 15:20:48 -08:00
Esteban Küber
71c08734a3 Move ExprPrecedence to libsyntax/util/parser.rs 2018-01-15 15:09:39 -08:00
Esteban Küber
9b36030a65 On E0283, point at method with the requirements
On required type annotation diagnostic error, point at method with the
requirements if the span is available.
2018-01-15 14:56:32 -08:00
Esteban Küber
a0d44976bb Do not suggest to make mut binding external to Fn closure 2018-01-15 14:19:33 -08:00
Ariel Ben-Yehuda
dc44d41b98 remove noop landing pads in cleanup shims
These are already removed in the normal optimization pipeline - so this
should slightly improve codegen performance, as these cleanup blocks are
known to hurt LLVM.

This un-regresses and is therefore a fix for #47442. However, the
reporter of that issue should try using `-C panic=abort` instead of
carefully avoiding panics.
2018-01-16 00:07:06 +02:00
Adam C. Foltzer
8c09d29d04 Add -Z dep-info-omit-d-target to control dep-info style
This avoids a breaking change to dep-info output, putting the
gcc/clang-compliant dep-info behavior behind a flag
2018-01-15 13:19:46 -08:00
Adam C. Foltzer
7e99764df3 remove dep-info files as targets in themselves 2018-01-15 13:18:49 -08:00
Esteban Küber
4a7691692c Further tweaks to the output
- Properly address Variant Ctors
- Show signature if span of trait method without `self` is not available
2018-01-15 12:35:15 -08:00
Ryan Cumming
090a968fe7 Only link res_init() on GNU/*nix
To workaround a bug in glibc <= 2.26 lookup_host() calls res_init()
based on the glibc version detected at runtime. While this avoids
calling res_init() on platforms where it's not required we will still
end up linking against the symbol.

This causes an issue on macOS where res_init() is implemented in a
separate library (libresolv.9.dylib) from the main libc. While this is
harmless for standalone programs it becomes a problem if Rust code is
statically linked against another program. If the linked program doesn't
already specify -lresolv it will cause the link to fail. This is
captured in issue #46797

Fix this by hooking in to the glibc workaround in `cvt_gai` and only
activating it for the "gnu" environment on Unix This should include all
glibc platforms while excluding musl, windows-gnu, macOS, FreeBSD, etc.

This has the side benefit of removing the #[cfg] in sys_common; only
unix.rs has code related to the workaround now.
2018-01-16 06:30:44 +11:00
Esteban Küber
1820da5211 Move diagnostic logic to its own module
- Move specialized borrow checker diagnostic for bindings escaping its
  closure to its own module.
- Move affected tests to `ui`.
2018-01-15 11:12:25 -08:00
Carol (Nichols || Goulding)
e168aa385b
Reexport -> re-export in prose and documentation comments 2018-01-15 13:36:53 -05:00
Carol (Nichols || Goulding)
90fcd4476c
Reexport -> re-export in error messages 2018-01-15 13:36:52 -05:00
Carol (Nichols || Goulding)
c698496f84
Reexport -> re-export in documentation section headings 2018-01-15 13:36:52 -05:00
Marcel Hellwig
38e5d304fe extended dt with kbd tags
removed styling of dt tages, which would make them look like keys and
added <kbd> tag inside of dt tag.
Added css style for kbd and removed some stylings for dt
2018-01-15 18:12:38 +01:00
Christopher Vittal
f9e1b9c2c2 Add NLL test for #45045
Closes #45045
2018-01-15 11:14:47 -05:00
est31
38ddb446b9 Check for deadlinks from the summary during book generation
Previously, any deadlinks from a book's SUMMARY.md wouldn't
cause any errors or warnings or similar but mdbook would simply
create a page with blank content.

This has kept bug #47394 hidden. It should have been detected
back in the PR when those wrongly named files got added to the
book.

PR #47414 was one component of the solution. This change
is a second line of defense for the unstable book and a first
line of defense for any other book.

We also update mdbook to the most recent version.
2018-01-15 16:39:20 +01:00
bors
79a521bb9a Auto merge of #47413 - GuillaumeGomez:unstable-error-code, r=estebank
Add error code for unstable feature errors

Fixes #47397.
2018-01-15 15:36:54 +00:00
Esteban Küber
1a1afd74a6 Handle case of moving into vec with uninferred lifetime 2018-01-15 07:04:39 -08:00
Esteban Küber
2c5f2df201 Generalize cases where specific move error ocurrs
Trigger new diagnostic in `compile-fail/regions-escape-bound-fn.rs`
test, and not only in `compile-fail/regions-escape-bound-fn-2.rs`.
2018-01-15 07:04:38 -08:00
Esteban Küber
c31c60cbb9 Reword diagnostic 2018-01-15 07:04:38 -08:00
Esteban Küber
846042161c Custom error when moving arg outside of its closure
When given the following code:

```rust
fn give_any<F: for<'r> FnOnce(&'r ())>(f: F) {
    f(&());
}

fn main() {
    let mut x = None;
    give_any(|y| x = Some(y));
}
```

provide a custom error:

```
error: borrowed data cannot be moved outside of its closure
 --> file.rs:7:27
  |
6 |     let mut x = None;
  |         ----- binding declared outside of closure
7 |     give_any(|y| x = Some(y));
  |              ---          ^ cannot be assigned to binding outside of its closure
  |              |
  |              closure you can't escape
```

instead of the generic lifetime error:

```
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
 --> file.rs:7:27
  |
7 |     give_any(|y| x = Some(y));
  |                           ^
  |
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:14...
 --> file.rs:7:14
  |
7 |     give_any(|y| x = Some(y));
  |              ^^^^^^^^^^^^^^^
note: ...so that expression is assignable (expected &(), found &())
 --> file.rs:7:27
  |
7 |     give_any(|y| x = Some(y));
  |                           ^
note: but, the lifetime must be valid for the block suffix following statement 0 at 6:5...
 --> file.rs:6:5
  |
6 | /     let mut x = None;
7 | |     give_any(|y| x = Some(y));
8 | | }
  | |_^
note: ...so that variable is valid at time of its declaration
 --> file.rs:6:9
  |
6 |     let mut x = None;
  |         ^^^^^
```
2018-01-15 07:04:38 -08:00
Vadzim Dambrouski
3f61742cc0 Fix no_integrated_as option to work with new codegen architecture.
Old implementation called the assembler once per crate, but we need to call
it for each object file instead, because a single crate can now have more
than one object file.

This patch fixes issue #45836 (Can't compile core for msp430 in release mode)
2018-01-15 16:42:44 +03:00
bors
57850e5360 Auto merge of #47445 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests

- Successful merges: #47120, #47126, #47277, #47330, #47368, #47372, #47414, #47417, #47432, #47443
- Failed merges: #47334
2018-01-15 12:46:10 +00:00
kennytm
fa008c02f1
Rollup merge of #47443 - FenrirWolf:rand, r=alexcrichton
Remove leftover Rand stuff

The in-tree version of `rand` was removed in 6bc8f164b0, but for some reason this lone file avoided the purge. Figured it's about time to finish the job. 😈
2018-01-15 18:49:40 +08:00
kennytm
5d9d5ea712
Rollup merge of #47432 - etaoins:make-fulldeps-update-references-exec, r=petrochenkov
Make ui-fulldeps/update-references executable

When a ui-fulldeps comparison fails it suggests running update-references.sh:

```
src/test/ui-fulldeps/update-references.sh 'rust/build/x86_64-apple-darwin/test/ui-fulldeps' 'resolve-error.rs'
```

This does not work as update-references.sh isn't executable. The other update-references.sh in the ui directory is already executable so this looks like an oversight.
2018-01-15 18:49:39 +08:00
kennytm
2dc815c242
Rollup merge of #47417 - petrochenkov:noasm, r=estebank
Move "no asm" check into AST validation
2018-01-15 18:49:38 +08:00
kennytm
63f4285247
Rollup merge of #47414 - est31:master, r=alexcrichton
Enforce dashes in the unstable book file names

Also rename the existing underscore using files to use dashes.

Fixes #47394.
2018-01-15 18:49:37 +08:00
kennytm
f98a9a681e
Rollup merge of #47372 - topecongiro:issue-43925, r=alexcrichton
Avoid panicking when invalid argument is passed to cfg(..)

Closes #43925.
Closes #43926.
2018-01-15 18:49:36 +08:00
kennytm
afb1e193ef
Rollup merge of #47368 - chrisvittal:nll-tests, r=nikomatsakis
Add NLL tests for #46557 and #38899

This adapts the sample code from the two issues into test code.

Closes #46557
Closes #38899

r? @nikomatsakis
2018-01-15 18:49:34 +08:00
kennytm
6966f335ac
Rollup merge of #47330 - bmusin:patch-2, r=shepmaster
fix off-by-one error

Fixes https://github.com/rust-lang/rust/issues/47325.
2018-01-15 18:49:33 +08:00
kennytm
26c1ec300c
Rollup merge of #47277 - tspiteri:log-correctness, r=frewsxcv
doc: show that `f32::log` and `f64::log` are not correctly rounded

Fixes #47273.

One thing I'm not sure about is whether the "calculated as `self.ln() / base.ln()`" bit is being too specific, maybe we do not want to make this such a strong commitment. I think it's fine, but we should not make commitments in the API documentation by accident.

In case that is removed, the added sentence "`self.log2()` can ... base 10." still makes it amply clear that the `log` methods can be more inaccurate than other methods. If the above clause is removed, this second sentence can be moved to the first paragraph, kind of like the accuracy comment for the [`mul_add`](https://doc.rust-lang.org/std/primitive.f32.html#method.mul_add) method.
2018-01-15 18:49:32 +08:00
kennytm
5d0474ad73
Rollup merge of #47126 - sdroege:exact-chunks, r=bluss
Add slice::ExactChunks and ::ExactChunksMut iterators

These guarantee that always the requested slice size will be returned
and any leftoever elements at the end will be ignored. It allows llvm to
get rid of bounds checks in the code using the iterator.

This is inspired by the same iterators provided by ndarray.

Fixes https://github.com/rust-lang/rust/issues/47115

I'll add unit tests for all this if the general idea and behaviour makes sense for everybody.
Also see https://github.com/rust-lang/rust/issues/47115#issuecomment-354715511 for an example what this improves.
2018-01-15 18:49:31 +08:00
kennytm
06112abd5f
Rollup merge of #47120 - clarcharr:io_error_debug, r=dtolnay
Better Debug impl for io::Error.

This PR includes the below changes:

1. The former impl wrapped the entire thing in `Error { repr: ... }` which was unhelpful; this has been removed.
2. The `Os` variant of `io::Error` included the code and message, but not the kind; this has been fixed.
3. The `Custom` variant of `io::Error` included a `Custom(Custom { ... })`, which is now just `Custom { ... }`.

Example of previous impl:

```rust
Error {
    repr: Custom(
        Custom {
            kind: InvalidData,
            error: Error {
                repr: Os {
                    code: 2,
                    message: "no such file or directory"
                }
            }
        }
    )
}
```

Example of new impl:

```rust
Custom {
    kind: InvalidData,
    error: Os {
        code: 2,
        kind: NotFound,
        message: "no such file or directory"
    }
}
```
2018-01-15 18:49:30 +08:00
Esteban Küber
445f339ba9 address review comments 2018-01-15 02:03:03 -08:00
Esteban Küber
38546ba9fa Add note when trying to use Self as a ctor 2018-01-15 02:03:03 -08:00
Esteban Küber
ce9ef37fe6 Readd suggestion in enum variants with incorrect args 2018-01-15 02:03:03 -08:00
Esteban Küber
a317da42b1 Suggest the correct syntax for different struct types 2018-01-15 02:03:02 -08:00
Esteban Küber
9bab0f09d3 Hide suggestion to use struct ctor when it is not visible 2018-01-15 02:03:02 -08:00
Esteban Küber
afe8d13a66 Use single source of truth for expr precedence
Introduce a new unified type that holds the expression precedence for
both AST and HIR nodes.
2018-01-15 02:02:37 -08:00