Commit Graph

228580 Commits

Author SHA1 Message Date
Matthias Krüger
709f184593
Rollup merge of #113153 - tshepang:patch-6, r=cuviper
make HashMap::or_insert_with example more simple
2023-07-01 00:35:05 +02:00
Matthias Krüger
4e8f1357b8
Rollup merge of #113072 - tshepang:patch-1, r=cuviper
str docs: remove "Basic usage" text where not useful

Not "useful" in that there is only one example given
2023-07-01 00:35:04 +02:00
Rémy Rakic
38f5a9964b comment, and bless, unstable linker flavor test 2023-06-30 21:13:24 +00:00
Rémy Rakic
6594f365fe add end-to-end test 2023-06-30 21:13:24 +00:00
Rémy Rakic
4ff780be2f bless test with new linker flavors 2023-06-30 21:13:24 +00:00
Rémy Rakic
38dca73456 require -Zunstable-options to use new link-self-contained values and
linker flavors

- only the stable values for `-Clink-self-contained` can be used on stable until we
have more feedback on the interface
- `-Zunstable-options` is required to use unstable linker flavors
2023-06-30 21:11:42 +00:00
Rémy Rakic
051e94d50e implement -C linker-flavor modern flavors 2023-06-30 21:10:12 +00:00
Rémy Rakic
1da271b6d0 refactor add_gcc_ld_path into its final form 2023-06-30 21:07:05 +00:00
Rémy Rakic
0fb80715bb use LinkSelfContained for -C link-self-contained 2023-06-30 21:01:38 +00:00
Rémy Rakic
5d91c1ced4 add dedicated -C link-self-contained structure 2023-06-30 20:37:24 +00:00
Rémy Rakic
5bc887020b regroup LinkerPluginLto blocks 2023-06-30 20:28:46 +00:00
Rémy Rakic
5ea0f63733 add whether LinkerFlavor invokes the linker via a C/C++ compiler 2023-06-30 20:28:46 +00:00
Rémy Rakic
99605a0389 add whether LinkerFlavor uses lld 2023-06-30 20:28:46 +00:00
bors
464edbed05 Auto merge of #11051 - Centri3:eq_op, r=llogiq
Make `eq_op` suggest `.is_nan()`

changelog: Enhancement: [`eq_op`]: Suggests `is_nan()` for `x != x` where `x` is a float
2023-06-30 18:26:28 +00:00
Catherine
efac83813d Make eq_op suggest .is_nan() 2023-06-30 11:43:02 -05:00
bors
f4b80cacf9 Auto merge of #113200 - ferrocene:pa-fix-mir-opt-bless, r=oli-obk
Fix loading target specs in compiletest not working with custom targets

In https://github.com/rust-lang/rust/pull/112454#issuecomment-1611351168 it was pointed out that the PR broke blessing mir-opt tests. Since #112418, blessing mir-opt tests generates "synthetic targets", which are custom target specs. Those specs are not included in `--print=all-target-specs-json`, and #112454 required that the current target was returned by that flag.

This PR fixes the breakage by loading the target spec for the current target explicitly, if a custom target is detected.

r? `@oli-obk`
2023-06-30 15:02:46 +00:00
bors
2c40b99d08 Auto merge of #11048 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-06-30 14:09:53 +00:00
Philipp Krones
30d08d35f2
Bump nightly version -> 2023-06-29 2023-06-30 16:09:15 +02:00
Philipp Krones
8010c3462d
Merge remote-tracking branch 'upstream/master' into rustup 2023-06-30 16:09:06 +02:00
Pietro Albini
00cc815e57
fix loading target specs in compiletest not working with custom targets 2023-06-30 14:36:14 +02:00
Bryanskiy
f9a4db7312 Fix associated items effective visibility calculation for type privacy lints 2023-06-30 15:00:24 +03:00
bors
56d507dc92 Auto merge of #109524 - bzEq:aix-embed-llvmbc, r=nagisa
Support embedding LLVM bitcode on AIX
2023-06-30 11:39:58 +00:00
Luca Barbato
528f11c24b Mark wrapped intrinsics as inline(always)
This should mitigate having the inliner decide not to inline when
the architecture is lacking an implementation of
TargetTransformInfo::areInlineCompatible aware of the target
features (e.g. PowerPC as today).
2023-06-30 12:07:21 +02:00
Guillaume Gomez
60c657f73a Improve search-result-display.goml test 2023-06-30 11:45:42 +02:00
Guillaume Gomez
f748aa5634 Update browser-ui-test version to 0.16.8 2023-06-30 11:45:37 +02:00
bors
af9df2fd91 Auto merge of #106619 - agausmann:avr-object-file, r=nagisa
Fix unset e_flags in ELF files generated for AVR targets

