Commit Graph

18516 Commits

Author SHA1 Message Date
bors
e6fead46dc Auto merge of #104009 - Nilstrieb:query-unify-config-desc, r=jyn514
Merge `QueryDescription` into `QueryConfig`

`QueryDescription` has gone through a lot of refactoring and doesn't make sense anymore.

r? `@jyn514`
2022-11-05 23:21:01 +00:00
bors
1286ee23e4 Auto merge of #102458 - JohnTitor:stabilize-instruction-set, r=oli-obk
Stabilize the `instruction_set` feature

Closes https://github.com/rust-lang/rust/issues/74727
FCP is complete on https://github.com/rust-lang/rust/issues/74727#issuecomment-1242773253
r? `@pnkfelix` and/or `@nikomatsakis`
cc `@xd009642`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-05 20:39:06 +00:00
Matthias Krüger
cf2d88db38
Rollup merge of #103972 - oli-obk:unoptional, r=fee1-dead
Remove an option and choose a behaviour-preserving default instead.

r? ``@fee1-dead``
2022-11-05 18:06:07 +01:00
Matthias Krüger
51287f264c
Rollup merge of #103927 - fee1-dead-contrib:E0425-no-typo-when-pattern-matching, r=cjgillot
Do not make typo suggestions when suggesting pattern matching

Fixes #103909.
2022-11-05 18:06:06 +01:00
Deadbeef
b1994ce806 Do not make typo suggestions when suggesting pattern matching
Fixes #103909.
2022-11-05 15:33:25 +00:00
Nilstrieb
36be251a35
Merge QueryDescription into QueryConfig
`QueryDescription` has gone through a lot of refactoring and doesn't
make sense anymore.
2022-11-05 16:24:13 +01:00
bors
6b8d9dd0a0 Auto merge of #103831 - chenyukang:yukang/fix-103751-ice, r=nagisa
Fix capacity overflow issue during transmutability check

Fixes #103751
2022-11-05 13:48:30 +00:00
bors
b0f3940c35 Auto merge of #103691 - michaelwoerister:consistent-slice-and-str-cpp-like-debuginfo-names, r=wesleywiser
[debuginfo] Make cpp-like debuginfo type names for slices and str consistent.

Before this PR, the compiler would emit the debuginfo name `slice$<T>` for all kinds of slices, regardless of whether they are behind a reference or not and regardless of the kind of reference. As a consequence, the types `Foo<&[T]>`, `Foo<[T]>`, and `Foo<&mut [T]>` would end up with the same type name `Foo<slice$<T> >` in debuginfo, making it impossible to disambiguate between them by name. Similarly, `&str` would get the name `str` in debuginfo, so the debuginfo name for `Foo<str>` and `Foo<&str>` would be the same. In contrast, `*const [bool]` and `*mut [bool]` would be `ptr_const$<slice$<bool> >` and `ptr_mut$<slice$<bool> >`, i.e. the encoding does not lose information about the type.

This PR removes all special handling for slices and `str`. The types `&[bool]`, `&mut [bool]`, and `&str` thus get the names `ref$<slice2$<bool> >`, `ref_mut$<slice2$<bool> >`, and `ref$<str$>` respectively -- as one would expect.

The new special name for slices is `slice2$` to differentiate it from the previous name `slice$`, which has different semantics. The same is true for `str` and `str$`. This kind of versioning already has a precedent with the case of `enum$` and `enum2$` and hopefully will make it easier to transition existing consumers of these names.

cc `@rust-lang/wg-debugging` `@vadimcn`

r? `@wesleywiser`

UPDATE: Here is a table to clarify the changes

| Rust type | DWARF name | C++-like name (before) | C++-like name (after) |
|-----------|------------|------------------------|------------------------|
| `[T]`        | `[T]`        | `slice$<T>`              | `slice2$<T>`           |
| `&[T]`       | `&[T]`       | `slice$<T>`              | `ref$<slice2$<T> >`    |
| `&mut [T]`   | `&mut [T]`   | `slice$<T>`              | `ref_mut$<slice2$<T> >`|
| `str`        | `str`        | `str`                    | `str$`           |
| `&str`       | `&str`       | `str`                    | `ref$<str$>`    |
| `&mut str`   | `&mut str`   | `str`                    | `ref_mut$<str$>`|
| `*const [T]` | `*const [T]` | `ptr_const$<slice$<T> >` | `ptr_const$<slice2$<T> >` |
| `*mut [T]`   | `*mut [T]`   | `ptr_mut$<slice$<T> >`   | `ptr_mut$<slice2$<T> >` |

