Commit Graph

2820 Commits

Author SHA1 Message Date
Michael Goulet
d8e3986d42 Don't use type_of to determine if item has intrinsic shim 2023-08-09 20:00:38 +00:00
Esteban Kuber
9de1a472b6 Suggest using Arc on !Send/!Sync types 2023-08-09 14:04:10 +00:00
Matthias Krüger
e1cae5fd69
Rollup merge of #114638 - compiler-errors:rpitit-test-revisions, r=spastorino
Remove old RPITIT tests (revisions were removed)

These tests were not cleaned up after #112988.

r? `@spastorino`
2023-08-09 06:32:26 +02:00
Matthias Krüger
41d26941d6
Rollup merge of #114606 - bvanjoi:fix-113462, r=compiler-errors
fix: not insert missing lifetime for `ConstParamTy`

Fixes #113462

We should ignore the missing lifetime, as it's illegal to include a lifetime in a const param.

r? ``@compiler-errors``
2023-08-09 06:32:25 +02:00
bors
a946c1e017 Auto merge of #114470 - pnkfelix:dont-export-no-mangle-from-proc-macros-issue-99978, r=bjorn3
Restrict linker version script of proc-macro crates to just its two symbols

Restrict linker version script of proc-macro crates to just the two symbols of each proc-macro crate.

The main known effect of doing this is to stop including `#[no_mangle]` symbols in the linker version script.

Background:

The combination of a proc-macro crate with an import of another crate that itself exports a no_mangle function was broken for a period of time, because:

* In PR #99944 we stopped exporting no_mangle symbols from proc-macro crates; proc-macro crates have a very limited interface and are meant to be treated as a blackbox to everything except rustc itself. However: he constructed linker version script still referred to them, but resolving that discrepancy was left as a FIXME in the code, tagged with issue #99978.
* In PR #108017 we started telling the linker to check (via the`--no-undefined-version` linker invocation flag) that every symbol referenced in the "linker version script" is provided as linker input. So the unresolved discrepancy from #99978 started surfacing as a compile-time error (e.g. #111888).

Fix #111888
Fix #99978.
2023-08-09 00:38:00 +00:00
bors
e3590fccfb Auto merge of #114637 - matthiaskrgr:rollup-544y8p5, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #106425 (Make ExitStatus implement Default)
 - #113480 (add aarch64-unknown-teeos target)
 - #113586 (Mention style for new syntax in tracking issue template)
 - #113593 (CFI: Fix error compiling core with LLVM CFI enabled)
 - #114612 (update llvm-wrapper include to silence deprecation warning)
 - #114613 (Prevent constant rebuilds of `rustc-main` (and thus everything else))
 - #114615 (interpret: remove incomplete protection against invalid where clauses)
 - #114628 (Allowing re-implementation of mir_drops_elaborated query)
 - #114629 (tests: Uncomment now valid GAT code behind FIXME)
 - #114630 (Migrate GUI colors test to original CSS color format)
 - #114631 (add provisional cache test for new solver)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-08 22:00:40 +00:00
Michael Goulet
07695178f8 Remove dangling tests 2023-08-08 20:41:53 +00:00
Matthias Krüger
a5e91edaa0
Rollup merge of #114631 - lcnr:chalk-cycle-test, r=compiler-errors
add provisional cache test for new solver

wrote it for chalk in https://github.com/rust-lang/chalk/pull/788 and never added it to the new solver.

r? ``@compiler-errors``
2023-08-08 21:44:47 +02:00
Matthias Krüger
61d7a4b66e
Rollup merge of #114629 - Enselic:uncomment-gat-code, r=compiler-errors
tests: Uncomment now valid GAT code behind FIXME

The code fails to parse with `nightly-2021-02-05`:

    $ cargo +nightly-2021-02-05 build
    error: generic associated types in trait paths are currently not implemented
     --> src/main.rs:9:42
      |
    9 | fn _bar<T: for<'a> StreamingIterator<Item<'a> = &'a [i32]>>(_iter: T) { /* ... */
      |                                          ^^^^

but parses with `nightly-2021-02-06`:

    $ cargo +nightly-2021-02-06 build
    warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
    warning: 1 warning emitted

because it was (with high probability) fixed by #79554 which was merged within that nightly range.

This PR is part of #44366 which is E-help-wanted.
2023-08-08 21:44:46 +02:00
Matthias Krüger
5c5ae6c5f3
Rollup merge of #114615 - RalfJung:interpret-invalid-where, r=lcnr
interpret: remove incomplete protection against invalid where clauses