Closes #106576

~~Sort-of blocked by gimli-rs/object#500~~ (merged)

I'm not sure whether the list of AVR CPU names is okay here. Maybe it could be moved out-of-line to improve the readability of the function.
2023-06-30 08:55:56 +00:00
Zalathar
115cfda6c2 compiletest: Only trim the end of process output 2023-06-30 17:41:34 +10:00
yukang
cfa1a79009 User may want to skip tidy check sometimes 2023-06-30 15:37:10 +08:00
yukang
4189faa21e add typecheck for iterator 2023-06-30 14:50:27 +08:00
bors
b4591cb04c Auto merge of #113188 - matthiaskrgr:rollup-j3abaks, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #107624 (Stabilize `const_cstr_methods`)
 - #111403 (suggest `slice::swap` for `mem::swap(&mut x[0], &mut x[1])` borrowck error)
 - #113071 (Account for late-bound vars from parent arg-position impl trait)
 - #113165 (Encode item bounds for `DefKind::ImplTraitPlaceholder`)
 - #113171 (Properly implement variances_of for RPITIT GAT)
 - #113177 (Use structured suggestion when telling user about `for<'a>`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-30 06:31:57 +00:00
yukang
44a8a8d0ca Better messages for next in a iterator inside for loops 2023-06-30 14:02:02 +08:00
Matthias Krüger
207b24413c
Rollup merge of #113177 - estebank:hrlt-sugg, r=compiler-errors
Use structured suggestion when telling user about `for<'a>`

```
error[E0637]: `&` without an explicit lifetime name cannot be used here
  --> $DIR/E0637.rs:13:13
   |
LL |     T: Into<&u32>,
   |             ^ explicit lifetime name needed here
   |
help: consider introducing a higher-ranked lifetime here
   |
LL |     T: for<'a> Into<&'a u32>,
   |        +++++++       ++
```
2023-06-30 08:01:14 +02:00
Matthias Krüger
38e6bba9c1
Rollup merge of #113171 - spastorino:new-rpitit-25, r=compiler-errors
Properly implement variances_of for RPITIT GAT

This fixes some of the issues found by crater run in https://github.com/rust-lang/rust/pull/112988#issuecomment-1610019572

r? ``@compiler-errors``
2023-06-30 08:01:14 +02:00
Matthias Krüger
c8f50ee111
Rollup merge of #113165 - compiler-errors:rpitits-foreign-bounds, r=spastorino
Encode item bounds for `DefKind::ImplTraitPlaceholder`

This was lost in a refactoring -- `hir::ItemKind::OpaqueTy` doesn't always map to `DefKind::Opaque`, specifically for RPITITs, so the check was migrated subtly wrong, and unfortunately I never had a test for this 🙃

Fixes #113155

r? ``@cjgillot``
2023-06-30 08:01:13 +02:00
Matthias Krüger
0b96b25bdf
Rollup merge of #113071 - compiler-errors:no-parent-non-lifetime-args-in-apit, r=eholk
Account for late-bound vars from parent arg-position impl trait

We should be reporting an error like we do for late-bound args coming from a parent APIT.

Fixes #113016
2023-06-30 08:01:13 +02:00
Matthias Krüger
6c22e0419f
Rollup merge of #111403 - y21:suggest-slice-swap, r=compiler-errors
suggest `slice::swap` for `mem::swap(&mut x[0], &mut x[1])` borrowck error

