Michael Goulet
dbee24d949
Suggest correct signature on missing fn returning RPITIT/AFIT
2023-06-13 20:41:15 +00:00
bors
371994e0d8
Auto merge of #112314 - ferrocene:pa-core-alloc-abort, r=bjorn3
...
Ignore `core`, `alloc` and `test` tests that require unwinding on `-C panic=abort`
Some of the tests for `core` and `alloc` require unwinding through their use of `catch_unwind`. These tests fail when testing using `-C panic=abort` (in my case through a target without unwinding support, and `-Z panic-abort-tests`), while they should be ignored as they don't indicate a failure.
This PR marks all of these tests with this attribute:
```rust
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
```
I'm not aware of a way to test this on rust-lang/rust's CI, as we don't test any target with `-C panic=abort`, but I tested this locally on a Ferrocene target and it does indeed make the test suite pass.
2023-06-13 19:03:27 +00:00
bohan
f7330eb752
fix(resolve): update shadowed_glob more precision
2023-06-14 01:38:35 +08:00
bors
5683791ebb
Auto merge of #112017 - Nemo157:unsafe-block-rustfix, r=eholk
...
Add MVP suggestion for `unsafe_op_in_unsafe_fn`
Rebase of https://github.com/rust-lang/rust/pull/99827
cc tracking issue https://github.com/rust-lang/rust/issues/71668
No real changes since the original PR, just migrated the new suggestion to use fluent messages and added a couple more testcases, AFAICT from the discussion there were no outstanding changes requested.
2023-06-13 15:57:59 +00:00
yukang
3bbc598d16
use bug! for overflow of u128
2023-06-13 22:14:05 +08:00
Deadbeef
1caed51673
do not use stringly typed diagnostics
2023-06-13 13:53:56 +00:00
Pietro Albini
a988dc2711
remove patch from cranelift backend to ignore unwinding tests
2023-06-13 15:53:26 +02:00
Wim Looman
8f3e876e52
Add note about unsafe functions body not being unsafe
2023-06-13 15:48:57 +02:00
Wim Looman
62a712a8bb
Hide suggestion to wrap function in unsafe block
2023-06-13 15:48:55 +02:00
Léo Lanteri Thauvin
975152ce30
Add MVP suggestion for unsafe_op_in_unsafe_fn
...
Nemo157 rebase notes: Migrated the changes to the lint into fluent
2023-06-13 15:46:54 +02:00
Maybe Waffle
dc0fba0238
Tweak the sort of vtable sizes
2023-06-13 12:39:59 +00:00
WANG Rui
22a45258d9
loongarch64-none*: Remove environment component from llvm target
2023-06-13 20:24:22 +08:00
Maybe Waffle
8e6a193946
Tweak names and docs for vtable stats
2023-06-13 12:07:12 +00:00
Alex Macleod
fda3c9f4a8
Don't print unsupported split-debuginfo modes with -Zunstable-options
2023-06-13 11:57:58 +00:00
Maybe Waffle
5008a08acf
Simplify code as suggested by the review
2023-06-13 11:46:40 +00:00
bors
4bd4e2ea82
Auto merge of #112386 - loongarch-rs:reloc-static, r=eholk
...
loongarch64-unknown-none*: Set default relocation model to static
This PR sets the default relocation model to `static` for `loongarch64-unknown-none*` targets. This change aims to streamline the development of the bare-metal project by removing the need for the executable program loader to implement relocation.
2023-06-13 09:13:03 +00:00
Nicholas Nethercote
51821515b3
Remove PartitioningCx::target_cgu_count.
...
Because that value can be easily obtained from `Partitioning::tcx`.
2023-06-13 16:47:09 +10:00
Matthias Krüger
b7706e891d
Rollup merge of #111885 - compiler-errors:rust-call-abi-sized, r=eholk
...
Don't ICE on unsized `extern "rust-call"` call
Conceptually builds on #111864 , but doesn't depend on it.
2023-06-13 07:02:28 +02:00
Bryan Garza
f4cf8f65a5
Safe Transmute: Refactor error handling and Answer type
...
- Create `Answer` type that is not just a type alias of `Result`
- Remove a usage of `map_layouts` to make the code easier to read
- Don't hide errors related to Unknown Layout when computing transmutability
2023-06-12 16:56:21 -07:00
Maybe Waffle
f2545fb225
Collect VTable stats & add -Zprint-vtable-sizes
2023-06-12 15:58:35 +00:00
Matthias Krüger
9cb785b9d3
Rollup merge of #112546 - lcnr:opaque-type-cleanup, r=compiler-errors
...
new solver: extend assert to other aliases
2023-06-12 17:44:39 +02:00
Matthias Krüger
8475a88d67
Rollup merge of #112416 - jieyouxu:issue-112363, r=wesleywiser
...
Fix debug ICE for extern type with where clauses
Fixes #112363 .
2023-06-12 17:44:38 +02:00
Matthias Krüger
a5245b5894
Rollup merge of #112302 - jieyouxu:issue-85184, r=WaffleLapkin
...
Suggest using `ptr::null_mut` when user provided `ptr::null` to a function expecting `ptr::null_mut`
```
error[E0308]: mismatched types
--> $DIR/ptr-null-mutability-suggestions.rs:9:24
|
LL | expecting_null_mut(ptr::null());
| ------------------ ^^^^^^^^^^^
| | |
| | types differ in mutability
| | help: consider using `core::ptr::null_mut` instead: `core::ptr::null_mut()`
| arguments to this function are incorrect
|
= note: expected raw pointer `*mut u8`
found raw pointer `*const _`
note: function defined here
--> $DIR/ptr-null-mutability-suggestions.rs:6:4
|
LL | fn expecting_null_mut(_: *mut u8) {}
| ^^^^^^^^^^^^^^^^^^ ----------
```
Closes #85184 .
2023-06-12 17:44:37 +02:00
WANG Rui
aa8e8642d9
loongarch: Fix ELF header flags
2023-06-12 19:50:47 +08:00
lcnr
e74d1cd581
update comment
2023-06-12 12:47:09 +02:00
lcnr
f45502d20d
extend assert
2023-06-12 11:58:40 +02:00
许杰友 Jieyou Xu (Joe)
72421bfb0c
Fix debug ICE for extern type with where clauses
2023-06-12 15:15:45 +08:00
bors
fd0a3313f7
Auto merge of #112261 - jieyouxu:c-like-ptr-arithmetics-diagnostics, r=WaffleLapkin
...
Add help for trying to do C-like pointer arithmetics
This PR adds help messages for these cases:
```rust
fn main() {
let ptr1: *const u32 = std::ptr::null();
let ptr2: *const u32 = std::ptr::null();
let a = ptr1 + 5;
let b = ptr1 - 5;
let c = ptr2 - ptr1;
let d = ptr1[5];
}
```
### Current Output
```
error[E0369]: cannot add `{integer}` to `*const u32`
--> tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs:4:18
|
4 | let a = ptr1 + 5; //~ ERROR cannot add
| ---- ^ - {integer}
| |
| *const u32
error[E0369]: cannot subtract `{integer}` from `*const u32`
--> tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs:5:18
|
5 | let b = ptr1 - 5; //~ ERROR cannot subtract
| ---- ^ - {integer}
| |
| *const u32
error[E0369]: cannot subtract `*const u32` from `*const u32`
--> tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs:6:18
|
6 | let c = ptr2 - ptr1; //~ ERROR cannot subtract
| ---- ^ ---- *const u32
| |
| *const u32
error[E0608]: cannot index into a value of type `*const u32`
--> tests/ui/typeck/issue-112252-ptr-arithmetics-help.rs:7:13
|
7 | let d = ptr1[5]; //~ ERROR cannot index
| ^^^^^^^
error: aborting due to 4 previous errors
```
### Output After This PR
```
error[E0369]: cannot add `{integer}` to `*const u32`
--> $DIR/issue-112252-ptr-arithmetics-help.rs:6:20
|
LL | let _a = _ptr1 + 5;
| ------^--
| | |
| | {integer}
| *const u32
| help: consider using `wrapping_add` or `add` for pointer + {integer}: `_ptr1.wrapping_add(5)`
error[E0369]: cannot subtract `{integer}` from `*const u32`
--> $DIR/issue-112252-ptr-arithmetics-help.rs:7:20
|
LL | let _b = _ptr1 - 5;
| ------^--
| | |
| | {integer}
| *const u32
| help: consider using `offset` for pointer - {integer}: `unsafe { _ptr1.offset(-5) }`
error[E0369]: cannot subtract `*const u32` from `*const u32`
--> $DIR/issue-112252-ptr-arithmetics-help.rs:8:20
|
LL | let _c = _ptr2 - _ptr1;
| ------^------
| | |
| | *const u32
| *const u32
| help: consider using `offset_from` for pointer - pointer if the pointers point to the same allocation: `_ptr2.offset_from(_ptr1)`
error[E0608]: cannot index into a value of type `*const u32`
--> $DIR/issue-112252-ptr-arithmetics-help.rs:9:14
|
LL | let _d = _ptr1[5];
| ^^^^^^^^
|
help: consider using `wrapping_add` or `add` for indexing into raw pointer
|
LL | let _d = _ptr1.wrapping_add(5);
| ~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 4 previous errors
```
Closes #112252 .
2023-06-12 07:15:19 +00:00
Andrew Xie
0cac8455e6
Applied nits
2023-06-11 22:45:04 -04:00
Michael Goulet
696cd98e6b
Don't record adjustments twice in note_source_of_type_mismatch_constraint
2023-06-12 00:35:30 +00:00
bors
77dba225c1
Auto merge of #111801 - Bryanskiy:lints1, r=petrochenkov
...
Private-in-public lints implementation
Next part of RFC https://github.com/rust-lang/rust/issues/48054 .
r? `@petrochenkov`
2023-06-11 22:18:23 +00:00
Bryanskiy
6d46382f6f
Private-in-public lints implementation
2023-06-12 01:02:19 +03:00
Matthias Krüger
d9ae7180e4
Rollup merge of #112513 - compiler-errors:dont-compute-box-span-for-tait, r=cjgillot
...
Dont compute `opt_suggest_box_span` span for TAIT
Fixes #112434
Also a couple more commits on top, pruning some dead code and fixing another weird suggestion encountered in the above issue.
2023-06-11 18:38:28 +02:00
Nicky Lim
6033895ec2
Add subdiagnostic and suggestion for overflowing bin hex with sign bits
2023-06-11 18:27:26 +08:00
yukang
b133841bfc
Fix the overflow issue for transmute_generic_consts
2023-06-11 16:12:59 +08:00
yukang
0220c0b765
Detect actual span for getting unexpected token from parsing macros
2023-06-11 14:36:20 +08:00
Deadbeef
1e36f7e9ae
suspicious_double_ref_op: don't lint on .borrow()
2023-06-11 06:08:44 +00:00
Erik Desjardins
bd0aae92dc
cg_llvm: use index-based loop in write_operand_repeatedly
...
This is easier for LLVM to analyze.
2023-06-11 00:04:53 -04:00
bors
34d64ab7a2
Auto merge of #112466 - lcnr:opaque-type-cleanup, r=compiler-errors
...
opaque type cleanup
the commits are pretty self-contained.
r? `@compiler-errors` cc `@oli-obk`
2023-06-11 03:42:14 +00:00
Michael Goulet
2b40268f8b
properly check associated consts for infer placeholders
2023-06-11 00:27:03 +00:00
Michael Goulet
d80440263c
Don't suggest boxing an empty if/else arm
2023-06-11 00:19:56 +00:00
Matthias Krüger
46b64aaef0
Rollup merge of #112498 - SamZhang3:rust-reference-link-update, r=Nilstrieb
...
Update links to Rust Reference in diagnostic
Instead of linking to the [old Rust Reference site](https://static.rust-lang.org/doc/master/reference.html#literals ), which is severely outdated (Rust 1.17), link to the [current website](https://doc.rust-lang.org/stable/reference/expressions/literal-expr.html ) in diagnostic about incorrect literals.
2023-06-11 01:57:28 +02:00
Matthias Krüger
e9666d4d85
Rollup merge of #112493 - fmease:iat-select-complete-bound-var-erasure, r=compiler-errors
...
iat selection: normalize self ty & completely erase bound vars
Erase bound vars (most notably late-bound regions) irrespective of their binding level instead of just at the innermost one.
Fixes #111404 .
2023-06-11 01:57:27 +02:00
Matthias Krüger
e19a509f8f
Rollup merge of #112475 - chenyukang:yukang-fix-112278, r=compiler-errors
...
Fix issue for module name when surround the struct literal with parentheses
Fixes #112278
2023-06-11 01:57:25 +02:00
Michael Goulet
5dfc17f045
prune some unused code
2023-06-10 23:36:55 +00:00
Michael Goulet
e49b4625df
Don't compute opt_suggest_box_span for TAIT
2023-06-10 23:21:38 +00:00
León Orell Valerian Liehr
a995255cf5
iat selection: normalize self ty & completely erase bound vars
2023-06-11 00:19:47 +02:00
Hankai Zhang
6336da9a75
Use a better link
2023-06-10 14:46:11 -04:00
Hankai Zhang
e5fccf927d
Update links to Rust Reference page on literals in diagnostic
...
Instead of linking to the old Rust Reference site on static.rust-lang.org,
link to the current website doc.rust-lang.org/stable/reference instead in
diagnostic about incorrect literals.
2023-06-10 12:34:16 -04:00
bors
ef8ee73fc4
Auto merge of #112494 - matthiaskrgr:rollup-xdf3om8, r=matthiaskrgr
...
Rollup of 5 pull requests
Successful merges:
- #112297 (bootstrap: Disallow `--exclude test::std`)
- #112298 (Update field-offset and enable unstable_offset_of)
- #112335 (ci: Upgrade loongarch64-linux-gnu GCC to 13.1.0)
- #112413 (Adjust span labels for `HIDDEN_GLOB_REEXPORTS`)
- #112483 (Add deprecation warning to python versions <3.6 in x.py)
r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-10 15:49:43 +00:00