Commit Graph

170029 Commits

Author SHA1 Message Date
bors
c570ab5a0b Auto merge of #98037 - compiler-errors:rollup-fbvy456, r=compiler-errors
Rollup of 3 pull requests

Successful merges:

 - #97920 (Fix some test annotations)
 - #97950 (Clarify `#[derive(PartialEq)]` on enums)
 - #98011 (Add documentation for error E0208)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-13 01:45:16 +00:00
Michael Goulet
ac73b19a73
Rollup merge of #98011 - onlineSoftwareDevOK:long-error-explanation-e0208, r=GuillaumeGomez
Add documentation for error E0208

Related to https://github.com/rust-lang/rust/issues/61137
2022-06-12 17:35:42 -07:00
Michael Goulet
5dccf4e5fc
Rollup merge of #97950 - eggyal:issue-97945, r=Dylan-DPC
Clarify `#[derive(PartialEq)]` on enums

Fixes #97945
2022-06-12 17:35:41 -07:00
Michael Goulet
6efaaed64b
Rollup merge of #97920 - bjorn3:test_annotation_fixes, r=Dylan-DPC
Fix some test annotations

These are necessary for running the rustc test suite with cg_clif.
2022-06-12 17:35:40 -07:00
bors
1fb9603022 Auto merge of #98020 - TaKO8Ki:use-create-snapshot-for-diagnostic-in-rustc-expand, r=Dylan-DPC
Use `create_snapshot_for_diagnostic` instead of `clone` for `Parser`

Use [`create_snapshot_for_diagnostic`](cd11905716/compiler/rustc_parse/src/parser/diagnostics.rs (L214-L223)) I implemented in https://github.com/rust-lang/rust/pull/94731 instead of `clone` to avoid duplicate unclosed delims errors being emitted when the `Parser` is dropped. I missed this one in #95068.
2022-06-12 23:25:35 +00:00
onlinesoftwaredevok
99672fb2dc Add comment for internal error codes 2022-06-12 19:52:49 -03:00
bors
546c826f0c Auto merge of #98018 - scottmcm:miri-yeet, r=RalfJung
Try out `yeet` in the MIR interpreter

Since we got a new bootstrap, we can give this a shot.

r? `@oli-obk`
2022-06-12 20:44:58 +00:00
bors
4153a2ec45 Auto merge of #97833 - tmiasko:borrowed-locals, r=nagisa
Remove duplicated implementations of borrowed locals analysis
2022-06-12 17:56:54 +00:00
bjorn3
2f47edbf09 Fix some test annotations
These are necessary for running the rustc test suite with cg_clif
2022-06-12 13:15:35 +00:00
bors
53305f1562 Auto merge of #98025 - Dylan-DPC:rollup-cwt2hb7, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #97921 (additional docs example for replace **all** of str)
 - #97970 (Fix Termination impl panic on closed stderr)
 - #97991 (Use safer `strip=symbols`-flag for dylibs on macOS)
 - #97992 (Stabilize scoped threads.)
 - #98012 (`ValuePairs::PolyTraitRefs` should be called "trait"s in type error diagnostics)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-12 12:41:06 +00:00
Dylan DPC
53090fefd1
Rollup merge of #98012 - compiler-errors:poly-trait-refs-are-traits, r=cjgillot
`ValuePairs::PolyTraitRefs` should be called "trait"s in type error diagnostics

Pretty simple, we already do this for `ValuePairs::TraitRefs`...
2022-06-12 12:14:30 +02:00
Dylan DPC
a24ca03660
Rollup merge of #97992 - m-ou-se:stabilize-scoped-threads, r=joshtriplett
Stabilize scoped threads.

Tracking issue: https://github.com/rust-lang/rust/issues/93203

FCP finished here: https://github.com/rust-lang/rust/issues/93203#issuecomment-1152249466
2022-06-12 12:14:29 +02:00
Dylan DPC
265e0f0d4b
Rollup merge of #97991 - davidkna:fix-macos-strip, r=joshtriplett
Use safer `strip=symbols`-flag for dylibs on macOS

Closes #93988