Recently saw someone ask why this code (example slightly modified):
```rs
fn main() {
  let mut foo = [1, 2];
  std::mem::swap(&mut foo[0], &mut foo[1]);
}
```
triggers this error and how to fix it:
```
error[E0499]: cannot borrow `foo[_]` as mutable more than once at a time
 --> src/main.rs:4:33
  |
4 |     std::mem::swap(&mut foo[0], &mut foo[1]);
  |     -------------- -----------  ^^^^^^^^^^^ second mutable borrow occurs here
  |     |              |
  |     |              first mutable borrow occurs here
  |     first borrow later used by call
  |
  = help: consider using `.split_at_mut(position)` or similar method to obtain two mutable non-overlapping sub-slices
```
The current help message is nice and goes in the right direction, but I think we can do better for this specific instance and suggest `slice::swap`, which makes this compile
2023-06-30 08:01:12 +02:00
Matthias Krüger
016c306ce6
Rollup merge of #107624 - tgross35:const-cstr-methods, r=dtolnay
Stabilize `const_cstr_methods`

This PR seeks to stabilize `const_cstr_methods`. Fixes most of #101719

## New const stable API

```rust
impl CStr {
    // depends: memchr
    pub const fn from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError> {...}
    // depends: const_slice_index
    pub const fn to_bytes(&self) -> &[u8] {}
    // depends: pointer casts
    pub const fn to_bytes_with_nul(&self) -> &[u8] {}
    // depends: str::from_utf8
    pub const fn to_str(&self) -> Result<&str, str::Utf8Error> {}
}
```

I don't think any of these methods will have any issue when `CStr` becomes a thin pointer as long as `memchr` is const  (which also allows for const `strlen`) .

## Notes

- `from_bytes_until_nul` relies on `const_slice_index`, which relies on `const_trait_impls`, and generally this should be avoided. After talking with Oli, it should be OK in this case because we could replace the ranges with pointer tricks if needed (worst case being those feature gates disappear). https://github.com/rust-lang/rust/pull/107624#discussion_r1101468480
- Making `from_ptr` const is deferred because it depends on `const_eval_select`. I have moved this under the new flag `const_cstr_from_ptr` https://github.com/rust-lang/rust/pull/107624#discussion_r1101555239

cc ``@oli-obk`` I think you're the const expert

``@rustbot`` modify labels: +T-libs-api +needs-fcp
2023-06-30 08:01:12 +02:00
Michael Goulet
91bc3f0ff6 No need to distinguish LocalTy from Ty 2023-06-30 04:51:02 +00:00
jyn
53185459df document that the panic in collect_intra_doc_links is load-bearing 2023-06-29 23:48:56 -05:00
jyn
368f51743b Set channel = nightly in dist profile 2023-06-29 23:37:20 -05:00
bors
97279e91d8 Auto merge of #113162 - matthiaskrgr:rollup-fct3wj7, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #111322 (Support for native WASM exceptions)
 - #112086 (resolve: Remove artificial import ambiguity errors)
 - #112234 (refactor `tool_doc!`)
 - #112300 (Convert `run-make/coverage-reports` tests to use a custom compiletest mode)
 - #112795 (Migrate some rustc_builtin_macros to SessionDiagnostic)
 - #113144 (Make the `Elaboratable` trait take clauses)
 - #113161 (Fix type privacy lints error message)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-30 03:27:42 +00:00
bors
73f14176e3 Auto merge of #10774 - c410-f3r:lock-1, r=Jarcho
[significant_drop_tightening] Fix #10413

Fix #10413

This is quite a rewrite that unfortunately took a  large amount of time. I tried my best to comment what is going on to easy review but feel free to ask any question.

The problem basically is that the current algorithm is only taking into consideration single blocks which means that things like the following don't work or show unpredictable results.

```rust
let mutex = Mutex::new(1);
{
  let lock = mutex.lock().unwrap();
  {
    let _ = *lock;
  }
}
```

