Commit Graph

1046 Commits

Author SHA1 Message Date
Roxane
a64ad51ff7 Address comments 2020-10-14 00:17:42 -04:00
Aman Arora
3c46fd67f8 traits diagnostics: Don't print closure/generator upvar_tys tuple
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2020-10-11 03:33:27 -04:00
Aman Arora
08d1ab0bf1 Always return tupled_upvar_tys for Closure/Generator consituent tys
Depending on if upvar_tys inferred or not, we were returning either an
inference variable which later resolves to a tuple or else the upvar tys
themselves

Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2020-10-11 03:32:35 -04:00
Roxane
dc183702da Replace tuple of infer vars for upvar_tys with single infer var
This commit allows us to decide the number of captures required after
completing capture ananysis, which is required as part of implementing
RFC-2229.

Co-authored-by: Aman Arora <me@aman-arora.com>
Co-authored-by: Jenny Wills <wills.jenniferg@gmail.com>
2020-10-11 03:32:35 -04:00
bors
25d2d09da7 Auto merge of #77649 - dash2507:replace_run_compiler, r=matthewjasper
Replace run_compiler with RunCompiler builder pattern

Fixes #77286. Replaces rustc_driver:run_compiler with RunCompiler builder pattern.
2020-10-11 01:26:06 +00:00
bors
08764ad163 Auto merge of #77087 - estebank:issue-45817, r=matthewjasper
Provide structured suggestions when finding structs when expecting a trait

When finding an ADT in a trait object definition provide some solutions. Fix #45817.
Given `<Param as Trait>::Assoc: Ty` suggest `Param: Trait<Assoc = Ty>`. Fix #75829.
2020-10-10 23:27:28 +00:00
bors
b1af43bc63 Auto merge of #76934 - camelid:rustdoc-allow-generic-params, r=jyn514
Allow generic parameters in intra-doc links

Fixes #62834.

---

