Commit graph

1017 commits

Author SHA1 Message Date
Esteban Küber
5217007a20 Tweak output and add test cases 2020-10-09 14:44:24 -07:00
Esteban Küber
711760c8ec Point out why a trait is expected on Struct + 'lt 2020-10-09 14:44:24 -07:00
bors
53a4c3b0ba Auto merge of #77690 - est31:llvm_8_required, r=matthewjasper
Simplify some code in rustc_llvm/build.rs now that LLVM 8 is required

LLVM 8 is required since 8506bb0060
so this is safe to do.
2020-10-09 12:23:49 +00:00
bors
6b8b396aee Auto merge of #77698 - vandenheuvel:chalkup, r=jackh726
Update chalk to 0.32.0

r? `@jackh726`
2020-10-09 10:32:52 +00:00
bors
fc3d8e3fcc Auto merge of #77687 - est31:hash_shorter_path, r=davidtwco
Use shorter path for std:#️⃣:Hash
2020-10-09 08:09:32 +00:00
bors
2359ecc71f Auto merge of #77578 - euclio:max-suggestion, r=davidtwco
suggest `MAX` constant if -1 is assigned to unsigned type

Fixes #76413.
Fixes #77416.
2020-10-09 04:22:18 +00:00
bors
03ef8a081e Auto merge of #76260 - xd009642:rfc/2867, r=jonas-schievink
Implementation of RFC2867

https://github.com/rust-lang/rust/issues/74727

So I've started work on this, I think my next steps are to make use of the `instruction_set` value in the llvm codegen but this is the point where I begin to get a bit lost. I'm looking at the code but it would be nice to have some guidance on what I've currently done and what I'm doing next 😄
2020-10-09 00:29:47 +00:00
bors
8a84c4f9c8 Auto merge of #77723 - jonas-schievink:rollup-htz44r4, r=jonas-schievink
Rollup of 8 pull requests

Successful merges:

 - #76750 (Don't discourage implementing `core::fmt::Write`)
 - #77449 (BTreeMap: comment why drain_filter's size_hint is somewhat pessimistic)
 - #77660 ((docs): make mutex error comment consistent with codebase)
 - #77663 (Add compile fail test for issue 27675)
 - #77673 (Remove unnecessary lamda on emitter map.)
 - #77701 (Make `max_log_info` easily greppable (for figuring out why debug logging is disabled))
 - #77702 (Remove not needed lambda.)
 - #77710 (Update submodule llvm to get LVI bugfix)

Failed merges:

r? `@ghost`
2020-10-08 22:37:37 +00:00
xd009642
a6e2b636e6 Implement the instruction_set attribute 2020-10-08 23:32:20 +01:00
Jonas Schievink
dd09561311
Rollup merge of #77702 - heckad:patch-3, r=lcnr
Remove not needed lambda.
2020-10-08 23:23:17 +02:00
Jonas Schievink
48c1ca15bb
Rollup merge of #77673 - heckad:patch-2, r=lcnr
Remove unnecessary lamda on emitter map.
2020-10-08 23:23:13 +02:00
bors
3525087ada Auto merge of #77110 - lzutao:e0596-amp_mut, r=davidtwco
Suggest removing `&mut` from a `&mut borrow`

Modify the code added in #54720.

Closes  #75871
2020-10-08 20:43:01 +00:00
Andy Russell
ced11a83cb
suggest MAX constant if -1 is assigned to unsigned type 2020-10-08 13:11:31 -04:00
Lzu Tao
ab226bda9a Suggest removing &mut from borrow of &mut
Fix a typo: minding -> binding
Add test for &mut &mut
2020-10-08 14:26:21 +00:00
bors
ccea570488 Auto merge of #77678 - jyn514:tracing, r=Mark-Simulacrum
Upgrade to tracing-subscriber 0.2.13

The primary motivation is to get the changes from
https://github.com/tokio-rs/tracing/pull/990. Example output:

```
$ RUSTDOC_LOG=debug rustdoc +rustc2
warning: some trace filter directives would enable traces that are disabled statically
 | `debug` would enable the DEBUG level for all targets
 = note: the static max level is `info`
 = help: to enable DEBUG logging, remove the `max_level_info` feature
```

