Commit Graph

18736 Commits

Author SHA1 Message Date
clubby789
b2da155a9a Introduce ExprKind::IncludedBytes 2022-11-11 16:31:32 +00:00
bors
b7b7f2716e Auto merge of #103898 - Nilstrieb:match-macro, r=nnethercote
Retry failed macro matching for diagnostics

When a declarative macro fails to match, retry the matching to collect diagnostic info instead of collecting it on the fly in the hot path. Split out of #103439.

You made a bunch of changes to declarative macro matching, so
r? `@nnethercote`

This change should produce a few small perf wins: https://github.com/rust-lang/rust/pull/103439#issuecomment-1294249602
2022-11-11 04:54:59 +00:00
bors
5b82ea74b7 Auto merge of #99918 - WaffleLapkin:fnFnfun, r=estebank
Recover wrong-cased keywords that start items

(_this pr was inspired by [this tweet](https://twitter.com/Azumanga/status/1552982326409367561)_)

r? `@estebank`

We've talked a bit about this recovery, but I just wanted to make sure that this is the right approach :)

For now I've only added the case insensitive recovery to `use`s, since most other items like `impl` blocks, modules, functions can start with multiple keywords which complicates the matter.
2022-11-11 02:07:52 +00:00
bors
c1a859b25a Auto merge of #104164 - cjgillot:u64-cache, r=compiler-errors
Use 64 bits for incremental cache in-file positions

We currently use a 32-bit integer to encode byte positions into the incremental cache.
This is not enough when the query chache file is >4GB.

As the overflow check was a `debug_assert`, it was removed in released compilers, making compilation succeed silently.
At the next compilation, cache decoding would try to read unrelated data because of garbled file position, triggering an ICE.

Fixes https://github.com/rust-lang/rust/issues/79786
(I'm closing that bug since it the original report and the subsequent questions are probably different instances. A new bug should be opened for new instances of that ICE.)
2022-11-10 20:13:42 +00:00
Manish Goregaokar
ea56e80726
Rollup merge of #104235 - compiler-errors:more-ct-guar, r=oli-obk
Use `const_error_with_guaranteed` more

Better to pass down an ErrorGuaranteed rather than making a new one out of thin air, for some usages. Also for the ones where we *do* need to delay a bug, that delayed bug will have a more descriptive message.
2022-11-10 10:47:42 -05:00
Manish Goregaokar
77fde5d49a
Rollup merge of #104233 - compiler-errors:issue-104209, r=lcnr
Don't ICE when encountering `ConstKind::Error` in `RequiredConstsVisitor`

Fixes #104209
2022-11-10 10:47:41 -05:00
Manish Goregaokar
c6595ea22a
Rollup merge of #104194 - BoxyUwU:early_binder_docs, r=compiler-errors
`EarlyBinder` docs
2022-11-10 10:47:41 -05:00
Manish Goregaokar
819c9315c3
Rollup merge of #104186 - chenyukang:yukang/fix-104086-let-binding-issue, r=oli-obk
Tighten the 'introduce new binding' suggestion

Fixes #104086
2022-11-10 10:47:40 -05:00
Manish Goregaokar
8f2c1f8469
Rollup merge of #104077 - nicholasbishop:bishop-uefi-aapcs, r=nagisa
Use aapcs for efiapi calling convention on arm

On arm, [llvm treats the C calling convention as `aapcs` on soft-float targets and `aapcs-vfp` on hard-float targets](https://github.com/rust-lang/compiler-builtins/issues/116#issuecomment-261057422). UEFI specifies in the arm calling convention that [floating point extensions aren't used](https://uefi.org/specs/UEFI/2.10/02_Overview.html#detailed-calling-convention), so always translate `efiapi` to `aapcs` on arm.

https://github.com/rust-lang/rust/issues/65815
2022-11-10 10:47:39 -05:00
Manish Goregaokar
529f7149d2
Rollup merge of #104036 - compiler-errors:option-sugg, r=petrochenkov
Suggest `is_some` when we've found `Option` but expected `bool`

Thanks `@lunasorcery` for the suggestion.
2022-11-10 10:47:38 -05:00
Manish Goregaokar
9c0e783f6d
Rollup merge of #103863 - compiler-errors:fulfillcx-less, r=wesleywiser
Use `TraitEngine` in more places, restrict visibility of `FulfillmentCtxt` constructor

Most places that are constructing a `FulfillmentContext` should be constructing a `TraitEngine` generically, so later on if/when we're transitioning it'll be easier.

Logical extension of #99746
2022-11-10 10:47:37 -05:00
Manish Goregaokar
a7cd4f2edf
Rollup merge of #101939 - zhaixiaojuan:loongarch64-abi, r=oli-obk
Add loongarch64 abi support
2022-11-10 10:47:36 -05:00
Boxy
2566701e33 broken links go brrrrr 2022-11-10 14:57:18 +00:00
bors
01a6f30324 Auto merge of #104236 - compiler-errors:rollup-adjshd6, r=compiler-errors
Rollup of 9 pull requests

Successful merges:

 - #102763 (Some diagnostic-related nits)
 - #103443 (Parser: Recover from using colon as path separator in imports)
 - #103675 (remove redundent "<>" for ty::Slice with reference type)
 - #104046 (bootstrap: add support for running Miri on a file)
 - #104115 (Migrate crate-search element to CSS variables)
 - #104190 (Ignore "Change InferCtxtBuilder from enter to build" in git blame)
 - #104201 (Add check in GUI test for file loading failure)
 - #104211 (⬆️ rust-analyzer)
 - #104231 (Update mailmap)

Failed merges:

 - #104169 (Migrate `:target` rules to use CSS variables)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-10 13:04:51 +00:00
Michael Goulet
f9160224cf
Rollup merge of #103675 - lyming2007:issue-103271-fix, r=fee1-dead
remove redundent "<>" for ty::Slice with reference type

this fix #103271
2022-11-09 21:53:35 -08:00
Michael Goulet
0c4a81c97b
Rollup merge of #103443 - mucinoab:recover-colon-as-path-separetor, r=compiler-errors
Parser: Recover from using colon as path separator in imports

I don't know if this is the right approach, any feedback is welcome.

r? ```@compiler-errors```

Fixes #103269
2022-11-09 21:53:34 -08:00
Michael Goulet
e5ecf629dd
Rollup merge of #102763 - compiler-errors:nits, r=cjgillot
Some diagnostic-related nits

1. Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>`
2. Make `diag.span_suggestions` take an `IntoIterator` instead of `Iterator`, just to remove some `.into_iter` calls on the caller.

idk if I should add a lint to make sure people use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>` in cases where we're just, e.g., adding subdiagnostics to the diagnostic... maybe a followup.
2022-11-09 21:53:34 -08:00
Michael Goulet
0f89fb1791 Use const_error_with_guaranteed more 2022-11-10 05:39:15 +00:00
bors
11fa0850f0 Auto merge of #103636 - chenyukang:yukang/fix-103587-sugg-if-let, r=jackh276,davidtwco
Recover from common if let syntax mistakes/typos

Fixes #103587
2022-11-10 05:19:10 +00:00
Michael Goulet
31157def1a Don't ICE when encountering ConstKind::Error in RequiredConstsVisitor 2022-11-10 05:14:04 +00:00
Michael Goulet
ed17c6b1c3 Use TraitEngine in more places, make FulfillmentCtxt constructor more private 2022-11-10 04:26:43 +00:00
bors
5eef9b2c50 Auto merge of #101990 - clubby789:dont-machine-apply-placeholder-method, r=compiler-errors
Fix auto-application of associated generic functions with placeholders

Fixes #101920
2022-11-10 02:05:38 +00:00
Yiming Lei
0b6934d6c6 remove redundent "<>" for ty::Slice with reference type
this fix #103271
2022-11-09 17:42:17 -08:00
Manish Goregaokar
70c04a2fd1
Rollup merge of #104184 - jyn514:rustdoc-version, r=davidtwco
Fix `rustdoc --version` when used with download-rustc

Previously, rustdoc would unconditionally report the version that *rustc* was compiled with. That showed things like `nightly-2022-10-30`, which wasn't right, since this was a `dev` build compiled from source.

Fix it by changing `rustc_driver::version` to a macro expanded at invocation time.

cc https://github.com/rust-lang/rust/issues/103206#issuecomment-1284123084
2022-11-09 15:39:07 -05:00
Manish Goregaokar
a709cc1f32
Rollup merge of #104156 - oli-obk:autoderef, r=estebank
Cleanups in autoderef impl

Just something I noticed. Turns out the `overloaded_span` is not actually used separately from the main span, so I merged them.
2022-11-09 15:39:06 -05:00
Manish Goregaokar
bfd637a3cf
Rollup merge of #104020 - nicholasbishop:bishop-limit-efiapi, r=nagisa
Limit efiapi calling convention to supported arches

Supported architectures in UEFI are described here:
https://uefi.org/specs/UEFI/2.10/02_Overview.html#calling-conventions

https://github.com/rust-lang/rust/issues/65815
2022-11-09 15:39:05 -05:00
Manish Goregaokar
67c0bff934
Rollup merge of #104015 - alex:remove-kernel, r=oli-obk
Remove linuxkernel targets

These are not used by the actual Rust-for-Linux project, so they're mostly just confusing.
2022-11-09 15:39:05 -05:00
Manish Goregaokar
017c9aa4a0
Rollup merge of #103929 - BlackHoleFox:apple-targets-cleanup, r=petrochenkov
Cleanup Apple-related code in rustc_target

While working on https://github.com/rust-lang/rust/pull/103455, the consistency of the `rustc_target` code for Apple's platforms was "kind of bad." There were two "base" files (`apple_base.rs` and `apple_sdk_base.rs`) that the targets each pulled some parts out of, each and all of them were written slightly differently, and sometimes missed comments other implementations had.

So to hopefully make future maintenance, like implementing https://github.com/rust-lang/compiler-team/issues/556, easier, this makes all of them use similar patterns and the same target base logic everywhere instead of picking bits from both. This also has some other smaller upsides like less stringly-typed functions.
2022-11-09 15:39:04 -05:00
Manish Goregaokar
3f11d39eec
Rollup merge of #103464 - JakobDegen:mir-parsing, r=oli-obk
Add support for custom mir

This implements rust-lang/compiler-team#564 . Details about the design, motivation, etc. can be found in there.

r? ```@oli-obk```
2022-11-09 15:39:03 -05:00
Manish Goregaokar
46bc12c95a
Rollup merge of #103307 - b4den:master, r=estebank
Add context to compiler error message

Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`.
2022-11-09 15:39:02 -05:00
Manish Goregaokar
2206267c31
Rollup merge of #101005 - SLASHLogin:rustc_codegen_llvm_diagnostics, r=davidtwco
Migrate rustc_codegen_llvm to SessionDiagnostics

WIP: Port current implementation of diagnostics to the new SessionDiagnostics.

Part of #100717

```@rustbot``` label +A-translation
2022-11-09 15:39:02 -05:00
Michael Goulet
38ada60eb6 Suggest is_some or let when encountering Option and bool type mismatch 2022-11-09 20:00:24 +00:00
Michael Goulet
9568138069 rebase conflict 2022-11-09 19:42:23 +00:00
Michael Goulet
e807cb3c41 Make span_suggestions take IntoIterator 2022-11-09 19:42:23 +00:00
Michael Goulet
fbce7decd8 DiagnosticBuilder -> Diagnostic 2022-11-09 19:42:23 +00:00
bors
c71658706f Auto merge of #104192 - Dylan-DPC:rollup-jjo1o80, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #103570 (Stabilize integer logarithms)
 - #103694 (Add documentation examples for `pointer::mask`)
 - #103919 (Unescaping cleanups)
 - #103933 (Promote {aarch64,i686,x86_64}-unknown-uefi to Tier 2)
 - #103952 (Don't intra linkcheck reference)
 - #104111 (rustdoc: Add mutable to the description)
 - #104125 (Const Compare for Tuples)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-09 16:54:02 +00:00
yukang
c69872bb6c add 'is_assign_rhs' to avoid weird suggesting 'let' 2022-11-10 00:43:12 +08:00
Boxy
4c197c0319 docs 2022-11-09 14:25:08 +00:00
SLASHLogin
caada745d1 Add missing emitted_at to the Diagnostic 2022-11-09 15:14:58 +01:00
SLASHLogin
39895b0716 Add constructor for Diagnostic that takes Vec<(DiagnosticMessage, Style)> 2022-11-09 14:57:54 +01:00
SLASHLogin
0baac880fc Update compiler/rustc_codegen_llvm/src/back/archive.rs
Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
2022-11-09 14:56:21 +01:00
SLASHLogin
a8a8055cc7 Use LayoutError's implementation of IntoDiagnostic 2022-11-09 14:56:21 +01:00
SLASHLogin
0381e51822 Formatting 2022-11-09 14:56:21 +01:00
SLASHLogin
3b949eb7c1 Add replace_args method for rustc_errors::diagnostic::Diagnostic 2022-11-09 14:56:21 +01:00
SLASHLogin
b4820a3b94 Delay diagnostic translation in rustc_codegen_ssa 2022-11-09 14:56:21 +01:00
SLASHLogin
9a1545861e Simplify existing Diagnostic implementations 2022-11-09 14:56:21 +01:00
SLASHLogin
3728e95596 Port diagnostics created by Handler 2022-11-09 14:56:21 +01:00
SLASHLogin
67394e7945 Flatten diagnostic structs 2022-11-09 14:56:21 +01:00
SLASHLogin
e9a5329a6f Correct tests to match errors 2022-11-09 14:56:21 +01:00
SLASHLogin
1c7a801bbc Fix CI
Add missing 'the' to the error en-US translation
2022-11-09 14:56:21 +01:00