To safely strip dylibs on macOS, the `-x` flag is needed per the manpage (see the discussion here: https://github.com/rust-lang/rust/issues/93988#issuecomment-1042574854).

Thus, when the current `crate_type` is producing a dylib (I assume this is the case for proc macros) use the `-x` flag instead of bare `strip` for `strip=symbols`.
2022-06-12 12:14:28 +02:00
Dylan DPC
cf3c41aa9d
Rollup merge of #97970 - dtolnay:terminate, r=joshtriplett
Fix Termination impl panic on closed stderr

Repro:

```rust
#![feature(backtrace)]

use std::backtrace::Backtrace;
use std::io::{self, Write as _};
use std::panic::{self, PanicInfo};

#[derive(Debug)]
pub struct Error;

fn panic_hook(panic_info: &PanicInfo) {
    let backtrace = Backtrace::force_capture();
    let _ = write!(io::stdout(), "{}\n{}", panic_info, backtrace);
}

fn main() -> Result<(), Error> {
    panic::set_hook(Box::new(panic_hook));
    let stderr = io::stderr();
    let mut stderr = stderr.lock();
    while stderr.write_all(b".\n").is_ok() {}
    Err(Error)
}
```

### Before:

```console
$ target/debug/repro 3>&2 2>&1 1>&3 | head
.
.
.
.
.
.
.
.
.
.
panicked at 'failed printing to stderr: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9
   0: testing::panic_hook
             at ./src/main.rs:11:21
   1: core::ops::function::Fn::call
             at /git/rust/library/core/src/ops/function.rs:77:5
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::begin_panic_handler::{{closure}}
   4: std::sys_common::backtrace::__rust_end_short_backtrace
   5: rust_begin_unwind
   6: core::panicking::panic_fmt
   7: std::io::stdio::_eprint
   8: <core::result::Result<!,E> as std::process::Termination>::report
             at /git/rust/library/std/src/process.rs:2164:9
   9: <core::result::Result<(),E> as std::process::Termination>::report
             at /git/rust/library/std/src/process.rs:2148:25
  10: std::rt::lang_start::{{closure}}
             at /git/rust/library/std/src/rt.rs:145:18
  11: std::rt::lang_start_internal
  12: std::rt::lang_start
             at /git/rust/library/std/src/rt.rs:144:17
  13: main
  14: __libc_start_main
             at /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
  15: _start
```

### After:

```console
$ target/debug/repro 3>&2 2>&1 1>&3 | head
.
.
.
.
.
.
.
.
.
.
```
2022-06-12 12:14:27 +02:00
Dylan DPC
b2172b7a53
Rollup merge of #97921 - bvanjoi:docs-example-str-replace, r=Dylan-DPC
additional docs example for replace **all** of str
2022-06-12 12:14:26 +02:00
Takayuki Maeda
84a13a28b7 use create_snapshot_for_diagnostic instead of clone 2022-06-12 17:27:36 +09:00
bors
ae2aa18d74 Auto merge of #97993 - lengyijun:clean-variance, r=compiler-errors
clean variance test

Remove unnecessary generic parameter.
2022-06-12 06:43:18 +00:00
Scott McMurray
a6c6fa0e33 Try out yeet in the MIR interpreter 2022-06-11 23:08:06 -07:00
Tomasz Miąsko
777bf84f6c Merge arms in borrowed locals transfer function 2022-06-12 07:27:57 +02:00
Tomasz Miąsko
915f091819 Remove duplicated implementations of borrowed locals analysis 2022-06-12 07:27:57 +02:00
bors
37a42258ff Auto merge of #97778 - compiler-errors:misc-diagnostics-tidy, r=cjgillot
Tidy up miscellaneous bounds suggestions

Just some small fixes to suggestions

- Generalizes `Ty::is_suggestable` into a `TypeVisitor`, so that it can be called on things other than `Ty`
- Makes `impl Trait` in arg position no longer suggestible (generalizing the fix in #97640)
- Fixes `impl Trait` not being replaced with fresh type param when it's deeply nested in function signature (fixes #97760)
- Fixes some poor handling of `where` clauses with no predicates (also #97760)
- Uses `InferCtxt::resolve_numeric_literals_with_default` so we suggest `i32` instead of `{integer}` (fixes #97677)

Sorry there aren't many tests the fixes. Most of them would just be duplicates of other tests with empty `where` clauses or `impl Trait` in arg position instead of generic params. Let me know if you'd want more test coverage.
2022-06-12 00:47:54 +00:00
Michael Goulet
5f7474e6dc Address comments 2022-06-11 16:38:48 -07:00
Michael Goulet
38d7e2734f Properly replace impl Trait in fn args, turn {integer} to i32 2022-06-11 16:38:48 -07:00
Michael Goulet
55805ab473 Make is_suggestable work on all TypeFoldable 2022-06-11 16:38:48 -07:00
Michael Goulet
9c47afe9fa Handle empty where-clause better 2022-06-11 16:27:01 -07:00
Michael Goulet
8506b7d4e0 Make Ty::is_suggestable use a visitor 2022-06-11 16:27:01 -07:00
Michael Goulet
acab4464f6 ValuePairs::PolyTraitRefs should be called 'trait' 2022-06-11 16:25:35 -07:00
bors
e652caa679 Auto merge of #97705 - compiler-errors:guide-inference, r=lcnr
Fix inference issues with unconstrained base expr in `type_changing_struct_update`

Use fresh infer vars to guide inference along in `type_changing_struct_update`.

Fixes #96878
2022-06-11 22:32:20 +00:00
bors
99930ac7f8 Auto merge of #95880 - cjgillot:def-ident-span, r=petrochenkov
Handle `def_ident_span` like `def_span`.

`def_ident_span` had an ad-hoc status in the compiler.

This PR refactors it to be a first-class citizen like `def_span`:
- it gets encoded in the main metadata loop, instead of the visitor;
- its implementation is updated to mirror the one of `def_span`.

We do not remove the `Option` in the return type, since some items do not have an ident, AnonConsts for instance.
2022-06-11 20:08:48 +00:00
bors
c08b235a5c Auto merge of #97996 - matthiaskrgr:rollup-bvbjlid, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #97904 (Small grammar fix in the compile_error documentation)
 - #97943 (line 1352, change `self` to `*self`, other to `*other`)
 - #97969 (Make -Cpasses= only apply to pre-link optimization)
 - #97990 (Add more eslint checks)
 - #97994 (feat(fix): update some links in `hir.rs`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-11 17:49:22 +00:00
Michael Goulet
50529111f0 Stop using string equality to check if ADT is a union 2022-06-11 10:35:36 -07:00
Michael Goulet
d9ddaf0d6f Use if-let instead of match with guard 2022-06-11 10:24:56 -07:00
Michael Goulet
6c00e54667 Guide inference along during type_changing_struct_update 2022-06-11 09:30:37 -07:00
Matthias Krüger
178cffe563
Rollup merge of #97994 - kyoto7250:fix_hir_link, r=cjgillot
feat(fix): update some links in `hir.rs`

This PR fixes some links in `hir.rs`.

The relative paths seem to be different from when this comment was committed.

ref:

- related commit
1e6adad33f

- current page
https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir/hir/enum.QPath.html
https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir/hir/enum.ExprKind.html#variant.MethodCall

Thank you in advance.
2022-06-11 18:05:36 +02:00
Matthias Krüger
c82bc1e9a8
Rollup merge of #97990 - GuillaumeGomez:eslint-checks, r=Dylan-DPC
Add more eslint checks

List of newly added checks:

 * [no-lonely-if](https://eslint.org/docs/rules/no-lonely-if)
 * [no-mixed-operators](https://eslint.org/docs/rules/no-mixed-operators)
 * [no-multi-assign](https://eslint.org/docs/rules/no-multi-assign)
 * [no-return-assign](https://eslint.org/docs/rules/no-return-assign)
 * [no-script-url](https://eslint.org/docs/rules/no-script-url)

r? `@Dylan-DPC`
2022-06-11 18:05:35 +02:00
Matthias Krüger
b3d8e71cf1
Rollup merge of #97969 - inglorion:prelinkpasses, r=nikic
Make -Cpasses= only apply to pre-link optimization

This change causes passes specified in -Cpasses= to be applied
only during pre-link optimization, not during LTO. This avoids
such passes running multiple times, which they may not be
designed for.

Fixes https://github.com/rust-lang/rust/issues/97713
2022-06-11 18:05:34 +02:00
Matthias Krüger
39de4e4b6f
Rollup merge of #97943 - Warrenren:master, r=Dylan-DPC
line 1352, change `self` to `*self`, other to `*other`

The current code will not results bug, but it difficult to understand. These code result to call &f32::partial_cmp(), and the performance will be lower than the changed code. I'm not sure why the current code don't use (*self) (*other), if you have some idea, please let me know.
2022-06-11 18:05:33 +02:00
Matthias Krüger
4b7ec84c31
Rollup merge of #97904 - est31:master, r=Dylan-DPC
Small grammar fix in the compile_error documentation
2022-06-11 18:05:32 +02:00
bors
85a26a9a96 Auto merge of #97989 - Dylan-DPC:rollup-wol1a1y, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #97761 (validating the vtable can lead to Stacked Borrows errors)
 - #97789 (Fix #71363's test by adding `-Z translate-remapped-path-to-local-path=no`)
 - #97913 (Wrap `HirId`s of locals into `LocalVarId`s for THIR nodes)
 - #97979 (Fix typos in Provider API docs)
 - #97987 (remove an unnecessary `String`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-11 15:08:41 +00:00
kyoto7250
3685a1e9d2 feat(fix): update some links 2022-06-11 23:19:58 +09:00
Mara Bos
ae0a533b0b Stabilize scoped threads. 2022-06-11 15:01:52 +02:00
lengyijun
4bb0965896 clean variance test 2022-06-11 12:37:39 +00:00
Guillaume Gomez
fb68e0bf9b Add eslint rule "no-script-url" 2022-06-11 13:23:08 +02:00
Guillaume Gomez
fb728c66c6 Add eslint rule "no-return-assign" 2022-06-11 13:22:12 +02:00
David Knaack
8558b35295 Use safer strip=symbols-flag for dylibs on macOS 2022-06-11 13:20:17 +02:00
Guillaume Gomez
e3d89dbcdb Add eslint rule "no-multi-assign" 2022-06-11 13:20:01 +02:00
Guillaume Gomez
4a874b0e59 Add eslint rule "no-mixed-operator" 2022-06-11 13:19:29 +02:00
Guillaume Gomez
64ac29bc1a Add eslint rule "no-lonely-if" 2022-06-11 13:16:23 +02:00
Dylan DPC
b3c9a2fde4
Rollup merge of #97987 - TaKO8Ki:remove-unnecessary-format-macro, r=Dylan-DPC
remove an unnecessary `String`
2022-06-11 12:59:30 +02:00
Dylan DPC
54d7b3fb9c
Rollup merge of #97979 - ben0x539:providerdocs, r=Dylan-DPC
Fix typos in Provider API docs
2022-06-11 12:59:29 +02:00