Commit graph

154338 commits

Author SHA1 Message Date
Camille GILLOT
fa2bc4f400 Directly access the module for use suggestions. 2021-09-02 19:08:58 +02:00
Camille GILLOT
7ec973d9ce Stop using walk_crate. 2021-09-02 19:08:58 +02:00
Aaron Hill
611191f54c
Report cycle error using 'deepest' obligation in the cycle 2021-09-02 11:49:32 -05:00
bors
1cf8fdd4f0 Auto merge of #87580 - ChrisDenton:win-arg-parse-2008, r=m-ou-se
Update Windows Argument Parsing

Fixes #44650

The Windows command line is passed to applications [as a single string](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/the-windows-command-line-is-just-a-string) which the application then parses to get a list of arguments. The standard rules (as used by C/C++) for parsing the command line have slightly changed over the years, most recently in 2008 which added new escaping rules.

This PR implements the new rules as [described on MSDN](https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=msvc-160#parsing-c-command-line-arguments) and [further detailed here](https://daviddeley.com/autohotkey/parameters/parameters.htm#WIN). It has been tested against the behaviour of C++ by calling a C++ program that outputs its raw command line and the contents of `argv`. See [my repo](https://github.com/ChrisDenton/winarg/tree/std) if anyone wants to reproduce my work.

For an overview of how this PR changes argument parsing behavior and why we feel it is warranted see https://github.com/rust-lang/rust/pull/87580#issuecomment-893833893.

For some examples see: https://github.com/rust-lang/rust/pull/87580#issuecomment-894299249
2021-09-02 16:16:13 +00:00
Aaron Hill
f2d9ee9c34
Preserve most sub-obligations in the projection cache 2021-09-02 11:10:40 -05:00
bors
a8c2c7b712 Auto merge of #7604 - flip1995:rustup, r=Manishearth
Rustup

I'll write some TODOs later. This time I'll need a review for this Rustup

r? `@ghost`  (for now)

changelog: none
2021-09-02 15:30:12 +00:00
Frank Steffahn
ab89c88faa Consistent placement of doc alias for primitives below the doc(primitive…) 2021-09-02 17:21:05 +02:00
Frank Steffahn
49c680ada0 Add "!" doc alias for std::ops::Not 2021-09-02 17:19:43 +02:00
b-naber
f825d6c6cc add test 2021-09-02 16:34:25 +02:00
b-naber
b5f680e748 do not resolve instances for trait fn ids 2021-09-02 16:29:49 +02:00
bors
fcce644119 Auto merge of #88530 - bjorn3:shrink_session, r=cjgillot
Shrink Session a bit

Remove a couple of unnecessary fields from `Session` and remove a `Lock<T>` for a field that is never mutated anyway.
2021-09-02 13:12:59 +00:00
xFrednet
a079ae2599 Correct doc comments inside use_expr_visitor.rs 2021-09-02 15:05:27 +02:00
flip1995
01b17af108
Fix fallout from re-applying patches 2021-09-02 13:04:47 +01:00
flip1995
fb6839db2d
Bump nightly version -> 2021-09-02 2021-09-02 12:45:45 +01:00
xFrednet
8bf2940abb
Fix matadata collection configuration formatting 2021-09-02 12:42:00 +01:00
Cameron Steffen
c2bb313e7a
Add higher docs and remove some unneeded fields 2021-09-02 12:41:30 +01:00
flip1995
c7c2036cb9
Fix remaining dogfood errors
Except for the missing docs ones
2021-09-02 12:40:52 +01:00
Cameron Steffen
588367b62e
Fix dogfood 2021-09-02 12:39:54 +01:00
Cameron Steffen
5722a7dacd
Fix manual_match with let-expressions 2021-09-02 12:38:59 +01:00
flip1995
61bb96738c
Merge remote-tracking branch 'upstream/master' into rustup2 2021-09-02 12:38:17 +01:00
Vadim Petrochenkov
9940758416 expand: Treat more macro calls as statement macro calls 2021-09-02 14:14:38 +03:00
bjorn3
74c7f1267b Add explanation for ctfe_backtrace lock 2021-09-02 12:29:12 +02:00
bjorn3
b86a2ee036 Use in_incr_comp_dir_sess in cg_clif 2021-09-02 12:29:12 +02:00
bjorn3
c9abc7e2bb Remove print_fuel_crate field of Session 2021-09-02 12:29:11 +02:00
bjorn3
5464b2e713 Remove optimization_fuel_crate from Session 2021-09-02 12:29:11 +02:00
bors
64929313f5 Auto merge of #88516 - matthiaskrgr:clippy_perf_end_august, r=jyn514,GuillaumeGomez
some low hanging clippy::perf fixes
2021-09-02 10:27:44 +00:00
bjorn3
ff98cb6408 Remove unused argument from resolve_crate 2021-09-02 12:25:27 +02:00
bjorn3
f59198ab96 Introduce CrateRejections struct 2021-09-02 12:25:27 +02:00
bjorn3
b3f850a50c Remove root field from CrateLocator 2021-09-02 12:25:26 +02:00
bjorn3
3a8c457916 Remove host_hash from CrateLocator 2021-09-02 12:25:26 +02:00
bjorn3
a3ada4e68a Refactor CrateLocator.is_proc_macro
This also fixes a (theoretical) bug where a proc-macro may be loaded as
plugin if it exports a symbol with the right name.
2021-09-02 12:25:26 +02:00
bjorn3
4f35f66796 Don't store Session in CrateLocator 2021-09-02 12:25:26 +02:00
Matthew Jasper
9366dfdff5 Bless 32bit MIR opt tests 2021-09-02 10:18:08 +01:00
Matthew Jasper
fd5b40fd3e Remove TODO 2021-09-02 09:21:16 +01:00
bors
849f0a144b Auto merge of #7619 - UnrealApex:patch-1, r=flip1995
Update README.md

Capitalized proper noun.
changelog:none
2021-09-02 08:11:57 +00:00
bors
b27ccbc7e1 Auto merge of #87114 - cjgillot:abilint, r=estebank
Lint missing Abi in ast validation instead of lowering.
2021-09-02 06:06:24 +00:00
Jacob Pratt
727a4fc7e3
Implement #88581 2021-09-02 01:53:54 -04:00
ast-ral
9da8e2a2fa remove redundant / misplaced sentence from docs 2021-09-01 20:52:30 -07:00
bors
cc9bb1522e Auto merge of #83342 - Count-Count:win-console-incomplete-utf8, r=m-ou-se
Allow writing of incomplete UTF-8 sequences to the Windows console via stdout/stderr

# Problem
Writes of just an incomplete UTF-8 byte sequence (e.g. `b"\xC3"` or `b"\xF0\x9F"`)  to stdout/stderr with a Windows console attached error with `io::ErrorKind::InvalidData, "Windows stdio in console mode does not support writing non-UTF-8 byte sequences"` even though further writes could complete the codepoint. This is currently a rare occurence since the [linewritershim](2c56ea38b0/library/std/src/io/buffered/linewritershim.rs) implementation flushes complete lines immediately and buffers up to 1024 bytes for incomplete lines. It can still happen as described in #83258.

The problem will become more pronounced once the developer can switch stdout/stderr from line-buffered to block-buffered or immediate when the changes in the "Switchable buffering for Stdout" pull request (#78515) get merged.

# Patch description
If there is at least one valid UTF-8 codepoint all valid UTF-8 is passed through to the extracted `write_valid_utf8_to_console()` fn. The new code only comes into play if `write()` is being passed a short byte slice comprising an incomplete UTF-8 codepoint. In this case up to three bytes are buffered in the `IncompleteUtf8` struct associated with `Stdout` / `Stderr`. The bytes are accepted one at a time. As soon as an error can be detected `io::ErrorKind::InvalidData, "Windows stdio in console mode does not support writing non-UTF-8 byte sequences"` is returned. Once a complete UTF-8 codepoint is received it is passed to the `write_valid_utf8_to_console()` and the buffer length is set to zero.

Calling `flush()` will neither error nor write anything if an incomplete codepoint is present in the buffer.

# Tests
Currently there are no Windows-specific tests for console writing code at all. Writing (regression) tests for this problem is a bit challenging since unit tests and UI tests don't run in a console and suddenly popping up another console window might be surprising to developers running the testsuite and it might not work at all in CI builds. To just test the new functionality in unit tests the code would need to be refactored. Some guidance on how to proceed would be appreciated.

# Public API changes
* `std::str::verifications::utf8_char_width()` would be exposed as `std::str::utf8_char_width()` behind the "str_internals" feature gate.

# Related issues
* Fixes #83258.
* PR #78515 will exacerbate the problem.

# Open questions
* Add tests?
* Squash into one commit with better commit message?
2021-09-02 03:31:17 +00:00
Noah Lev
2226977a87 Ensure suggestion is in its own diagnostic window
For two reasons:

1. Now that the suggestion span has been corrected, the output is a bit
   cluttered and hard to read. Putting the suggestion its own window
   creates more space.

2. It's easier to see what's being suggested, since now the version
   after the suggestion is applied is shown.
2021-09-01 20:20:46 -07:00
Noah Lev
d2b13ba466 Fix span used for structured tuple struct suggestion
(And same for tuple variants.)

Previously, the span was just for the constructor name, which meant it
would result in syntactically-invalid code when applied. Now, the span
is for the entire expression.
2021-09-01 20:17:15 -07:00
bors
95d91d64db Auto merge of #7617 - xFrednet:0000-link-diag-item-docs, r=giraffate
Reference new diagnostic item docs in our docs :)

The title says it all. The rustc dev guide now has some information about diagnostic items that are worthwhile linking to 🙃

---

changelog: none
2021-09-02 01:04:40 +00:00
bors
e3c71f1e33 Auto merge of #88522 - camelid:box-paren-output, r=jyn514
rustdoc: Box `GenericArgs::Parenthesized.output`

Split out from #88379.

This reduces the size of `GenericArgs` from 104 bytes to 56 bytes,
essentially reducing it by half.

`GenericArgs` is one of the fields of `PathSegment`, so this should
reduce the amount of memory allocated for `PathSegment`s in the cases
where the generics are not for a `Fn`, `FnMut`, or `FnOnce` trait.

r? `@jyn514`
2021-09-02 00:12:21 +00:00
Matthew Jasper
ff8c0ef0e4 Fix drop handling for if let expressions
MIR lowering for `if let` expressions is now more complicated now that
`if let` exists in HIR. This PR adds a scope for the variables bound in
an `if let` expression and then uses an approach similar to how we
handle loops to ensure that we reliably drop the correct variables.
2021-09-01 23:47:41 +01:00
Eduard-Mihai Burtescu
8f7c249980 rustc_target: move LayoutOf to ty::layout. 2021-09-02 01:17:14 +03:00
Eduard-Mihai Burtescu
f53c93cf65 ty::layout: split LayoutOf into required and (blanket) provided halves. 2021-09-02 01:17:14 +03:00
Eduard-Mihai Burtescu
1e02262dcc ty::layout: implement layout_of automatically as a default method. 2021-09-02 01:17:14 +03:00
Eduard-Mihai Burtescu
4ce933f13f rustc_target: move LayoutOf to ty::layout. 2021-09-02 01:17:14 +03:00
Noah Lev
50983ba6df rustdoc: Don't panic on ambiguous inherent associated types
Instead, return `Type::Infer` since compilation should fail anyway.
That's how rustdoc handles `hir::TyKind::Err`s, so this just extends
that behavior to `ty::Err`s when analyzing associated types.

For some reason, the error is printed twice with rustdoc (though only
once with rustc). I'm not sure why that is, but it's better than
panicking.

This commit also makes rustdoc fail early in the non-projection,
non-error case, instead of returning a `Res::Err` that would likely
cause rustdoc to panic later on. This change is originally from #88379.
2021-09-01 15:04:50 -07:00
bors
767edcf616 Auto merge of #88490 - GuillaumeGomez:associated-types-implementors-display, r=camelid,Manishearth
Display associated types of implementors

Fixes #86631.

Contrary to before, it doesn't display methods. I also had to "resurrect" the `auto-hide-trait-implementations` setting. :3

Only question at this point: should I move the `render_impl` boolean arguments into one struct? We're starting to have quite a lot of them...

cc `@cynecx`
r? `@camelid`
2021-09-01 21:31:16 +00:00