Commit Graph

250259 Commits

Author SHA1 Message Date
Matthias Krüger
d7e166d408 add test for ice "type mismatching when copying!"
Fixes #112824
2024-03-22 08:31:01 +01:00
Matthias Krüger
2b5740371c add test for https://github.com/rust-lang/rust/issues/112823
Fixes #112823
2024-03-22 08:27:14 +01:00
Matthias Krüger
4d9ce7a1a2 add test for ice #121472
Fixes #121472
2024-03-22 08:19:44 +01:00
Matthias Krüger
1bcbed19d1 add test for #110696
Fixes #110696
2024-03-22 08:13:54 +01:00
bors
cdb683f6e4 Auto merge of #122024 - clubby789:remove-spec-option-pe, r=jhpratt
Remove SpecOptionPartialEq

With the recent LLVM bump, the specialization for Option::partial_eq on types with niches is no longer necessary. I kept the manual implementation as it still gives us better codegen than the derive (will look at this seperately).

Also implemented PartialOrd/Ord by hand as it _somewhat_ improves codegen for #49892: https://godbolt.org/z/vx5Y6oW4Y
2024-03-22 04:06:25 +00:00
bors
b57a10c39d Auto merge of #122854 - matthiaskrgr:rollup-9nnuo0z, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #121881 (std::net: adding acceptfilter feature for netbsd/freebsd.)
 - #122817 (Doc Guarantee: BTree(Set|Map):  `IntoIter` Iterate in Sorted by key Order)
 - #122826 (Add tests for shortcomings of associated type bounds)
 - #122829 (Implement `FusedIterator` for `gen` block)
 - #122831 (make failure logs less verbose)
 - #122837 (add test for #122549)
 - #122838 (Avoid noop rewrite of issues.txt)
 - #122841 (add 2 more tests for issues fixed by #122749)
 - #122843 (Add a never type option to make diverging blocks `()`)
 - #122844 (add test for ice "cannot relate region: LUB(ReErased, ReError)")
 - #122845 (Clippy subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-22 01:49:16 +00:00
Matthias Krüger
99e5618d2a
Rollup merge of #122845 - flip1995:clippy-subtree-update, r=matthiaskrgr
Clippy subtree update

r? ``@Manishearth``
2024-03-22 01:07:34 +01:00
Matthias Krüger
e647543cda
Rollup merge of #122844 - matthiaskrgr:just_one_more_test_mom, r=compiler-errors
add test for ice "cannot relate region: LUB(ReErased, ReError)"

Fixes #109178
2024-03-22 01:07:34 +01:00
Matthias Krüger
b469a6dd9b
Rollup merge of #122843 - WaffleLapkin:semicolon-vs-the-never, r=compiler-errors
Add a never type option to make diverging blocks `()`

More experiments for ~~the blood god~~ T-lang!

Usage example:
```rust
 #![allow(internal_features)]
 #![feature(never_type, rustc_attrs)]
 #![rustc_never_type_options(diverging_block_default = "unit")]

fn main() {
    let _: u8 = { //~ error: expected `u8`, found `()`
        return;
    };
}
```

r? compiler-errors

I'm not sure how I feel about parsing the attribute every time we create `FnCtxt`. There must be a better way to do this, right?
2024-03-22 01:07:33 +01:00
Matthias Krüger
ce63d7ae43
Rollup merge of #122841 - matthiaskrgr:moretests, r=wesleywiser
add 2 more tests for issues fixed by #122749

 Fixes #121807
 Fixes #122098
2024-03-22 01:07:33 +01:00
Matthias Krüger
d9e90ef467
Rollup merge of #122838 - workingjubilee:less-catholic-blessings-to-prevent-incremental-protests, r=matthiaskrgr
Avoid noop rewrite of issues.txt

Fixes #122834

r? ```@matthiaskrgr```
2024-03-22 01:07:32 +01:00
Matthias Krüger
c48c35f23c
Rollup merge of #122837 - matthiaskrgr:fix_122549, r=petrochenkov
add test for #122549

Fixes #122549
2024-03-22 01:07:32 +01:00
Matthias Krüger
05ae329524
Rollup merge of #122831 - onur-ozkan:less-verbose-fail-logs, r=clubby789
make failure logs less verbose