As you can see, before the PR many types would end up with the same name, making it impossible to distinguish between them in NatVis or other places where types are matched or looked up by name. The DWARF version of names is not changed.
2022-11-05 11:07:50 +00:00
Dylan DPC
61553d1784
Rollup merge of #103994 - clubby789:break-unlabeled, r=TaKO8Ki
Specify that `break` cannot be used outside of loop *or* labeled block

Closes #103981

`@rustbot` label +A-diagnostics
2022-11-05 11:31:30 +05:30
Dylan DPC
2d8f0838b1
Rollup merge of #103867 - compiler-errors:no-has-errors, r=cjgillot
Remove `has_errors` from `FnCtxt`

It doesn't seem like this `has_errors` flag actually suppresses any errors (at least in the UI test suite) --- except for one test (`E0767.rs`), and I think that error really should be considered legitimate, since it has nothing to do with the error code and continues to exist after you fix the first error...

This flag was added by ```@eddyb``` in 6b3cc0b8c8, and it's likely that it was made redundant due to subsequent restructuring of the compiler.

It only affects block type-checking anyways, so its effect does seem limited these days anyway.
2022-11-05 11:31:29 +05:30
Dylan DPC
9e67f6a68d
Rollup merge of #103866 - compiler-errors:fn-ctxt-less-state, r=fee1-dead
Remove some return-type diagnostic booleans from `FnCtxt`

These can be calculated on-demand
2022-11-05 11:31:29 +05:30
Dylan DPC
bd9e6e05d2
Rollup merge of #103660 - ozkanonur:master, r=jyn514
improve `filesearch::get_or_default_sysroot`

`fn get_or_default_sysroot` is now improved and used in `miri` and `clippy`, and tests are still passing as they should. So we no longer need to implement custom workarounds/hacks to find sysroot in tools like miri/clippy.

Resolves https://github.com/rust-lang/rust/issues/98832

re-opened from #103581
2022-11-05 11:31:28 +05:30
Dylan DPC
3450aa38d0
Rollup merge of #103621 - fee1-dead-contrib:iat-fix-use, r=cjgillot
Correctly resolve Inherent Associated Types

I don't know if this is the best way to do this, but at least it is one way.
2022-11-05 11:31:28 +05:30
clubby789
2f882c014f Specify that break cannot be used outside of loop *or* labeled block 2022-11-05 01:12:58 +00:00
Matthias Krüger
b101f3a865
Rollup merge of #103984 - V0ldek:103974-refactor-mk_const, r=BoxyUwU
Refactor tcx mk_const parameters.

Unroll the `ty::ConstS` parameter to `TyCtxt::mk_const` into separate `ty::ConstKind` and `Ty` parameters.

Signature change is in:

c97fd8183a/compiler/rustc_middle/src/ty/context.rs (L2234)

and

c97fd8183a/compiler/rustc_middle/src/ty/context.rs (L2572-L2575)

the rest is callsites.

Closes #103974

r? `@oli-obk`
2022-11-05 00:02:06 +01:00
Matthias Krüger
f6ca5aa19a
Rollup merge of #103977 - TimNN:memory-effects, r=nikic
LLVM 16: Switch to using MemoryEffects

This adapts the compiler to the changes required by 304f1d59ca.

AFAICT, `WriteOnly` isn't used by the compiler, all `ReadNone` uses were migrated and the remaining use of `ReadOnly` is only for function parameters.

To simplify the FFI, this PR uses an enum to represent `MemoryEffects` across the FFI boundary, which then gets mapped to the matching static factory method when constructing the attribute.

Fixes #103961.

`@rustbot` label +llvm-main

r? `@nikic`
2022-11-05 00:02:05 +01:00
Matthias Krüger
7b518af5d9
Rollup merge of #103946 - camsteffen:cleanup-bind-pattern, r=cjgillot
Cleanup bind_pattern args

Fixes #101896
2022-11-05 00:02:05 +01:00
Matthias Krüger
ad01a37ca9
Rollup merge of #103868 - compiler-errors:trait-engine-less, r=jackh726
Use `TraitEngine` (by itself) less

Replace `TraitEngine` in favor of `ObligationCtxt` or `fully_solve_*`, improving code readability.
2022-11-05 00:02:04 +01:00
Mateusz
c97fd8183a
Refactor tcx mk_const parameters. 2022-11-04 20:33:32 +00:00
Tim Neumann
c15cfc91c4 LLVM 16: Switch to using MemoryEffects 2022-11-04 17:58:16 +00:00
Matthias Krüger
347c478d88
Rollup merge of #103964 - clubby789:lint-enclosing-unsafe, r=compiler-errors
Give a specific lint for unsafety not being inherited