r? `@Mark-Simulacrum`
cc `@hawkw` ❤️
2020-10-08 13:38:29 +00:00
Kazantcev Andrey
3450cf61e0
Remove not needed lambda. 2020-10-08 16:22:31 +03:00
bors
382848989f Auto merge of #77581 - ecstatic-morse:dataflow-dump-mir-graphviz, r=davidtwco
Use `pretty::create_dump_file` for dumping dataflow results

The old code wasn't incorporating promoteds into the path, meaning other `dot` files could get clobbered. Use the MIR dump infrastructure to generate paths so that this doesn't occur in the future.
2020-10-08 11:42:24 +00:00
Bram van den Heuvel
e185278534 Update chalk to 0.32.0 2020-10-08 13:17:01 +02:00
Kazantcev Andrey
dd60ab3e2d
Commit suggestion
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-10-08 13:58:51 +03:00
est31
8b8e706008 Simplify some code in rustc_llvm/build.rs now that LLVM 8 is required
LLVM 8 is required since 8506bb0060
so this is safe to do.
2020-10-08 06:19:06 +02:00
bors
d9985fc108 Auto merge of #75470 - estebank:bare-type-expr, r=davidtwco
Detect blocks that could be struct expr bodies

This approach lives exclusively in the parser, so struct expr bodies
that are syntactically correct on their own but are otherwise incorrect
will still emit confusing errors, like in the following case:

```rust
fn foo() -> Foo {
    bar: Vec::new()
}
```

```
error[E0425]: cannot find value `bar` in this scope
 --> src/file.rs:5:5
  |
5 |     bar: Vec::new()
  |     ^^^ expecting a type here because of type ascription

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
 --> src/file.rs:5:15
  |
5 |     bar: Vec::new()
  |               ^^^^^ only `Fn` traits may use parentheses

error[E0107]: wrong number of type arguments: expected 1, found 0
 --> src/file.rs:5:10
  |
5 |     bar: Vec::new()
  |          ^^^^^^^^^^ expected 1 type argument
  ```

If that field had a trailing comma, that would be a parse error and it
would trigger the new, more targetted, error:

```
error: struct literal body without path
 --> file.rs:4:17
  |
4 |   fn foo() -> Foo {
  |  _________________^
5 | |     bar: Vec::new(),
6 | | }
  | |_^
  |
help: you might have forgotten to add the struct literal inside the block
  |
4 | fn foo() -> Foo { Path {
5 |     bar: Vec::new(),
6 | } }
  |
```

Partially address last remaining part of #34255.
2020-10-08 01:37:27 +00:00
est31
7367cfef59 Use shorter path for std:#️⃣:Hash 2020-10-08 03:25:01 +02:00
bors
e055f87cdf Auto merge of #77597 - simonvandel:uninhabited-hashset, r=jonas-schievink
perf: UninhabitedEnumBranching avoid n^2

Avoid n² complexity. This showed up in a profile for match-stress-enum that has 8192 variants

I have only profiled locally against `match-stress-enum`, so we should have it perf tested to make sure it does not regress other crates.
2020-10-07 23:44:57 +00:00
Joshua Nelson
8b22d079bf Upgrade to tracing 0.2.13
The primary motivation is to get the changes from
https://github.com/tokio-rs/tracing/pull/990. Example output:

```
$ RUSTDOC_LOG=debug rustdoc +rustc2
warning: some trace filter directives would enable traces that are disabled statically
 | `debug` would enable the DEBUG level for all targets
 = note: the static max level is `info`
 = help: to enable DEBUG logging, remove the `max_level_info` feature
```

- Remove useless test

  This was testing for an ICE when passing `RUST_LOG=rustc_middle`.  I
  noticed it because it started giving the tracing warning (because tests
  are not run with debug-logging enabled). Since this bug seems unlikely
  to re-occur, I just removed it altogether.
2020-10-07 19:27:10 -04:00
bors
91a79fb29a Auto merge of #76985 - hbina:clone_check, r=estebank
Prevent stack overflow in deeply nested types.

Related issue #75577 (?)

Unfortunately, I am unable to test whether this actually solves the problem because apparently, 12GB RAM + 2GB swap is not enough to compile the (admittedly toy) source file.
2020-10-07 21:51:12 +00:00
Kazantcev Andrey
141544a903
Remove unnecessary lamda on emitter map. 2020-10-08 00:29:20 +03:00
Esteban Küber
e5f83bcd04 Detect blocks that could be struct expr bodies
This approach lives exclusively in the parser, so struct expr bodies
that are syntactically correct on their own but are otherwise incorrect
will still emit confusing errors, like in the following case:

```rust
fn foo() -> Foo {
    bar: Vec::new()
}
```

```
error[E0425]: cannot find value `bar` in this scope
 --> src/file.rs:5:5
  |
5 |     bar: Vec::new()
  |     ^^^ expecting a type here because of type ascription

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
 --> src/file.rs:5:15
  |
5 |     bar: Vec::new()
  |               ^^^^^ only `Fn` traits may use parentheses

error[E0107]: wrong number of type arguments: expected 1, found 0
 --> src/file.rs:5:10
  |
5 |     bar: Vec::new()
  |          ^^^^^^^^^^ expected 1 type argument
  ```

If that field had a trailing comma, that would be a parse error and it
would trigger the new, more targetted, error:

```
error: struct literal body without path
 --> file.rs:4:17
  |
4 |   fn foo() -> Foo {
  |  _________________^
5 | |     bar: Vec::new(),
6 | | }
  | |_^
  |
help: you might have forgotten to add the struct literal inside the block
  |
4 | fn foo() -> Foo { Path {
5 |     bar: Vec::new(),
6 | } }
  |
```

Partially address last part of #34255.
2020-10-07 13:40:52 -07:00
Simon Vandel Sillesen
e231c47aa6 perf: UninhabitedEnumBranching void n^2
Avoid n² complexity. This showed up in a profile for match-stress-enum that has 8192 variants
2020-10-07 22:06:08 +02:00
bors
4437b4b150 Auto merge of #77464 - ecstatic-morse:const-fn-impl-trait, r=oli-obk
Give `impl Trait` in a `const fn` its own feature gate

...previously it was gated under `#![feature(const_fn)]`.

I think we actually want to do this in all const-contexts? If so, this should be `#![feature(const_impl_trait)]` instead. I don't think there's any way to make use of `impl Trait` within a `const` initializer.

cc #77463

r? `@oli-obk`
2020-10-07 19:59:52 +00:00
bors
deec530523 Auto merge of #77341 - davidtwco:issue-73427-you-might-have-meant-variant, r=estebank
resolve: improve "try using the enum's variant"

Fixes #73427.

This PR improves the "try using the enum's variant" suggestion:

- Variants in suggestions would not result in more errors (e.g. use of a struct variant is only suggested if the suggestion can trivially construct that variant). Therefore, suggestions are only   emitted for variants that have no fields (since the suggestion can't know what value fields would have).
- Suggestions include the syntax for constructing the variant. If a struct or tuple variant is suggested, then it is constructed in the suggestion - unless in pattern-matching or when arguments are already provided.
- A help message is added which mentions the variants which are no longer suggested.

All of the diagnostic logic introduced by this PR is separated from the normal code path for a successful compilation.

r? `@estebank`
2020-10-07 15:37:47 +00:00
bors
a14bf4862d Auto merge of #77595 - petrochenkov:asmident, r=oli-obk
builtin_macros: Fix use of interpolated identifiers in `asm!`

Fixes https://github.com/rust-lang/rust/issues/77584
2020-10-07 11:51:51 +00:00
bors
8ae3b50976 Auto merge of #77119 - GuillaumeGomez:unclosed-html-tag-lint, r=jyn514
Unclosed html tag lint

Part of #67799.

I think `@ollie27` will be interested (`@Manishearth` too since they opened the issue ;) ).

r? `@jyn514`
2020-10-07 09:56:51 +00:00
bors
59dafb876e Auto merge of #77630 - Dylan-DPC:rollup-kfwl55z, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #76784 (Add some docs to rustdoc::clean::inline and def_id functions)
 - #76911 (fix VecDeque::iter_mut aliasing issues)
 - #77400 (Fix suggestions for x.py setup)
 - #77515 (Update to chalk 0.31)
 - #77568 (inliner: use caller param_env)
 - #77571 (Use matches! for core::char methods)
 - #77582 (Move `EarlyOtherwiseBranch` to mir-opt-level 2)
 - #77590 (Update RLS and Rustfmt)
 - #77605 (Fix rustc_def_path to show the full path and not the trimmed one)
 - #77614 (Let backends access span information)
 - #77624 (Add c as a shorthand check alternative for new options #77603)

Failed merges:

r? `@ghost`
2020-10-06 23:07:17 +00:00
Dylan DPC
1b056157e9
Rollup merge of #77614 - khyperia:set_span, r=eddyb
Let backends access span information