Resolves #122706

Logs without verbose flag:

![image](https://github.com/rust-lang/rust/assets/39852038/f2fc2d35-0954-44b0-bedc-045afedaabe8)

Logs with verbose flag:

![image](https://github.com/rust-lang/rust/assets/39852038/b9308655-ad31-4527-a1be-5a62a78ac469)

I decided to exclude command from the log since it's already included in verbose mode.

cc ```@Nilstrieb```
2024-03-22 01:07:31 +01:00
Matthias Krüger
1757cb5871
Rollup merge of #122829 - ShoyuVanilla:gen-block-impl-fused-iter, r=compiler-errors
Implement `FusedIterator` for `gen` block

cc #117078
2024-03-22 01:07:31 +01:00
Matthias Krüger
08ac38b661
Rollup merge of #122826 - compiler-errors:associated-type-bound-tests, r=lcnr
Add tests for shortcomings of associated type bounds

Adds the test in https://github.com/rust-lang/rust/pull/122791#issuecomment-2011433015

Turns out that #121123 is what breaks `tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.rs` (passes on nightly), but given that associated type bounds haven't landed anywhere yet, I'm happy with breaking it.

This is unrelated to #122791, which just needed that original commit e6b64c6194 stacked on top of it so that it wouldn't have tests failing.

r? lcnr
2024-03-22 01:07:31 +01:00
Matthias Krüger
fa99ebc7cf
Rollup merge of #122817 - ultrabear:ultrabear_btreedoc, r=Nilstrieb
Doc Guarantee: BTree(Set|Map):  `IntoIter` Iterate in Sorted by key Order

This Doc-only PR adds text to the IntoIterator implementation and IntoIter type for both BTreeMap and BTreeSet that states that the returned items will be in sorted-by-key order, this is a guarantee that is made by the iter() and iter_mut() methods of BTreeMap/Set and BTreeMap respectively, but not on into_iter methods or types.

I don't know how the IntoIter iteration would not be sorted by key, and I would like to rely on that behavior for my prefix_array crate.

The text appended to IntoIter documentation is based on each types respective iter() method documentation, as is the text used in the IntoIterator documentation; they are slightly inconsistent between Set/Map, but they are consistent within their own types documentation.
2024-03-22 01:07:30 +01:00
Matthias Krüger
f0feebb270
Rollup merge of #121881 - devnexen:bsd_acceptfilter, r=Amanieu
std::net: adding acceptfilter feature for netbsd/freebsd.

similar to linux's ext deferaccept, to filter incoming connections before accept.
2024-03-22 01:07:30 +01:00
Maybe Waffle
93297bfb05 Add a never type option to make diverging blocks ()
```rust
 #![allow(internal_features)]
 #![feature(never_type, rustc_attrs)]
 #![rustc_never_type_options(diverging_block_default = "unit")]

fn main() {
    let _: u8 = { //~ error: expected `u8`, found `()`
        return;
    };
}
```
2024-03-21 22:09:25 +00:00
Philipp Krones
8e53d53356
Update Cargo.lock 2024-03-21 22:20:59 +01:00
Philipp Krones
5a82d16560
Merge commit '9d6f41691ed9dbfaec2a2df2661c42451f2fe0d3' into clippy-subtree-update 2024-03-21 22:20:40 +01:00
bors
0ad927c0c0 Auto merge of #122785 - the8472:const-select-specialized-impl, r=Amanieu
select Vec::from_iter impls in a const block to optimize compile times

Ignoring whitespace diffs should make this easier to review.

This relies on the trick from #122301
Split out from #120682
2024-03-21 21:19:19 +00:00
bors
9d6f41691e Auto merge of #12527 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-03-21 21:11:00 +00:00
Philipp Krones
e1d15b5b87
Bump Clippy version -> 0.1.79 2024-03-21 22:06:41 +01:00
Philipp Krones
bb86654769
Bump nightly version -> 2024-03-21 2024-03-21 22:05:51 +01:00
Philipp Krones
7d42d736c5
Merge remote-tracking branch 'upstream/master' into rustup 2024-03-21 22:05:29 +01:00
Matthias Krüger
847311e36f add test for ice "cannot relate region: LUB(ReErased, ReError)"
Fixes #109178
2024-03-21 22:02:32 +01:00
Matthias Krüger
bdafec33d5 add test for #121807
Fixes #121807
2024-03-21 21:27:37 +01:00
Jubilee Young
c00920c5da Avoid noop rewrite of issues.txt
This can trigger incremental rebuilds since incr doesn't realize nothing changed.
2024-03-21 13:02:40 -07:00
Matthias Krüger
35a78459aa add test for https://github.com/rust-lang/rust/issues/122098 ICE: index out of bounds, snapshot_vec.rs
Fixes #122098
2024-03-21 20:57:54 +01:00
Maybe Waffle
6f2c6efe01 Change syntax of the never type attribute thingy
Previous:
  ```rust
  #![rustc_never_type_mode = "fallback_to_unit|..."]
  ```

New:
  ```rust
  #![rustc_never_type_options(fallback = "unit|...")]
  ```
This allows adding other options for other never-related experiments.
2024-03-21 19:47:46 +00:00
Matthias Krüger
daa65539ce add test for #122549
Fixes #122549
2024-03-21 20:36:13 +01:00
bors
443f459f98 Auto merge of #12523 - Rua:typo-fix, r=dswij
Fix documentation typo "appects" > "affects"

changelog: none

This fixes a typo in the `iter_filter_is_some` and `iter_filter_is_ok` lint documentation.
2024-03-21 19:26:17 +00:00
bors
a0569fa8f9 Auto merge of #122830 - matthiaskrgr:rollup-uk2by3f, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #122402 (Make `#[diagnostic::on_unimplemented]` format string parsing more robust)
 - #122644 (pattern analysis: add a custom test harness)
 - #122733 (Strip placeholders from hidden types before remapping generic parameter)
 - #122752 (Interpolated cleanups)
 - #122771 (add some comments to hir::ModuleItems)
 - #122793 (Implement macro-based deref!() syntax for deref patterns)
 - #122810 (Remove `target_override`)
 - #122827 (Remove unnecessary braces from `bug`/`span_bug`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-21 17:53:57 +00:00
Rua
238cd36671 Fix documentation typo "appects" > "affects" 2024-03-21 18:22:23 +01:00
Shoyu Vanilla
ae4c5c891e Implement FusedIterator for gen block 2024-03-22 02:02:34 +09:00
onur-ozkan
796105ef63 make failure logs less verbose
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-21 19:55:41 +03:00
Matthias Krüger
6ae51a5fed
Rollup merge of #122827 - compiler-errors:span-bugs, r=WaffleLapkin
Remove unnecessary braces from `bug`/`span_bug`

They make never fallback weird and are unnecessary

r? `@WaffleLapkin`
2024-03-21 17:46:51 +01:00
Matthias Krüger
55a9165644
Rollup merge of #122810 - nnethercote:rm-target_override, r=WaffleLapkin
Remove `target_override`

Because the "target can override the backend" and "backend can override the target" situation is a mess. Details in the individual commits.

r? `@WaffleLapkin`
2024-03-21 17:46:51 +01:00
Matthias Krüger
9cd11c4335
Rollup merge of #122793 - compiler-errors:deref-pat-syntax, r=Nadrieril
Implement macro-based deref!() syntax for deref patterns

Stop using `box PAT` syntax for deref patterns, and instead use a perma-unstable macro.

Blocked on #122222

r? `@Nadrieril`
2024-03-21 17:46:50 +01:00
Matthias Krüger
7938ce6677
Rollup merge of #122771 - RalfJung:module-items, r=oli-obk
add some comments to hir::ModuleItems

I've definitely been bitten by this in the past, where I assumed `items()` would give me *all* the items.
2024-03-21 17:46:50 +01:00
Matthias Krüger
8b132109c4
Rollup merge of #122752 - nnethercote:Interpolated-cleanups, r=petrochenkov
Interpolated cleanups

Various cleanups I made while working on attempts to remove `Interpolated`, that are worth merging now. Best reviewed one commit at a time.

r? `@petrochenkov`
2024-03-21 17:46:49 +01:00
Matthias Krüger
40c972e335
Rollup merge of #122733 - oli-obk:error_prop, r=compiler-errors
Strip placeholders from hidden types before remapping generic parameter

When remapping generic parameters in the hidden type to the generic parameters of the definition of the opaque, we assume that placeholders cannot exist. Instead of just patching that site, I decided to handle it earlier, directly in `infer_opaque_types`, where we are already doing all the careful lifetime handling.

fixes #122694

the reason that ICE now occurred was that we stopped treating `operation` as being in the defining scope, so the TAIT became part of the hidden type of the `async fn`'s opaque type instead of just bailing out as ambiguos

I think

```rust
use std::future::Future;

mod foo {
    type FutNothing<'a> = impl 'a + Future<Output = ()>;
    //~^ ERROR: unconstrained opaque type
}

async fn operation(_: &mut ()) -> () {
    //~^ ERROR: concrete type differs from previous
    call(operation).await
    //~^ ERROR: concrete type differs from previous
}

async fn call<F>(_f: F)
where
    for<'any> F: FnMut(&'any mut ()) -> foo::FutNothing<'any>,
{
    //~^ ERROR: expected generic lifetime parameter, found `'any`
}
```

would have already had the same ICE before https://github.com/rust-lang/rust/pull/121796
2024-03-21 17:46:49 +01:00
Matthias Krüger
8d12621181
Rollup merge of #122644 - Nadrieril:complexity-tests, r=compiler-errors
pattern analysis: add a custom test harness

There are two features of the pattern analysis code that are hard to test: the newly-added pattern complexity limit, and the computation of arm intersections. This PR adds some crate-specific tests for that, including an unmaintainable but pretty macro to help construct patterns.

r? `````@compiler-errors`````
2024-03-21 17:46:48 +01:00
Matthias Krüger
2e41425de6
Rollup merge of #122402 - weiznich:fix/122391, r=compiler-errors
Make `#[diagnostic::on_unimplemented]` format string parsing more robust

This commit fixes several issues with the format string parsing of the `#[diagnostic::on_unimplemented]` attribute that were pointed out by `@ehuss.`
In detail it fixes:

* Appearing format specifiers (display, etc). For these we generate a warning that the specifier is unsupported. Otherwise we ignore them
* Positional arguments. For these we generate a warning that positional arguments are unsupported in that location and replace them with the format string equivalent (so `{}` or `{n}` where n is the index of the positional argument)
* Broken format strings with enclosed }. For these we generate a warning about the broken format string and set the emitted message literally to the provided unformatted string
* Unknown format specifiers. For these we generate an additional warning about the unknown specifier. Otherwise we emit the literal string as message.