Cc https://github.com/rust-lang/rust/issues/97477, https://github.com/rust-lang/project-const-generics/issues/37

r? ``@lcnr``
2023-08-08 21:44:45 +02:00
Matthias Krüger
c097e48082
Rollup merge of #113593 - rcvalle:rust-cfi-fix-90546, r=wesleywiser
CFI: Fix error compiling core with LLVM CFI enabled

Fix #90546 by filtering out global value function pointer types from the type tests, and adding the LowerTypeTests pass to the rustc LTO optimization pipelines.
2023-08-08 21:44:43 +02:00
Matthias Krüger
088763643f
Rollup merge of #113480 - Sword-Destiny:master, r=petrochenkov
add aarch64-unknown-teeos target

TEEOS is a mini os run in TrustZone, for trusted/security apps. The libc of TEEOS is a part of musl. The kernel of TEEOS is micro kernel.

This MR is to add a target for teeos.

MRs for libc and rust-std are in progress.

Compiler team MCP: [MCP](https://github.com/rust-lang/compiler-team/issues/652)
2023-08-08 21:44:42 +02:00
bors
f88a8b71ce Auto merge of #114545 - fee1-dead-contrib:lower-impl-effect, r=oli-obk
correctly lower `impl const` to bind to host effect param

r? `@oli-obk`
2023-08-08 19:23:41 +00:00
lcnr
95d1f6bab5 add test from chalk#788 for new solver 2023-08-08 18:07:38 +02:00
Felix S. Klock II
a2a7f27fd2 fix proc-macro test added here to solely be exercised as a build product for the host.
thus we should no longer see test failures for e.g. wasm32 target.
2023-08-08 11:40:35 -04:00
Martin Nordholts
ff574b77ab tests: Uncomment now valid GAT code behind FIXME
The code fails to parse with `nightly-2021-02-05`:

    $ cargo +nightly-2021-02-05 build
    error: generic associated types in trait paths are currently not implemented
     --> src/main.rs:9:42
      |
    9 | fn _bar<T: for<'a> StreamingIterator<Item<'a> = &'a [i32]>>(_iter: T) { /* ... */
      |                                          ^^^^

but parses with `nightly-2021-02-06`:

    $ cargo +nightly-2021-02-06 build
    warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
    warning: 1 warning emitted

because it was (with high probability) fixed by PR 79554 which was merged
within that nightly range.
2023-08-08 16:39:34 +02:00
bors
bf62436bce Auto merge of #114602 - compiler-errors:rpit-outlives-sadness, r=oli-obk
Map RPIT duplicated lifetimes back to fn captured lifetimes

Use the [`lifetime_mapping`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.OpaqueTy.html#structfield.lifetime_mapping) to map an RPIT's captured lifetimes back to the early- or late-bound lifetimes from its parent function. We may be going thru several layers of mapping, since opaques can be nested, so we introduce `TyCtxt::map_rpit_lifetime_to_fn_lifetime` to loop through several opaques worth of mapping, and handle turning it into a `ty::Region` as well.

We can then use this instead of the identity substs for RPITs in `check_opaque_meets_bounds` to address #114285.

We can then also use `map_rpit_lifetime_to_fn_lifetime` to properly install bidirectional-outlives predicates for both RPITs and RPITITs. This addresses #114601.

I based this on #114574, but I don't actually know how much of that PR we still need, so some code may be redundant now... 🤷

---

Fixes #114597
Fixes #114579
Fixes #114285

Also fixes #114601, since it turns out we had other bugs with RPITITs and their duplicated lifetime params 😅.

Supersedes #114574

r? `@oli-obk`
2023-08-08 13:03:10 +00:00
Michael Goulet
0adf7048d2 add'l test 2023-08-08 09:39:59 +00:00
Oli Scherer
67703b9161 Stop using identity args for opaque type wf checks and instead load the args from the single use of a RPIT in its parent function's return type 2023-08-08 09:39:42 +00:00
Michael Goulet
420ee167a8 Install bidirectional outlives predicates for RPITITs (and RPITs) correctly 2023-08-08 09:39:42 +00:00
Ralf Jung
a7132bf387 interpret: remove incomplete protection against invalid where clauses 2023-08-08 10:35:22 +02:00
bors
6d55184d05 Auto merge of #114520 - RalfJung:unsized-valtrees, r=oli-obk
simplify handling of valtrees for unsized types
2023-08-08 07:48:01 +00:00
bohan
078b942fef fix: not insert missing lifetime for ConstParamTy 2023-08-08 14:48:17 +08:00
Matthias Krüger
418b91a3d7
Rollup merge of #114594 - compiler-errors:new-solver-resolve-aliases, r=lcnr
Structurally normalize weak and inherent in new solver

It seems pretty obvious to me that we should be normalizing weak and inherent aliases too, since they can always be normalized. This PR still leaves open the question of what to do with opaques, though 💀

**Also**, we need to structurally resolve the target of a coercion, for the UI test to work.

r? `@lcnr`
2023-08-08 03:30:56 +02:00
Matthias Krüger
3cd0a109a8
Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk
Store the laziness of type aliases in their `DefKind`

Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not.

With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*:

Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates.

As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions.

---

This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold.

`@rustbot` label F-lazy_type_alias
r? `@oli-obk`
2023-08-08 03:30:56 +02:00
Matthias Krüger
42cdc7df20
Rollup merge of #114413 - CohenArthur:warn-macro-export-decl-macros, r=cjgillot
Warn when #[macro_export] is applied on decl macros

The existing code checks if `#[macro_export]` is being applied to an item other than a macro, and warns in that case, but fails to take into account macros 2.0/decl macros, despite the attribute having no effect on these macros.

This PR adds a special case for decl macros with the aforementioned attribute, so that the warning is a bit more precise. Instead of just saying "this attribute has no effect", hint towards the fact that decl macros get exported and resolved like regular items.
It also removes a `#[macro_export]` attribute which was applied on one of `core`'s decl macros.

- core: Remove #[macro_export] from `debug_assert_matches`
- check_attrs: Warn when #[macro_export] is used on macros 2.0
2023-08-08 03:30:54 +02:00
Ramon de C Valle
f837c48f0d CFI: Fix error compiling core with LLVM CFI enabled
Fix #90546 by filtering out global value function pointer types from the
type tests, and adding the LowerTypeTests pass to the rustc LTO
optimization pipelines.
2023-08-07 15:59:15 -07:00
Arthur Cohen
bdf4e3de9c check_attrs: Warn when #[macro_export] is used on macros 2.0
The compiler should emit a more specific error when the `#[macro_export]`
attribute is present on a decl macro, instead of silently ignoring it.

This commit adds the required error message in rustc_passes/messages.ftl,
 as well as a note. A new variant is added to the `errors::MacroExport`
enum, specifically for the case where the attribute is added to a macro
2.0.
2023-08-07 21:14:28 +02:00
Michael Goulet
ba4a2f7cb7 Resolve target type of coercion 2023-08-07 19:06:18 +00:00
Nikita Popov
01cdc505d9 Fix stack-protector.rs on LLVM 17
Prevent fill from being (correctly) optimized away by passing the
address of the alloca to black_box.
2023-08-07 20:35:55 +02:00
Deadbeef
057be381c6 Fix ICE 2023-08-07 17:16:10 +00:00
bors
63a81b0c5a Auto merge of #114585 - matthiaskrgr:rollup-h26pvus, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #113568 (Fix spurious test failure with `panic=abort`)
 - #114196 (Bubble up nested goals from equation in `predicates_for_object_candidate`)
 - #114485 (Add trait decls to SMIR)
 - #114495 (Set max_atomic_width for AVR to 16)
 - #114496 (Set max_atomic_width for sparc-unknown-linux-gnu to 32)
 - #114510 (llvm-wrapper: adapt for LLVM API changes)
 - #114562 (stabilize abi_thiscall)
 - #114570 ([miri][typo] Fix a typo in a vector_block comment.)
 - #114573 (CI: do not hide error logs in a group)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-07 15:29:14 +00:00
Matthias Krüger
06daa9e263
Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk
stabilize abi_thiscall

Closes https://github.com/rust-lang/rust/issues/42202, stabilizing the use of the "thiscall" ABI.

FCP was substituted by a poll, and the poll has been accepted.
2023-08-07 16:47:57 +02:00
Matthias Krüger
2a643b2dc0
Rollup merge of #114196 - compiler-errors:bubble-pls, r=lcnr
Bubble up nested goals from equation in `predicates_for_object_candidate`

This used to be needed for https://github.com/rust-lang/rust/pull/114036#discussion_r1273987510, but since it's no longer, I'm opening this as a separate PR. This also fixes one ICEing UI test: (`tests/ui/unboxed-closures/issue-53448.rs`)

r? `@lcnr`
2023-08-07 16:47:54 +02:00
Matthias Krüger
bf40327270
Rollup merge of #113568 - ferrocene:pa-spurious-weak-lang-item-2, r=b-naber
Fix spurious test failure with `panic=abort`

Description on why it happens and why the fix should work is in the code comments.
2023-08-07 16:47:54 +02:00
León Orell Valerian Liehr
5468336d6b
Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
Pietro Albini
409d9946cd
change test to use if black_box(false) 2023-08-07 15:42:24 +02:00
bors
84ec2633de Auto merge of #113902 - Enselic:lint-recursive-drop, r=oli-obk
Make `unconditional_recursion` warning detect recursive drops

Closes #55388

Also closes #50049 unless we want to keep it for the second example which this PR does not solve, but I think it is better to track that work in #57965.

r? `@oli-obk` since you are the mentor for #55388

Unresolved questions:
- [x] There are two false positives that must be fixed before merging (see diff). I suspect the best way to solve them is to perform analysis after drop elaboration instead of before, as now, but I have not explored that any further yet. Could that be an option? **Answer:** Yes, that solved the problem.

`@rustbot` label +T-compiler +C-enhancement +A-lint
2023-08-07 13:39:28 +00:00
Benedikt Radtke
3f3262e592 stabilize abi_thiscall 2023-08-07 14:11:03 +02:00
Matthias Krüger
cbe2522652
Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot
Add a new `compare_bytes` intrinsic instead of calling `memcmp` directly

As discussed in #113435, this lets the backends be the place that can have the "don't call the function if n == 0" logic, if it's needed for the target.  (I didn't actually *add* those checks, though, since as I understood it we didn't actually need them on known targets?)

Doing this also let me make it `const` (unstable), which I don't think `extern "C" fn memcmp` can be.

cc `@RalfJung` `@Amanieu`
2023-08-07 05:29:12 +02:00
Scott McMurray
502af03445 Add a new compare_bytes intrinsic instead of calling memcmp directly 2023-08-06 15:47:40 -07:00
Matthias Krüger
f44f0279fa
Rollup merge of #114558 - Enselic:lifetime-diagnostic-fixed, r=cjgillot
Remove FIXME about NLL diagnostic that is already improved

The FIXME was added in #46984 when the diagnostic message looked like this:

    // FIXME(#46983): error message should be better
    &s.0 //~ ERROR free region `` does not outlive free region `'static`

The message was improved in #90667 and now looks like this:

    &s.0 //~ ERROR lifetime may not live long enough

but the FIXME was not removed. The issue #46983 about that diagnostics should be improved has been closed. We can remove the FIXME now.

(This PR was made for #44366.)
2023-08-07 00:06:08 +02:00
Matthias Krüger
d720f93a62
Rollup merge of #114543 - RalfJung:test-96944, r=compiler-errors
add tests for some fixed ConstProp ICEs

Fixes https://github.com/rust-lang/rust/issues/96944
Fixes https://github.com/rust-lang/rust/issues/111353
2023-08-07 00:06:06 +02:00
Ralf Jung
b66b322a2a add testcase that hits valtree_into_mplace with a custom DST 2023-08-06 21:25:49 +02:00
Martin Nordholts
8a7520995c Remove FIXME about NLL diagnostic that is already improved
The FIXME was added in 46984 when the diagnostic message looked like
this:

    // FIXME(#46983): error message should be better
    &s.0 //~ ERROR free region `` does not outlive free region `'static`

The message was improved in 90667 and now looks like this:

    &s.0 //~ ERROR lifetime may not live long enough

but the FIXME was not removed. The issue 46983 about that diagnostics
should be improved has been closed. We can remove the FIXME now.
2023-08-06 21:20:15 +02:00
Deadbeef
6c1e3bb6e9 bless tests 2023-08-06 13:34:53 +00:00
Deadbeef
92f4c59e48 lower impl const to bind to host effect param 2023-08-06 13:34:53 +00:00
Ralf Jung
0c595440e3 add test for issue #111353 2023-08-06 15:06:40 +02:00
Ralf Jung
09c71a5547 add test for issue #96944 2023-08-06 15:01:48 +02:00
Ali MJ Al-Nasrawy
2e83a72964 don't replace opaque types under binders with infer vars 2023-08-06 12:08:32 +00:00