In cases like
```rs
static mut FOO: u64 = 0;
fn main() {
    unsafe {static BAR: u64 = FOO;}
}
```
and
```rs
fn foo() {
  unsafe {
    fn bar() {
      unsafe_call();
    }
  }
}
```
Specifically inform the user that the unsafety is not inherited for the seperate enclosing items
Fixes #94077
r? compiler-errors
`@rustbot` label +A-diagnostics
2022-11-04 18:52:29 +01:00
Matthias Krüger
f7ed72de40
Rollup merge of #103937 - BoxyUwU:misc_cleanups, r=compiler-errors
minor changes to make method lookup diagnostic code easier to read

The end result of around 4 days of trying to understand this 1000+ line long function- a bunch of tiny nitpicks

r? `@compiler-errors`
2022-11-04 18:52:28 +01:00
Matthias Krüger
2aa8ad6d39
Rollup merge of #103897 - Amanieu:llvm-58384, r=davidtwco
asm: Work around LLVM bug on AArch64

Upstream issue: https://github.com/llvm/llvm-project/issues/58384

LLVM gets confused if we assign a 32-bit value to a 64-bit register, so pass the 32-bit register name to LLVM in that case.
2022-11-04 18:52:27 +01:00
Matthias Krüger
1cb8684dde
Rollup merge of #103792 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt2, r=davidtwco
Migrate `codegen_ssa` to diagnostics structs - [Part 2]

Completes migrating `link.rs` in `codegen_ssa` module.

_Part 1 - https://github.com/rust-lang/rust/pull/102612_

r? `@davidtwco`
2022-11-04 18:52:27 +01:00
Matthias Krüger
612bb7890c
Rollup merge of #103397 - crlf0710:port_dead_code_lint, r=davidtwco
Port `dead_code` lints to be translatable.

This adds an additional comma to lists with three or more items, to be consistent with list formatters like `icu4x`.

r? `@davidtwco`
2022-11-04 18:52:26 +01:00
Oli Scherer
a2325fe3a9 Remove an option and choose a behaviour-preserving default instead. 2022-11-04 16:28:01 +00:00
Onur Özkan
71a3a48ee5 improve filesearch::get_or_default_sysroot r=ozkanonur
Signed-off-by: Onur Özkan <work@onurozkan.dev>
2022-11-04 17:06:47 +03:00
bors
6330c27ae2 Auto merge of #103962 - matthiaskrgr:rollup-9av8i6k, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #103680 (CStr: add some doc links)
 - #103780 (Fix late-bound lifetime closure ICEs in HIR typeck and MIR borrowck)
 - #103845 (Add track_caller to some Lock methods)
 - #103935 (Remove rustdoc clean::Visibility type)
 - #103941 (Fixed typos)
 - #103950 (Fix ICE when negative impl is collected during eager mono)
 - #103953 (Remove unused argument from `throw_unresolved_import_error`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-04 13:47:37 +00:00
clubby789
28819cbb7e Formatting changes + add UI test 2022-11-04 12:58:20 +00:00
clubby789
b7360fa23f Give a specific lint for unsafety not being inherited 2022-11-04 12:26:21 +00:00
Matthias Krüger
1edd63f1e7
Rollup merge of #103953 - TaKO8Ki:remove-unused-arg-from-throw_unresolved_import_error, r=oli-obk
Remove unused argument from `throw_unresolved_import_error`

`throw_unresolved_import_error` does not need the second argument.
2022-11-04 12:18:03 +01:00
Matthias Krüger
ee3c9f7051
Rollup merge of #103950 - nbdd0121:master, r=tmiasko
Fix ICE when negative impl is collected during eager mono

```rust
trait Foo {
    fn foo() {}
}

impl !Foo for () {}
```