This essentially makes those strings behave like `format!` with the minor difference that we do not generate hard errors but only warnings. After that we continue trying to do something unsuprising (mostly either ignoring the broken parts or falling back to just giving back the literal string as provided).

Fix #122391

r? `@compiler-errors`
2024-03-21 17:46:48 +01:00
Michael Goulet
a4db3ffdcb Don't suggest deref macro since it's unstable 2024-03-21 11:42:49 -04:00
Michael Goulet
2d633317f3 Implement macro-based deref!() syntax for deref patterns
Stop using `box PAT` syntax for deref patterns, as it's misleading and
also causes their semantics being tangled up.
2024-03-21 11:42:49 -04:00
bors
7d01878bd0 Auto merge of #122596 - rcxdude:master, r=petrochenkov
Use MSVC-style escaping when passing a response/@ file to lld on windows

LLD parses @ files like the command arguments on the platform it's on, so on windows it needs to follow the MSVC style to work correctly. Otherwise builds can fail if the linker command gets too long and the build path contains spaces.
2024-03-21 15:40:58 +00:00
bors
32799a55e2 Auto merge of #12520 - xFrednet:lets-review-again, r=xFrednet
Add xFrednet back to the reviewing rotation 🎉

You know what? Having a work-life balance is boring.

I truly enjoyed having a free few weeks, and learned that I need to take a break every once in a while, but not doing reviews feels weird. So, this is me coming back for more :D

---

r? `@ghost`

changelog: none
2024-03-21 15:25:58 +00:00
Michael Goulet
abb59b2025 Remove unnecessary braces from span_bug 2024-03-21 11:24:24 -04:00
xFrednet
e50540817b
Add xFrednet back to the reviewing rotation 2024-03-21 16:22:09 +01:00