Commit Graph

237105 Commits

Author SHA1 Message Date
Matthias Krüger
d30fe8b4e2
Rollup merge of #116931 - weiznich:improve_diagnostic_on_unimplemented_warnings, r=compiler-errors
Improve the warning messages for the `#[diagnostic::on_unimplemented]`

This commit improves warnings emitted for malformed on unimplemented attributes by:

* Improving the span of the warnings
* Adding a label message to them
* Separating the messages for missing and unexpected options
* Adding a help message that says which options are supported

r? `@compiler-errors`

I'm happy to work on further improvements, so feel free to make suggestions.
2023-10-25 23:37:09 +02:00
Matthias Krüger
824dbb53fb
Rollup merge of #116553 - gurry:116464-assoc-type-invalid-suggestion, r=compiler-errors
Do not suggest 'Trait<Assoc=arg>' when in trait impl

Fixes #116464

We now skip the suggestion if we're in an impl of the trait.
2023-10-25 23:37:09 +02:00
Matthias Krüger
d3fb29a422
Rollup merge of #116401 - WaffleLapkin:vtablin''', r=oli-obk
Return multiple object-safety violation errors and code improvements to the object-safety check

See individual commits for more information. Split off of #114260, since it turned out that the main intent of that PR was wrong.

r? oli-obk
2023-10-25 23:37:09 +02:00
Maybe Waffle
ecdbefa487 Return multiple object-safety violation errors 2023-10-25 20:26:07 +00:00
Maybe Waffle
89582351cf Don't allow dead code 2023-10-25 20:23:43 +00:00
Maybe Waffle
6cb3376434 Add a comment explaining some weird is_vtable_safe_method behavior 2023-10-25 20:23:43 +00:00
bors
ab5c841a1f Auto merge of #117180 - matthiaskrgr:rollup-rxhl6ep, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #117111 (Remove support for alias `-Z instrument-coverage`)
 - #117141 (Require target features to match exactly during inlining)
 - #117152 (Fix unwrap suggestion for async fn)
 - #117154 (implement C ABI lowering for CSKY)
 - #117159 (Work around the fact that `check_mod_type_wf` may spuriously return `ErrorGuaranteed`)
 - #117163 (compiletest: Display compilation errors in mir-opt tests)
 - #117173 (Make `Iterator` a lang item)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-25 19:29:58 +00:00
Matthias Krüger
b0521fe88e
Rollup merge of #117173 - oli-obk:gen_fn_split2, r=compiler-errors
Make `Iterator` a lang item

r? `@compiler-errors`

pulled out of https://github.com/rust-lang/rust/pull/116447

We're doing this change on its own, because iterator was the one diagnostic item that was load bearing on us correctly emitting errors about `diagnostic_item` mis-uses. It was used in some diagnostics as an early abort, before the actual checks of the diagnostic, so effectively the compiler was *unconditionally* checking for the iterator diagnostic item, even if it didn't emit any diagnostics. Changing those uses to use the lang item, caused us not to invoke the `all_diagnostic_items` query anymore, which then caused us to miss some issues around diagnostic items until they were actually used.

The reason we keep the diagnostic item around is that clippy uses it a lot and having `Iterator` be a lang item and a diagnostic item at the same time doesn't cost us anything, but makes clippy's internal code simpler
2023-10-25 19:51:16 +02:00
Matthias Krüger
beba52207e
Rollup merge of #117163 - tmiasko:compiletest-mir-opt, r=compiler-errors
compiletest: Display compilation errors in mir-opt tests

Previously when compilation failed the `check_mir_dump` would panic first, so we would never display the compiler output.
2023-10-25 19:51:16 +02:00
Matthias Krüger
26a9e08f0c
Rollup merge of #117159 - oli-obk:error_shenanigans, r=estebank
Work around the fact that `check_mod_type_wf` may spuriously return `ErrorGuaranteed`

Even if that error is only emitted by `check_mod_item_types`.

fixes https://github.com/rust-lang/rust/issues/117153