The contents of the generics will be mostly ignored (except for warning
if fully-qualified syntax is used, which is currently unsupported in
intra-doc links - see issue #74563).

* Allow links like `Vec<T>`, `Result<T, E>`, and `Option<Box<T>>`
* Allow links like `Vec::<T>::new()`
* Warn on
  * Unbalanced angle brackets (e.g. `Vec<T` or `Vec<T>>`)
  * Missing type to apply generics to (`<T>` or `<Box<T>>`)
  * Use of fully-qualified syntax (`<Vec as IntoIterator>::into_iter`)
  * Invalid path separator (`Vec:<T>:new`)
  * Too many angle brackets (`Vec<<T>>`)
  * Empty angle brackets (`Vec<>`)

Note that this implementation *does* allow some constructs that aren't
valid in the actual Rust syntax, for example `Box::<T>new()`. That may
not be supported in rustdoc in the future; it is an implementation
detail.
2020-10-10 21:19:50 +00:00
Camelid
e2424a2c1f Fix query docs
They were not formatted correctly, so rustdoc was interpreting some
parts as code. Also cleaned up some other query docs that weren't
causing issues, but were formatted incorrectly.
2020-10-10 12:49:31 -07:00
bors
790d19cd25 Auto merge of #77798 - JohnTitor:rollup-82u711m, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #77195 (Link to documentation-specific guidelines.)
 - #77629 (Cleanup of `eat_while()` in lexer)
 - #77709 (Link Vec leak doc to Box)
 - #77738 (fix __rust_alloc_error_handler comment)
 - #77748 (Dead code cleanup in windows-gnu std)
 - #77754 (Add TraitDef::find_map_relevant_impl)
 - #77766 (Clarify the debug-related values should take boolean)
 - #77777 (doc: disambiguate stat in MetadataExt::as_raw_stat)
 - #77782 (Fix typo in error code description)
 - #77787 (Update `changelog-seen` in config.toml.example)

Failed merges:

r? `@ghost`
2020-10-10 19:26:13 +00:00
Yuki Okushi
612fe9fe78
Rollup merge of #77782 - nhayama:fix-typo, r=jonas-schievink
Fix typo in error code description

s/abitrary/arbitrary/
2020-10-11 03:19:19 +09:00
Yuki Okushi
8752b43900
Rollup merge of #77754 - bugadani:find_map_relevant_impl, r=matthewjasper
Add TraitDef::find_map_relevant_impl

This PR adds a method to `TraitDef`. While `for_each_relevant_impl` covers the general use case, sometimes it's not necessary to scan through all the relevant implementations, so this PR introduces a new method, `find_map_relevant_impl`. I've also replaced the `for_each_relevant_impl` calls where possible.

I'm hoping for a tiny bit of efficiency gain here and there.
2020-10-11 03:19:14 +09:00
Yuki Okushi
c14c9bafcd
Rollup merge of #77629 - Julian-Wollersberger:recomputeRawStrError, r=varkor
Cleanup of `eat_while()` in lexer

The size of a lexer Token was inflated by the largest `TokenKind` variants `LiteralKind::RawStr` and `RawByteStr`, because
* it used `usize` although `u32` is sufficient in rustc, since crates must be smaller than 4GB,
* and it stored the 20 bytes big `RawStrError` enum for error reporting.

If a raw string is invalid, it now needs to be reparsed to get the `RawStrError` data, but that is a very cold code path.

Technically this breaks other tools that depend on rustc_lexer because they are now also restricted to a max file size of 4GB. But this shouldn't matter in practice, and rustc_lexer isn't stable anyway.

Can I also get a perf run?

Edit: This makes no difference in performance. The PR now only contains a small cleanup.
2020-10-11 03:19:07 +09:00
bors
7bc5839e99 Auto merge of #77337 - lzutao:asm-mips64, r=Amanieu
Add asm! support for mips64

- [x] Updated `src/doc/unstable-book/src/library-features/asm.md`.
- [ ] No vector type support. I don't know much about those types.

cc #76839
2020-10-10 17:32:28 +00:00
bors
0e022fc2b8 Auto merge of #77580 - petrochenkov:norestarg, r=matthewjasper
rustc_target: Refactor away `TargetResult`

Follow-up to https://github.com/rust-lang/rust/pull/77202.

Construction of a built-in target is always infallible now, so `TargetResult` is no longer necessary.

The second commit contains some further cleanup based on built-in target construction being infallible.
2020-10-10 09:07:35 +00:00
Naoki Hayama
55e92f913a Fix typo in error code description
s/abitrary/arbitrary/
2020-10-10 18:02:53 +09:00
Esteban Küber
4ae8f6ec7c address review comments 2020-10-09 22:00:48 -07:00
Esteban Küber
fdbe4ce5c1 Add docstring 2020-10-09 14:44:24 -07:00
Esteban Küber
5e23cc4960 Given <T as Trait>::A: Ty suggest T: Trait<A = Ty>
Fix #75829
2020-10-09 14:44:24 -07:00
Esteban Küber
e89ce461d3 Suggest removing bounds even when potential typo 2020-10-09 14:44:24 -07:00
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
Dániel Buga
217d6f9741 Revert calculate_dtor signature change 2020-10-09 17:18:57 +02:00
Dániel Buga
18318a9d84 Reimplement for_each_relevant_impl on top of find_map... 2020-10-09 16:56:09 +02:00
Dániel Buga
7993ddd89d Add find_map_relevant_impl 2020-10-09 16:22:49 +02: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
Julian Wollersberger
bd49ded308 Noticed a potential bug in eat_while(): it doesn't account for number of UTF8 bytes.
Fixed it by inlining it in the two places where the count is used and simplified the logic there.
2020-10-09 11:12:54 +02: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
Darshan Kathiriya
e8dca789a1 Replace run_compiler with RunCompiler builder pattern.
RunCompiler::new takes non-optional params, and optional
params can be set using set_*field_name* method.
finally `run` will forward all fields to `run_compiler`.
2020-10-08 16:11:45 -03: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