This code will currently cause an ICE when mono collection mode is "eager" (with `-C link-dead-code=y` or `-Z print-mono-items=eager`.
2022-11-04 12:18:03 +01:00
Matthias Krüger
d976a29c30
Rollup merge of #103845 - camsteffen:data-structures-track-caller, r=compiler-errors
Add track_caller to some Lock methods

Would have helped to diagnose #103844.
2022-11-04 12:18:01 +01:00
Matthias Krüger
d10187f040
Rollup merge of #103780 - compiler-errors:bound-closure-lifetimes, r=jackh726
Fix late-bound lifetime closure ICEs in HIR typeck and MIR borrowck

During HIR typeck, we need to teach astconv to treat late-bound regions within a closure body as free, fixing escaping bound vars ICEs in both of the issues below.

However, this then gets us to MIR borrowck, which itself needs to be taught how to instantiate free region vids for late-bound regions that come from items that _aren't_ the typeck root (for now, just closures).

Fixes #103771
Fixes #103736
2022-11-04 12:18:01 +01:00
bors
47c008e440 Auto merge of #103098 - Amanieu:asm-tied-fixed, r=bjorn3
asm: Match clang behavior for inlateout fixed register operands

We have 2 options for representing LLVM constraints for `inlateout` operands on a fixed register (e.g. `r0`): `={r0},0` or `={r0},{r0}`.

This PR changes the behavior to the latter, which matches the behavior of Clang since https://reviews.llvm.org/D87279.
2022-11-04 10:39:04 +00:00
bors
2efb0cd4b2 Auto merge of #103954 - matthiaskrgr:rollup-tskpxnj, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #103825 (Remove let_underscore_must_use from list of uplifted lints)
 - #103884 (Add visit_fn_ret_ty to hir intravisit)
 - #103892 (Properly render asyncness for trait fns without default body)
 - #103905 (rustdoc: remove redundant mobile CSS `.sidebar-elems { background }`)
 - #103912 (Add howto for adding new targets)
 - #103915 (Improve use of ErrorGuaranteed and code cleanup)
 - #103930 (Move some tests from `src/test/ui` to more reasonable places)
 - #103931 (Add note to RELEASES.md regarding issue 102754.)
 - #103938 (rustdoc: clean up hardcoded CSS border color on search results)
 - #103940 (rustdoc: remove no-op CSS `#main-content > .item-info { margin-top: 0 }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-04 07:26:56 +00:00
Matthias Krüger
61c6cdb5f4
Rollup merge of #103915 - chenyukang:yukang/fix-103874, r=lcnr
Improve use of ErrorGuaranteed and code cleanup

Part of #103874
2022-11-04 06:40:32 +01:00
Matthias Krüger
6e582cadc3
Rollup merge of #103892 - compiler-errors:afit-rustdoc, r=GuillaumeGomez
Properly render asyncness for trait fns without default body

We weren't properly desugaring async fns in traits unless they had default bodies (in which case rustdoc treats them much like they came from an impl).

cc ```@yoshuawuyts``` should help with https://rust-lang.zulipchat.com/#narrow/stream/330606-wg-async.2Fasync-fn-in-trait-impl/topic/type.20inside.20.60async.20fn.60.20body.20must.20be.20known.20in.20this.20context/near/306894869
2022-11-04 06:40:31 +01:00
Matthias Krüger
14fdfcb38c
Rollup merge of #103884 - spastorino:visit-fn-ret-ty-intravisit, r=compiler-errors
Add visit_fn_ret_ty to hir intravisit

I'm working on some RPITIT changes and I need to specialize `visit_fn_ret_ty` in my visitor impl. So I guess it's better to land it separately.

r? `@compiler-errors`
2022-11-04 06:40:31 +01:00
Jhonny Bill Mena
540c3f94d7 UPDATE - accept dyn error and make Box<dyn error> conform to IntoDiagnosticArg 2022-11-04 01:17:03 -04:00
Jhonny Bill Mena
28491a7b36 UPDATE - address PR Comments
FIX - StrippingDebugInfoFailed typo

DELETE - unneeded FIXME comment

UPDATE - only declare the error with ExtractBundledLibsError as an enum and use the Diagnostic derive macro
2022-11-04 01:17:03 -04:00
Jhonny Bill Mena
2678765d08 FIX - Migrate missing errors in link.rs 2022-11-04 01:17:02 -04:00
Jhonny Bill Mena
1f4c5a624f ADD - ExtractBundledLibsError. Migrated extract_bundled_libs to translatable diagnostics 2022-11-04 01:17:02 -04:00
Jhonny Bill Mena
4c80f50fc6 UPDATE - Complete link.rs migration to new diagnostics infraestructure 2022-11-04 01:17:02 -04:00
Takayuki Maeda
97ddc6343a remove unused argument from throw_unresolved_import_error 2022-11-04 13:59:04 +09:00
bors
15d7556de9 Auto merge of #102928 - notriddle:notriddle/rustdoc-thin-vec, r=GuillaumeGomez
rustdoc: use ThinVec for cleaned generics

Depends on https://github.com/Gankra/thin-vec/pull/38
2022-11-04 03:32:18 +00:00
Gary Guo
1013ee8df5 Fix ICE when negative impl is collected during eager mono 2022-11-04 03:08:28 +00:00
Cameron Steffen
e7bae89a3c Cleanup bind_pattern args 2022-11-03 19:33:59 -05:00
Charles Lew
a777c46dff Use derive(Subdiagnostic) for ChangeFieldsToBeOfUnitType. 2022-11-04 03:02:09 +08:00
Boxy
3583f2758b Cleanups 2022-11-03 18:52:16 +00:00