A cleaner refactoring would merge/chain these queries in ways that ensure we only actually get an `ErrorGuaranteed` if there was an error emitted.
2023-10-25 19:51:15 +02:00
Matthias Krüger
74c2b987fb
Rollup merge of #117154 - Dirreke:csky-unknown-linux-gunabiv2, r=bjorn3
implement C ABI lowering for CSKY

fix https://github.com/rust-lang/compiler-builtins/issues/551

 ​Reference: [CSKY ABI Manual](https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1695027452256/T-HEAD_800_Series_ABI_Standards_Manual.pdf)
 ​
Reference: [Clang CSKY lowering code](4a074f32a6/clang/lib/CodeGen/Targets/CSKY.cpp (L76-L162))

r? `@bjorn3`
2023-10-25 19:51:15 +02:00
Matthias Krüger
585a122264
Rollup merge of #117152 - compiler-errors:no-ret-coercion, r=chenyukang
Fix unwrap suggestion for async fn

Use `body_fn_sig` to get the expected return type of the function instead of `ret_coercion` in `FnCtxt`. This avoids accessing the `ret_coercion` when it's already mutably borrowed (e.g. when checking `return` expressions).

Fixes #117144

r? `@chenyukang`
2023-10-25 19:51:14 +02:00
Matthias Krüger
a1ab16792b
Rollup merge of #117141 - tmiasko:inline-target-features, r=oli-obk
Require target features to match exactly during inlining

In general it is not correct to inline a callee with a target features
that are subset of the callee. Require target features to match exactly
during inlining.

The exact match could be potentially relaxed, but this would require
identifying specific feature that are allowed to differ, those that need
to match, and those that can be present in caller but not in callee.

This resolves MIR part of #116573. For other concerns with respect to
the previous implementation also see areInlineCompatible in LLVM.
2023-10-25 19:51:14 +02:00
Matthias Krüger
24254d2142
Rollup merge of #117111 - Zalathar:zinstrument, r=compiler-errors
Remove support for alias `-Z instrument-coverage`

This flag was stabilized in rustc 1.60.0 (2022-04-07) as `-C instrument-coverage`, but the old unstable flag was kept around (with a warning) as an alias to ease migration.

It should now be reasonable to remove the somewhat tricky code that implemented that alias.

Fixes #116980.
2023-10-25 19:51:13 +02:00
bors
cf226e93dc Auto merge of #117172 - matthiaskrgr:rollup-s56bm2f, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #116801 (Add test for 113326)
 - #117133 (Merge `impl_wf_inference` (`check_mod_impl_wf`) check into coherence checking)
 - #117136 (Intern `LocalDefId` list from `opaque_types_defined_by` query)
 - #117150 (Update cargo)
 - #117158 (Update THIR unused_unsafe lint)
 - #117160 (Fix typo in test comment)
 - #117168 (Fix some coroutine sentences that don't make sense anymore.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-25 17:35:01 +00:00
Oli Scherer
268ec72839 Make Iterator a lang item 2023-10-25 16:18:57 +00:00
Matthias Krüger
a7d05a6dfa
Rollup merge of #117168 - oli-obk:coroutine_cleanups, r=JohnTitor
Fix some coroutine sentences that don't make sense anymore.

These happened during the `generator` -> `coroutine` rename.

Found thanks to `@pthariensflame` for their thorough review of the `generator` -> `coroutine` rename https://github.com/rust-lang/rust/pull/116958#issuecomment-1777756937
2023-10-25 17:40:32 +02:00
Matthias Krüger
dffed66456
Rollup merge of #117160 - cuishuang:master, r=lqd
Fix typo in test comment
2023-10-25 17:40:31 +02:00
Matthias Krüger
105efbb4b2
Rollup merge of #117158 - matthewjasper:thir-unused-unsafe, r=oli-obk
Update THIR unused_unsafe lint

Updates THIR unsafeck behaviour to match the changes from #93678
2023-10-25 17:40:31 +02:00
Matthias Krüger
136f9dbe84
Rollup merge of #117150 - weihanglo:update-cargo, r=weihanglo
Update cargo