The solve the issue, each path that refers a lock is now being tracked individually.

```
changelog: [`significant_drop_tightening`]: Lift the restriction of only considerate single blocks
```
2023-06-30 02:51:15 +00:00
Michael Goulet
8ad5ea7b01 Adapt tests from #105258 2023-06-30 02:39:07 +00:00
Michael Goulet
473c88dfb6 Flip the order of binder instantiation for better diagnostics 2023-06-30 02:17:07 +00:00
Michael Goulet
d567e4f8b6 Error for RPITIT hidden tys that capture more than their trait defn 2023-06-30 02:17:07 +00:00
Santiago Pastorino
a10406318e
Properly implement variances_of for RPITIT GAT 2023-06-29 23:08:32 -03:00
bors
8aed93d912 Auto merge of #113116 - nnethercote:codegen-opts, r=oli-obk
A mish-mash of micro-optimizations

These were aimed at speeding up LLVM codegen, but ended up affecting other places as well.

r? `@bjorn3`
2023-06-30 00:35:19 +00:00
Esteban Küber
7d33094d3a Use structured suggestion when telling user about for<'a>
```
error[E0637]: `&` without an explicit lifetime name cannot be used here
  --> $DIR/E0637.rs:13:13
   |
LL |     T: Into<&u32>,
   |             ^ explicit lifetime name needed here
   |
help: consider introducing a higher-ranked lifetime here
   |
LL |     T: for<'a> Into<&'a u32>,
   |        +++++++       ++
```
2023-06-30 00:34:14 +00:00
bors
3d4c536e87 Auto merge of #11013 - Centri3:redundant_rest_pattern, r=giraffate
New lint [`redundant_at_rest_pattern`]

Closes #11011

It's always a great feeling when a new lint triggers on clippy itself 😄

changelog: New lint [`redundant_at_rest_pattern`]
2023-06-29 23:54:35 +00:00
bors
330727467b Auto merge of #112682 - spastorino:new-rpitit-21, r=compiler-errors
Add bidirectional where clauses on RPITIT synthesized GATs

Given the following:

```rust
struct MyStruct<'a, T>(&'a T);

trait MyTrait<'a, T> {
    fn my_fn<'b, 'c, 'd, V>(item: &'c String) -> impl Sized + 'a + 'b + 'c where V: 'b, V: 'd;
}

impl<'a, T> MyTrait<'a, T> for MyStruct<'a, T> {
    fn my_fn<'b, 'c, 'd, V>(_: &'c String) -> impl Sized + 'a + 'b + 'c
    where
        V: 'b,
        V: 'd,
    {
        unimplemented!();
    }
}
```

We need the desugaring to be:

```rust
trait MyTrait<'a, T> {
    type MyFn<'bf, 'df, Vf, 'a2, 'b2, 'c2>: Sized + 'a2 + 'b2 + 'c2 where Vf: 'b2, 'a2: 'a, 'a: 'a2, 'b2: 'bf, 'bf: 'b2;

    fn my_fn<'b, 'c, 'd, V>(item: &'c String) -> MyStruct<'a>::MyFn<'b, 'd, V, 'a, 'b, 'c> where V: 'b, V: 'd {
        type opaque<'a3, 'b3, 'c3>;
    };
}

impl<'a, T> MyIter<'a, T> for MyStruct<'a, T> {
    type MyFn<'bf, 'df, Vf, 'a2, 'b2, 'c2> = impl Sized + 'a2 + 'b2 + 'c2 where Vf: b2, 'a2: 'a, 'a: 'a2, 'b2: 'bf, 'bf: 'b2;

    fn my_fn<'b, 'c, 'd, V>(_: &'c String) -> MyStruct<'a>::MyFn<'a, 'b, 'c, V> where V: 'b, V: 'd {
        type opaque<'a3, 'b3, 'c3>;
        unimplemented!();
    }
}
```

This PR adds the where clauses for the `MyFn` generated GATs.

This is a draft with a very ugly solution so we can make comments over concrete code.

r? `@compiler-errors`
2023-06-29 21:24:51 +00:00