Sometimes, a backend may need to emit warnings, errors, or otherwise need to know the span of the current item in a basic block. So, add a `set_span` method to give the backend that information.

The `set_source_location` method already partially does this, however, it's disabled when debug info is disabled. There needs to be a way to unconditionally provide the span.
2020-10-07 00:16:14 +02:00
Dylan DPC
207832bdc0
Rollup merge of #77605 - da-x:fix-rustc-def-path, r=petrochenkov
Fix rustc_def_path to show the full path and not the trimmed one

Follow-up fix for #73996.
2020-10-07 00:16:12 +02:00
Dylan DPC
6b4dbb196c
Rollup merge of #77582 - ecstatic-morse:disable-early-otherwise-branch, r=wesleywiser
Move `EarlyOtherwiseBranch` to mir-opt-level 2

cc #75119

This didn't have an [effect in most cases](https://perf.rust-lang.org/compare.html?start=81e02708f1f4760244756548981277d5199baa9a&end=2e0edc0f28c5647141bedba02e7a222d3a5dc9c3&stat=instructions:u), and is not trivially sound. Let it bake at `mir-opt-level=2` for a while.

Also, this missed the cutoff for beta, so we'll have to backport this.
r? @wesleywiser
2020-10-07 00:16:08 +02:00
Dylan DPC
83c58d6fb6
Rollup merge of #77568 - lcnr:mir-inline-def-id, r=ecstatic-morse
inliner: use caller param_env

We used the callee param env instead of the caller param env by accident in #77430, this PR fixes that and caches it in the `Inliner` struct.

fixes #77564

r? @ecstatic-morse
2020-10-07 00:16:05 +02:00
Dylan DPC
a7a75b908a
Rollup merge of #77515 - jackh726:chalk-0.31, r=matthewjasper
Update to chalk 0.31

Gonna assign @nikomatsakis to the review here, but since he is pretty busy recently, if anyone else wants to review this, that would be much appreciated.

r? @nikomatsakis
2020-10-07 00:16:03 +02:00
Dylan DPC
d26ca984c3
Rollup merge of #76784 - lzutao:rd_doc, r=GuillaumeGomez
Add some docs to rustdoc::clean::inline and def_id functions

Split from #76571 .
2020-10-07 00:15:58 +02:00
bors
98edd1fbf8 Auto merge of #77386 - joshtriplett:static-glibc, r=petrochenkov
Support static linking with glibc and target-feature=+crt-static

With this change, it's possible to build on a linux-gnu target and pass
RUSTFLAGS='-C target-feature=+crt-static' or the equivalent via a
`.cargo/config.toml` file, and get a statically linked executable.

Update to libc 0.2.78, which adds support for static linking with glibc.

Add `crt_static_respected` to the `linux_base` target spec.

Update `android_base` and `linux_musl_base` accordingly. Avoid enabling
crt_static_respected on Android platforms, since that hasn't been
tested.

Closes https://github.com/rust-lang/rust/issues/65447.
2020-10-06 21:11:04 +00:00
Dylan MacKenzie
b5693a39d9 Update error code page 2020-10-06 11:22:24 -07:00
Jack Huey
23491084bc Update to chalk 0.31. Implement some unimplemented. Ignore some tests in compare mode chalk don't finish. 2020-10-06 14:14:25 -04:00
khyperia
c5bc95676b Let backends access span information
Sometimes, a backend may need to emit warnings, errors, or otherwise
need to know the span of the current item in a basic block. So, add a
set_span method to give the backend that information.
2020-10-06 15:39:12 +02:00
Matthew Jasper
69fc6d8c5c Fix NLL compare mode tests 2020-10-06 11:19:33 +01:00
Matthew Jasper
c9eeb60b63 Deduplicate some code 2020-10-06 11:19:33 +01:00
Matthew Jasper
022c148fcd Fix tests from rebase 2020-10-06 11:19:33 +01:00
Matthew Jasper
1db284ecb0 Avoid creating useless projection predicate 2020-10-06 11:19:33 +01:00
Matthew Jasper
27534b3932 Fix rebase 2020-10-06 11:19:33 +01:00
Matthew Jasper
852073a7d2 Deduplicate item bounds after normalization 2020-10-06 11:19:32 +01:00
Matthew Jasper
e42c97919c Don't require lifetime super-bounds on traits apply to trait objects of that trait 2020-10-06 11:19:32 +01:00