2 commits in d2f6a048529eb8e9ebc55d793abd63456c98fac2..df3509237935f9418351b77803df7bc05c009b3d
2023-10-20 18:25:30 +0000 to 2023-10-24 23:09:01 +0000
- Fix unused_imports warning (rust-lang/cargo#12876)
- Warn about crate name's format when creating new crate (rust-lang/cargo#12766)

r? ghost
2023-10-25 17:40:30 +02:00
Matthias Krüger
acc68e90bc
Rollup merge of #117136 - compiler-errors:defid-list, r=oli-obk
Intern `LocalDefId` list from `opaque_types_defined_by` query

r? oli-obk
2023-10-25 17:40:29 +02:00
Matthias Krüger
96074bec97
Rollup merge of #117133 - compiler-errors:coherence-constrained, r=oli-obk
Merge `impl_wf_inference` (`check_mod_impl_wf`) check into coherence checking

Problem here is that we call `collect_impl_trait_in_trait_types` when checking `check_mod_impl_wf` which is performed before coherence. Due to the `tcx.sess.track_errors`, since we end up reporting an error, we never actually proceed to coherence checking, where we would be emitting a more useful impl overlap error.

This change means that we may report more errors in some cases, but can at least proceed far enough to leave a useful message for overlapping traits with RPITITs in them.

Fixes #116982

r? types
2023-10-25 17:40:29 +02:00
Matthias Krüger
75efc4fd9e
Rollup merge of #116801 - clubby789:issue-113326-test, r=compiler-errors
Add test for 113326

Closes #113326
Bisecting points to #113636 as the fix
2023-10-25 17:40:28 +02:00
bors
964ff0125b Auto merge of #117165 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2023-10-25 15:34:13 +00:00
Oli Scherer
1be0033457 Fix some coroutine sentences that don't make sense anymore.
These happened during the `generator` -> `coroutine` rename.
2023-10-25 14:27:00 +00:00
bors
b66fe58f68 Auto merge of #117113 - celinval:smir-stable-ty, r=oli-obk
Remove fold code and add `Const::internal()` to StableMIR

We are not planning to support user generated constant in the foreseeable future, so we are cleaning up the fold logic and user created type for now. Users should use `Instance::resolve` in order to trigger monomorphization.

The Instance::resolve was however incomplete, since we weren't handling internalizing constants yet. Thus, I added that.

I decided to keep the `Const` fields private in case we decide to translate them lazily.
2023-10-25 13:19:54 +00:00
Tomasz Miąsko
a9fad1c357 compiletest: Display compilation errors in mir-opt tests 2023-10-25 15:16:43 +02:00
dirreke
32339f8e80 implement C ABI lowering for CSKY 2023-10-25 20:47:06 +08:00
Oli Scherer
beaf46f7e5 Work around the fact that check_mod_type_wf may spuriously return ErrorGuaranteed, even if that error is only emitted by check_modwitem_types 2023-10-25 12:04:54 +00:00
cui fliter
11debd778a Fix problematic comment
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-10-25 19:14:03 +08:00
bors
eb03d40a9c Auto merge of #117102 - devnexen:dfbsd_stack_overflow_upd, r=thomcc
stack_overflow: get_stackp using MAP_STACK flag on dragonflybsd too.
2023-10-25 11:01:24 +00:00
Matthew Jasper
dc3d428a8a Make THIR unused_unsafe lint consistent with MIR
Updates THIR behavior to match the changes from #93678
2023-10-25 10:10:13 +00:00
bors
c2ef35161f Auto merge of #117076 - oli-obk:privacy_visitor_types, r=petrochenkov
Refactor type visitor walking

r? `@petrochenkov`

pulling out the uncontroversial parts of https://github.com/rust-lang/rust/pull/113671
2023-10-25 08:54:09 +00:00
bors
51ae1fe849 Auto merge of #3141 - rust-lang:rustup-2023-10-25, r=RalfJung
Automatic Rustup
2023-10-25 08:04:36 +00:00
Ralf Jung
19c4fa60ea CLOCK_UPTIME_RAW exists on all macos targets, not just the ARM ones 2023-10-25 10:03:09 +02:00
bors
c716f180e8 Auto merge of #116236 - dtolnay:builtinmacrocomment, r=cjgillot
Modernize rustc_builtin_macros generics helpers

- Rustfmt-compatible formatting for the code snippets in comments
- Eliminate an _"Extra scope required"_ obsoleted by NLL
2023-10-25 06:57:37 +00:00
The Miri Conjob Bot
3751fb09c3 Merge from rustc 2023-10-25 05:40:45 +00:00
bors
9c793e18dd Auto merge of #3140 - RalfJung:gamma, r=RalfJung
add some more gamma function tests
2023-10-25 05:32:41 +00:00
The Miri Conjob Bot
c612ba8e29 Preparing for merge from rustc 2023-10-25 05:31:14 +00:00
Ralf Jung
e83c8c1c2b add some more gamma function tests 2023-10-25 07:30:27 +02:00
bors
98108dc26c Auto merge of #116993 - compiler-errors:clause-kind, r=jackh726
Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir`

Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir`.

Blocked on #116951

r? `@ghost`
2023-10-25 05:02:04 +00:00
Gurinder Singh
079b290439 Do not suggest 'Trait<Assoc=arg>' when in trait impl
because that would be illegal syntax
2023-10-25 09:11:16 +05:30
Michael Goulet
23341434bd Fix unwrap suggestion for async fn 2023-10-25 02:29:51 +00:00
bors
2e4e2a8f28 Auto merge of #117139 - compiler-errors:vid-lifetimes, r=BoxyUwU
Get rid of `'tcx` lifetime on `ConstVid`, `EffectVid`

These are simply newtyped numbers, so don't really have a reason (per se) to have a lifetime -- `TyVid` and `RegionVid` do not, for example.

The only consequence of this is that we need to use a new key type for `UnifyKey` that mentions `'tcx`. This is already done for `RegionVid`, with `RegionVidKey<'tcx>`, but this `UnifyKey` trait implementation may have been the original reason to give `ConstVid` a lifetime. See the changes to `compiler/rustc_middle/src/infer/unify_key.rs` specifically.

I consider the code cleaner this way, though -- we removed quite a few unnecessary `'tcx` in the process. This also makes it easier to uplift these two ids to `rustc_type_ir`, which I plan on doing in a follow-up PR.

r? `@BoxyUwU`
2023-10-25 02:01:04 +00:00
Weihang Lo
fd7bbc2aa5
Update cargo 2023-10-24 20:51:13 -04:00
Zalathar
65b0f6adb0 Remove support for alias -Z instrument-coverage
This flag was stabilized in rustc 1.60.0 as `-C instrument-coverage`, but the
old unstable flag was kept around as an alias to ease migration.
2023-10-25 11:37:46 +11:00
Zalathar
bc18509719 coverage: UI test for unstable value -C instrument-coverage=branch 2023-10-25 11:36:45 +11:00
bors
848a387967 Auto merge of #116482 - matthewjasper:thir-unsafeck-inline-constants, r=b-naber
Fix inline const pattern unsafety checking in THIR

Fix THIR unsafety checking of inline constants.
- Steal THIR in THIR unsafety checking (if enabled) instead of MIR lowering.
- Represent inline constants in THIR patterns.
2023-10-25 00:03:57 +00:00
Celina G. Val
17f6df9c63 Use IndexMap for handling stable Ty 2023-10-24 15:37:43 -07:00
Celina G. Val
3f60165d27 Remove fold code and add Const::internal()
We are not planning to support user generated constant in the
foreseeable future, so we are removing the Fold logic for now in
favor of the Instance::resolve logic.

The Instance::resolve was however incomplete, since we weren't handling
internalizing constants yet. Thus, I added that.

I decided to keep the Const fields private in case we decide to
translate them lazily.
2023-10-24 14:50:58 -07:00