]> git.lizzy.rs Git - rust.git/log
rust.git
17 months agoRollup merge of #106427 - mejrs:translation_errors, r=davidtwco
nils [Wed, 11 Jan 2023 16:30:54 +0000 (17:30 +0100)]
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco

Improve fluent error messages

These have been really frustrating me while migrating diagnostics.

17 months agoRollup merge of #106397 - compiler-errors:new-solver-impl-wc, r=lcnr
nils [Wed, 11 Jan 2023 16:30:53 +0000 (17:30 +0100)]
Rollup merge of #106397 - compiler-errors:new-solver-impl-wc, r=lcnr

Check `impl`'s `where` clauses in `consider_impl_candidate` in experimental solver

Check impl's nested predicates as part of the recursive evaluate in `consider_impl_candidate`.

<sub>Unless, for some reason, these are intentionally **not** checked here -- in which case, I really don't understand where they're being checked...<sub>

r? ```@lcnr```

17 months agoRollup merge of #106321 - compiler-errors:delayed-bug-backtrace, r=Nilstrieb
nils [Wed, 11 Jan 2023 16:30:53 +0000 (17:30 +0100)]
Rollup merge of #106321 - compiler-errors:delayed-bug-backtrace, r=Nilstrieb

Collect and emit proper backtraces for `delay_span_bug`s

This is a follow-up to #106317, which addresses this comment (https://github.com/rust-lang/rust/issues/106267#issuecomment-1367507507) which notes that `delay_span_bug`s' backtraces are nonsense.

Captures and emits the backtrace of the delayed span bug when it's *created*, rather than using the backtrace of the place where delayed bugs are flushed.

---

To test, I delayed a span bug during HIR typeck, specifically in `typeck_with_fallback`...

Before, note `flush_delayed` on frame 18. This is at the end of the compilation session, far from where the bug is being delayed.

```
error: internal compiler error: test
 --> /home/ubuntu/test.rs:1:1
  |
1 | fn main() {}
  | ^^^^^^^^^
  |
  = note: delayed at compiler/rustc_hir_typeck/src/lib.rs:196:14

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1634:13
stack backtrace:
   0:     0x7f9c3ec69dd1 - std::backtrace_rs::backtrace::libunwind::trace::h26056f81198c6594
                               at /home/ubuntu/rust2/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9c3ec69dd1 - std::backtrace_rs::backtrace::trace_unsynchronized::hacfb345a0c6d5bb1
                               at /home/ubuntu/rust2/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9c3ec69dd1 - std::sys_common::backtrace::_print_fmt::h18ea6016ac8030f3
                               at /home/ubuntu/rust2/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9c3ec69dd1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he35dde201d0c2d09
                               at /home/ubuntu/rust2/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9c3ecee308 - core::fmt::write::h094ad263467a053c
                               at /home/ubuntu/rust2/library/core/src/fmt/mod.rs:1208:17
   5:     0x7f9c3ec8aaf1 - std::io::Write::write_fmt::hd47b4e2324b4d9b7
                               at /home/ubuntu/rust2/library/std/src/io/mod.rs:1682:15
   6:     0x7f9c3ec69bfa - std::sys_common::backtrace::_print::h43044162653a17fc
                               at /home/ubuntu/rust2/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f9c3ec69bfa - std::sys_common::backtrace::print::hc8605da258fa5aeb
                               at /home/ubuntu/rust2/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f9c3ec4db87 - std::panicking::default_hook::{{closure}}::h9e37f23f75122a15
   9:     0x7f9c3ec4d97b - std::panicking::default_hook::h602873a063f84da2
                               at /home/ubuntu/rust2/library/std/src/panicking.rs:286:9
  10:     0x7f9c3f6672b2 - <alloc[48d7b30605060536]::boxed::Box<dyn for<'a, 'b> core[672e3947e150d6c6]::ops::function::Fn<(&'a core[672e3947e150d6c6]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[672e3947e150d6c6]::marker::Send + core[672e3947e150d6c6]::marker::Sync> as core[672e3947e150d6c6]::ops::function::Fn<(&core[672e3947e150d6c6]::panic::panic_info::PanicInfo,)>>::call
                               at /home/ubuntu/rust2/library/alloc/src/boxed.rs:2002:9
  11:     0x7f9c3f6672b2 - rustc_driver[f5b6d32d8905ecdd]::DEFAULT_HOOK::{closure#0}::{closure#0}
                               at /home/ubuntu/rust2/compiler/rustc_driver/src/lib.rs:1204:17
  12:     0x7f9c3ec4e0d3 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfd13333ca953ae8e
                               at /home/ubuntu/rust2/library/alloc/src/boxed.rs:2002:9
  13:     0x7f9c3ec4e0d3 - std::panicking::rust_panic_with_hook::h45753e10264ebe7e
                               at /home/ubuntu/rust2/library/std/src/panicking.rs:692:13
  14:     0x7f9c422a1aa3 - std[3330b4673efabfce]::panicking::begin_panic::<rustc_errors[1b15f4e7e49d1fd5]::ExplicitBug>::{closure#0}
                               at /home/ubuntu/rust2/library/std/src/panicking.rs:608:9
  15:     0x7f9c422a1a46 - std[3330b4673efabfce]::sys_common::backtrace::__rust_end_short_backtrace::<std[3330b4673efabfce]::panicking::begin_panic<rustc_errors[1b15f4e7e49d1fd5]::ExplicitBug>::{closure#0}, !>
                               at /home/ubuntu/rust2/library/std/src/sys_common/backtrace.rs:137:18
  16:     0x7f9c3f63a996 - std[3330b4673efabfce]::panicking::begin_panic::<rustc_errors[1b15f4e7e49d1fd5]::ExplicitBug>
                               at /home/ubuntu/rust2/library/std/src/panicking.rs:607:12
  17:     0x7f9c4227a496 - std[3330b4673efabfce]::panic::panic_any::<rustc_errors[1b15f4e7e49d1fd5]::ExplicitBug>
                               at /home/ubuntu/rust2/library/std/src/panic.rs:61:5
  18:     0x7f9c4227cdf7 - <rustc_errors[1b15f4e7e49d1fd5]::HandlerInner>::flush_delayed::<alloc[48d7b30605060536]::vec::Vec<rustc_errors[1b15f4e7e49d1fd5]::diagnostic::Diagnostic>, &str, rustc_errors[1b15f4e7e49d1fd5]::ExplicitBug>
                               at /home/ubuntu/rust2/compiler/rustc_errors/src/lib.rs:1634:13
  19:     0x7f9c422498cf - <rustc_errors[1b15f4e7e49d1fd5]::Handler>::flush_delayed
                               at /home/ubuntu/rust2/compiler/rustc_errors/src/lib.rs:1225:9

[ FRAMES INTENTIONALLY OMITTED ]

  44:     0x7f9c3f6f3584 - <std[3330b4673efabfce]::thread::Builder>::spawn_unchecked_::<rustc_interface[947706ead88047d0]::util::run_in_thread_pool_with_globals<rustc_interface[947706ead88047d0]::interface::run_compiler<core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>, rustc_driver[f5b6d32d8905ecdd]::run_compiler::{closure#1}>::{closure#0}, core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>>::{closure#1}
                               at /home/ubuntu/rust2/library/std/src/thread/mod.rs:549:30
  45:     0x7f9c3f6f3584 - <<std[3330b4673efabfce]::thread::Builder>::spawn_unchecked_<rustc_interface[947706ead88047d0]::util::run_in_thread_pool_with_globals<rustc_interface[947706ead88047d0]::interface::run_compiler<core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>, rustc_driver[f5b6d32d8905ecdd]::run_compiler::{closure#1}>::{closure#0}, core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[672e3947e150d6c6]::result::Result<(), rustc_errors[1b15f4e7e49d1fd5]::ErrorGuaranteed>>::{closure#1} as core[672e3947e150d6c6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                               at /home/ubuntu/rust2/library/core/src/ops/function.rs:250:5
  46:     0x7f9c3ec81968 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he8b26fc22c6f51ec
                               at /home/ubuntu/rust2/library/alloc/src/boxed.rs:1988:9
  47:     0x7f9c3ec81968 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5cf9cbe75a8c3ddc
                               at /home/ubuntu/rust2/library/alloc/src/boxed.rs:1988:9
  48:     0x7f9c3ec5f99c - std::sys::unix::thread::Thread::new::thread_start::h2d6dd4455e97d031
                               at /home/ubuntu/rust2/library/std/src/sys/unix/thread.rs:108:17
  49:     0x7f9c37c69609 - start_thread
  50:     0x7f9c3ead0133 - clone
  51:                0x0 - <unknown>
```

After, note `typeck_with_fallback` on the 5th frame, that's where we *actually* need to be pointed to:

```
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: test
 --> /home/ubuntu/test.rs:1:1
  |
1 | fn main() {}
  | ^^^^^^^^^
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
                       at ./compiler/rustc_errors/src/lib.rs:1279:29
             1: <rustc_errors::HandlerInner>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
                       at ./compiler/rustc_errors/src/lib.rs:1553:9
             2: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
                       at ./compiler/rustc_errors/src/lib.rs:995:9
             3: <rustc_session::session::Session>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
                       at ./compiler/rustc_session/src/session.rs:600:9
             4: rustc_hir_typeck::typeck_with_fallback::<rustc_hir_typeck::typeck::{closure#0}>::{closure#0}
                       at ./compiler/rustc_hir_typeck/src/lib.rs:196:5
             5: rustc_hir_typeck::typeck_with_fallback::<rustc_hir_typeck::typeck::{closure#0}>
                       at ./compiler/rustc_hir_typeck/src/lib.rs:185:36
             6: rustc_hir_typeck::typeck
                       at ./compiler/rustc_hir_typeck/src/lib.rs:166:9

[ FRAMES INTENTIONALLY OMITTED ]

           108: std::panicking::try::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, core::panic::unwind_safe::AssertUnwindSafe<<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1}::{closure#0}>>
                       at ./library/std/src/panicking.rs:447:19
           109: std::panic::catch_unwind::<core::panic::unwind_safe::AssertUnwindSafe<<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1}::{closure#0}>, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
                       at ./library/std/src/panic.rs:140:14
           110: <std::thread::Builder>::spawn_unchecked_::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1}
                       at ./library/std/src/thread/mod.rs:549:30
           111: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                       at ./library/core/src/ops/function.rs:250:5
           112: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at ./library/alloc/src/boxed.rs:1988:9
           113: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at ./library/alloc/src/boxed.rs:1988:9
           114: std::sys::unix::thread::Thread::new::thread_start
                       at ./library/std/src/sys/unix/thread.rs:108:17
           115: start_thread
           116: clone
```

17 months agoAuto merge of #106458 - albertlarsan68:move-tests, r=jyn514
bors [Wed, 11 Jan 2023 11:17:22 +0000 (11:17 +0000)]
Auto merge of #106458 - albertlarsan68:move-tests, r=jyn514

Move src/test to the root

See MCP at rust-lang/compiler-team#573

There may be more changes needed.

The first commit is just the move of the files:
You can check that the first commit did not do anything else than renames by running
```
git diff --diff-filter=r -M100% <rust-lang remote>/master <first commit hash>
```
The output should be empty, because the filter excludes renames, and the match threshold for qualifying a rename is 100%.

The second one is mostly a "find and replace" of `src/test` to `tests` and whatever is needed to make CI pass.

What is left to do:
---

- [x] Move directory
- [ ] Change references to `src/test`
    - [x] Change references in-tree
    - [ ] Change references in submodules / out-of-tree docs
- [x] Make CI pass:
    - [x] Fix tidy
    - [x] Fix tests
    - [x] Bless tests if needed (shouldn't normally)
- [ ] Merge it !

17 months agoChange `src/test` to `tests` in source files, fix tidy and tests
Albert Larsan [Thu, 5 Jan 2023 08:45:44 +0000 (09:45 +0100)]
Change `src/test` to `tests` in source files, fix tidy and tests

17 months agoMove /src/test to /tests
Albert Larsan [Thu, 5 Jan 2023 08:13:28 +0000 (09:13 +0100)]
Move /src/test to /tests

17 months agoAuto merge of #105919 - uweigand:s390x-stack-overflow, r=Nilstrieb
bors [Wed, 11 Jan 2023 08:50:38 +0000 (08:50 +0000)]
Auto merge of #105919 - uweigand:s390x-stack-overflow, r=Nilstrieb

Fix stack overflow in recursive AST walk in early lint

The src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs test case added to verify https://github.com/rust-lang/rust/issues/74564 still crashes with a stack overflow on s390x-ibm-linux.

Symptom is a very deep recursion in compiler/rustc_lint/src/early.rs:
    fn visit_expr(&mut self, e: &'a ast::Expr) {
        self.with_lint_attrs(e.id, &e.attrs, |cx| {
            lint_callback!(cx, check_expr, e);
            ast_visit::walk_expr(cx, e);
        })
    }
(where walk_expr recursively calls back into visit_expr).  The crash happens at a nesting depth of over 17000 stack frames when using the default 8 MB stack size on s390x.

This patch fixes the problem by adding a ensure_sufficient_stack call to the with_lint_attrs routine (which also should take care of all the other mutually recursive visitors here).

Fixes part of https://github.com/rust-lang/rust/issues/105383.

17 months agoAuto merge of #106708 - JohnTitor:rollup-xcmg5yv, r=JohnTitor
bors [Wed, 11 Jan 2023 05:19:55 +0000 (05:19 +0000)]
Auto merge of #106708 - JohnTitor:rollup-xcmg5yv, r=JohnTitor

Rollup of 14 pull requests

Successful merges:

 - #105194 (Add comment to cleanup_kinds)
 - #106521 (remove E0280)
 - #106628 (Remove unneeded ItemId::Primitive variant)
 - #106635 (std sync tests: better type name, clarifying comment)
 - #106642 (Add test for #106062)
 - #106645 ([RFC 2397] Initial implementation)
 - #106653 (Fix help docs for -Zallow-features)
 - #106657 (Remove myself from rust-lang/rust reviewers)
 - #106662 (specialize impl of `ToString` on `bool`)
 - #106669 (create helper function for `rustc_lint_defs::Level` and remove it's duplicated code)
 - #106671 (Change flags with a fixed default value from Option<bool> to bool)
 - #106689 (Fix invalid files array re-creation in rustdoc-gui tester)
 - #106690 (Fix scrolling for item declaration block)
 - #106698 (Add compiler-errors to some trait system notification groups)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoRollup merge of #106698 - compiler-errors:notify-mr-errs, r=Mark-Simulacrum
Yuki Okushi [Wed, 11 Jan 2023 05:18:59 +0000 (14:18 +0900)]
Rollup merge of #106698 - compiler-errors:notify-mr-errs, r=Mark-Simulacrum

Add compiler-errors to some trait system notification groups

I care about these areas of the compiler.

17 months agoRollup merge of #106690 - GuillaumeGomez:item-declaration-scrolling, r=notriddle
Yuki Okushi [Wed, 11 Jan 2023 05:18:58 +0000 (14:18 +0900)]
Rollup merge of #106690 - GuillaumeGomez:item-declaration-scrolling, r=notriddle

Fix scrolling for item declaration block

Fixes https://github.com/rust-lang/rust/issues/105580.

The `contain: layout` was the issue here and the bug was actually on both mobile and desktop.

r? `@notriddle`

17 months agoRollup merge of #106689 - GuillaumeGomez:rustdoc-gui-files-array, r=notriddle
Yuki Okushi [Wed, 11 Jan 2023 05:18:58 +0000 (14:18 +0900)]
Rollup merge of #106689 - GuillaumeGomez:rustdoc-gui-files-array, r=notriddle

Fix invalid files array re-creation in rustdoc-gui tester

It fixes the error <code>expected `runTest` first argument to be a string</code>:

```
{
  file_name: {
    file_name: '/home/imperio/rust/rust/src/test/rustdoc-gui/type-declation-overflow.goml',
    output: 'type-declation-overflow... FAILED\n' +
      '...'
  },
  output: Error: expected `runTest` first argument to be a string
      at runTest (/home/imperio/rust/rust/node_modules/browser-ui-test/src/index.js:591:15)
      at runTests (/home/imperio/rust/rust/src/tools/rustdoc-gui/tester.js:144:26)
      at main (/home/imperio/rust/rust/src/tools/rustdoc-gui/tester.js:278:15)
} Error: expected `runTest` first argument to be a string
    at runTest (/home/imperio/rust/rust/node_modules/browser-ui-test/src/index.js:591:15)
    at runTests (/home/imperio/rust/rust/src/tools/rustdoc-gui/tester.js:144:26)
    at main (/home/imperio/rust/rust/src/tools/rustdoc-gui/tester.js:278:15)
```

The problem was that I concatenated two arrays of object whereas `files` is supposed to be an array of string.

r? `@notriddle`

17 months agoRollup merge of #106671 - tmiasko:opt-bool, r=wesleywiser
Yuki Okushi [Wed, 11 Jan 2023 05:18:57 +0000 (14:18 +0900)]
Rollup merge of #106671 - tmiasko:opt-bool, r=wesleywiser

Change flags with a fixed default value from Option<bool> to bool

17 months agoRollup merge of #106669 - ozkanonur:helper-function-for-lint-level, r=Nilstrieb
Yuki Okushi [Wed, 11 Jan 2023 05:18:57 +0000 (14:18 +0900)]
Rollup merge of #106669 - ozkanonur:helper-function-for-lint-level, r=Nilstrieb

create helper function for `rustc_lint_defs::Level` and remove it's duplicated code

Signed-off-by: ozkanonur <work@onurozkan.dev>
17 months agoRollup merge of #106662 - Ezrashaw:specialize-bool-tostring, r=cuviper
Yuki Okushi [Wed, 11 Jan 2023 05:18:56 +0000 (14:18 +0900)]
Rollup merge of #106662 - Ezrashaw:specialize-bool-tostring, r=cuviper

specialize impl of `ToString` on `bool`

Fixes #106611

Specialize `bool`s `ToString` impl by copying it from `Display`. This is a significant optimization as we avoid lots of dynamic dispatch. AFAIK, this doesn't require a API Change Proposal as this doesn't regress existing code and can be undone without regressing code.

17 months agoRollup merge of #106657 - jyn514:review, r=Mark-Simulacrum
Yuki Okushi [Wed, 11 Jan 2023 05:18:56 +0000 (14:18 +0900)]
Rollup merge of #106657 - jyn514:review, r=Mark-Simulacrum

Remove myself from rust-lang/rust reviewers

I don't have time to both review and work on my foundation grant.

17 months agoRollup merge of #106653 - ehuss:allow-features-help, r=nilstrieb
Yuki Okushi [Wed, 11 Jan 2023 05:18:55 +0000 (14:18 +0900)]
Rollup merge of #106653 - ehuss:allow-features-help, r=nilstrieb

Fix help docs for -Zallow-features

The arguments for -Zallow-features are comma-separated (`parse_opt_comma_list`), not space separated (`parse_list`).

17 months agoRollup merge of #106645 - c410-f3r:rfc-2397-1, r=oli-obk
Yuki Okushi [Wed, 11 Jan 2023 05:18:55 +0000 (14:18 +0900)]
Rollup merge of #106645 - c410-f3r:rfc-2397-1, r=oli-obk

[RFC 2397] Initial implementation

cc #51992

Because of previous experiences where ppl didn't have the time to review large PRs (or any at all), the implementation of this feature will be delivered in small chunks to hopefully make things faster.

In this initial PR, only the attribute is being declared and gated with ordinary tests.

17 months agoRollup merge of #106642 - albertlarsan68:test-106062, r=JohnTitor
Yuki Okushi [Wed, 11 Jan 2023 05:18:54 +0000 (14:18 +0900)]
Rollup merge of #106642 - albertlarsan68:test-106062, r=JohnTitor

Add test for #106062

Add a regression test for #106062

Closes #106062

17 months agoRollup merge of #106635 - RalfJung:std-test-nits, r=thomcc
Yuki Okushi [Wed, 11 Jan 2023 05:18:54 +0000 (14:18 +0900)]
Rollup merge of #106635 - RalfJung:std-test-nits, r=thomcc

std sync tests: better type name, clarifying comment

Just resolving some confusion that I encountered while reading these tests.

r? `@thomcc`

17 months agoRollup merge of #106628 - GuillaumeGomez:rm-itemid-primitive, r=notriddle
Yuki Okushi [Wed, 11 Jan 2023 05:18:53 +0000 (14:18 +0900)]
Rollup merge of #106628 - GuillaumeGomez:rm-itemid-primitive, r=notriddle

Remove unneeded ItemId::Primitive variant

As I mentioned [here](https://github.com/rust-lang/rust/pull/106412#issuecomment-1371405115), I wondered if `ItemId::Primitive` was actually used for anything. Apparently, it seems so because removing it led to no changes as far as I and tests could see.

r? `@notriddle`

17 months agoRollup merge of #106521 - oskgo:remove-E0280, r=jackh726
Yuki Okushi [Wed, 11 Jan 2023 05:18:53 +0000 (14:18 +0900)]
Rollup merge of #106521 - oskgo:remove-E0280, r=jackh726

remove E0280

After looking at #61137 I tried my hand at E0280. I'm unable to find a reasonable example that emits the error. There are a couple of old examples that compile with the current compiler ([#26217](https://github.com/rust-lang/rust/issues/26217), [#42114](https://github.com/rust-lang/rust/issues/42114), [#27113](https://github.com/rust-lang/rust/issues/27113)) and there is a [bug with chalk](https://github.com/rust-lang/rust/blob/b7cdb635c4b973572307ad288466fba64533369c/src/test/ui/chalkify/bugs/async.rs) that makes it emit the error, with a couple more chalk bugs on zulip.

It seems like the error is supposed to be emitted from unfulfilled where bounds, of which two are related to borrow checking (error in where T: 'a or where 'a: 'b) and thus tend to emit errors like "lifetime may not live long enough" from borrow checking instead. The final case is with type equality constraints (where <T as Iterator>::Item == u32), which is unimplemented ([#20041](https://github.com/rust-lang/rust/issues/20041)). That such different problems are supposed to have the same error code also seems strange to me.

Since the error seems to only be emitted when using chalk I propose to remove it and replace it with an ICE instead. A crater run might be warranted.

Pinging `@jackh726` due to removal of chalk test that now ICEs.

17 months agoRollup merge of #105194 - tmiasko:cleanup-kinds, r=davidtwco
Yuki Okushi [Wed, 11 Jan 2023 05:18:52 +0000 (14:18 +0900)]
Rollup merge of #105194 - tmiasko:cleanup-kinds, r=davidtwco

Add comment to cleanup_kinds

based on the original commit message 1ae7ae0c1c7ed68c616273f245647afa47f3cbde

17 months agoAdd compiler-errors to some trait system notification groups
Michael Goulet [Wed, 11 Jan 2023 00:32:52 +0000 (00:32 +0000)]
Add compiler-errors to some trait system notification groups

17 months agoAuto merge of #106687 - pietroalbini:pa-cve-nightly, r=pietroalbini
bors [Tue, 10 Jan 2023 22:49:23 +0000 (22:49 +0000)]
Auto merge of #106687 - pietroalbini:pa-cve-nightly, r=pietroalbini

[nightly] Fix CVE-2022-46176

See https://blog.rust-lang.org/2023/01/10/cve-2022-46176.html

r? `@ghost`

17 months agoRemove unneeded ItemId::Primitive variant
Guillaume Gomez [Mon, 9 Jan 2023 11:09:32 +0000 (12:09 +0100)]
Remove unneeded ItemId::Primitive variant

17 months agoAdd GUI test for item declaration block scrolling
Guillaume Gomez [Tue, 10 Jan 2023 17:27:12 +0000 (18:27 +0100)]
Add GUI test for item declaration block scrolling

17 months agoFix scrolling for item declaration block
Guillaume Gomez [Tue, 10 Jan 2023 17:27:00 +0000 (18:27 +0100)]
Fix scrolling for item declaration block

17 months agoFix invalid files array re-creation in rustdoc-gui tester
Guillaume Gomez [Tue, 10 Jan 2023 17:16:43 +0000 (18:16 +0100)]
Fix invalid files array re-creation in rustdoc-gui tester

17 months agoupdate release notes for 1.66.1
Pietro Albini [Tue, 10 Jan 2023 12:08:25 +0000 (13:08 +0100)]
update release notes for 1.66.1

17 months agobump Cargo submodule to fix CVE-2022-46176
Pietro Albini [Tue, 10 Jan 2023 12:13:04 +0000 (13:13 +0100)]
bump Cargo submodule to fix CVE-2022-46176

17 months agodisable fast submodule checkout due to spurious ci failures
Pietro Albini [Tue, 10 Jan 2023 15:06:19 +0000 (16:06 +0100)]
disable fast submodule checkout due to spurious ci failures

17 months agoChange type of box_noalias to bool
Tomasz MiÄ…sko [Fri, 6 Jan 2023 00:00:00 +0000 (00:00 +0000)]
Change type of box_noalias to bool

17 months agoChange type of mutable_noalias to bool
Tomasz MiÄ…sko [Fri, 6 Jan 2023 00:00:00 +0000 (00:00 +0000)]
Change type of mutable_noalias to bool

17 months agoAdd comment to cleanup_kinds
Tomasz MiÄ…sko [Sat, 3 Dec 2022 00:00:00 +0000 (00:00 +0000)]
Add comment to cleanup_kinds

based on the original commit message 1ae7ae0c1c7ed68c616273f245647afa47f3cbde

17 months agocreate helper function for `rustc_lint_defs::Level` and remove it's duplicated code...
ozkanonur [Tue, 10 Jan 2023 07:56:17 +0000 (10:56 +0300)]
create helper function for `rustc_lint_defs::Level` and remove it's duplicated code r=ozkanonur

Signed-off-by: ozkanonur <work@onurozkan.dev>
17 months agoAuto merge of #106607 - compiler-errors:be-more-accurate-abt-method-suggestions,...
bors [Tue, 10 Jan 2023 06:22:01 +0000 (06:22 +0000)]
Auto merge of #106607 - compiler-errors:be-more-accurate-abt-method-suggestions, r=oli-obk

Consider return type when giving various method suggestions

1. Fix a bug in method probe where we weren't normalizing `xform_ret_ty` for non-`impl` method candidates. This shouldn't affect happy-path code, since we only use `xform_ret_ty` when probing methods for diagnostics (I think).
2. Pass the return type expectation down to `lookup_probe`/`probe_for_name` usages in diagnostics. Added a few UI tests to gate against bad suggestions.
3. Make a `FnCtxt::lookup_probe_for_diagnostic` which properly passes down `IsSuggestion(true)`. Should help suppress other weird notes in some corner cases.

17 months agoAuto merge of #106656 - JohnTitor:rollup-rk2qltg, r=JohnTitor
bors [Tue, 10 Jan 2023 03:26:29 +0000 (03:26 +0000)]
Auto merge of #106656 - JohnTitor:rollup-rk2qltg, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #105034 (Add example for iterator_flatten)
 - #105708 (Enable atomic cas for bpf targets)
 - #106175 (Fix bad import suggestion with nested `use` tree)
 - #106204 (No need to take opaques in `check_type_bounds`)
 - #106387 (Revert "bootstrap: Get rid of `tail_args` in `stream_cargo`")
 - #106636 (Accept old spelling of Fuchsia target triples)
 - #106639 (update Miri)
 - #106640 (update test for inductive canonical cycles)
 - #106647 (rustdoc: merge common CSS for `a`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoimpl: specialize impl of `ToString` on `bool`
Ezra Shaw [Mon, 9 Jan 2023 09:21:21 +0000 (22:21 +1300)]
impl: specialize impl of `ToString` on `bool`

17 months agoremove E0280 and ICE instead
bowlerman [Fri, 6 Jan 2023 01:29:37 +0000 (02:29 +0100)]
remove E0280 and ICE instead

17 months agoAuto merge of #106495 - JohnTitor:issue-100772, r=compiler-errors
bors [Tue, 10 Jan 2023 00:22:16 +0000 (00:22 +0000)]
Auto merge of #106495 - JohnTitor:issue-100772, r=compiler-errors

Add regression test for #100772

Closes #100772
r? `@compiler-errors`
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
17 months ago[RFC 2397] Initial implementation
Caio [Mon, 9 Jan 2023 23:51:01 +0000 (20:51 -0300)]
[RFC 2397] Initial implementation

17 months agoRemove myself from rust-lang/rust reviewers
Joshua Nelson [Mon, 9 Jan 2023 23:39:04 +0000 (17:39 -0600)]
Remove myself from rust-lang/rust reviewers

I don't have time to both review and work on my foundation grant.

17 months agoRollup merge of #106647 - notriddle:notriddle/a, r=GuillaumeGomez
Yuki Okushi [Mon, 9 Jan 2023 23:05:37 +0000 (08:05 +0900)]
Rollup merge of #106647 - notriddle:notriddle/a, r=GuillaumeGomez

rustdoc: merge common CSS for `a`

17 months agoRollup merge of #106640 - lcnr:update-test, r=jackh726
Yuki Okushi [Mon, 9 Jan 2023 23:05:36 +0000 (08:05 +0900)]
Rollup merge of #106640 - lcnr:update-test, r=jackh726

update test for inductive canonical cycles

the previous test always resulted in a cycle :sweat_smile: cc https://github.com/rust-lang/chalk/pull/787.

I checked with #102713 and this is the only test which fails with that PR.

r? ``@jackh726``

17 months agoRollup merge of #106639 - RalfJung:miri, r=RalfJung
Yuki Okushi [Mon, 9 Jan 2023 23:05:36 +0000 (08:05 +0900)]
Rollup merge of #106639 - RalfJung:miri, r=RalfJung

update Miri

Notable PRs:
- https://github.com/rust-lang/miri/pull/2748
- https://github.com/rust-lang/miri/pull/2752

r? `@ghost`

17 months agoRollup merge of #106636 - djkoloski:accept_old_fuchsia_triple, r=tmandry
Yuki Okushi [Mon, 9 Jan 2023 23:05:35 +0000 (08:05 +0900)]
Rollup merge of #106636 - djkoloski:accept_old_fuchsia_triple, r=tmandry

Accept old spelling of Fuchsia target triples

The old spelling of Fuchsia target triples was changed in #106429 to add a proper vendor. Because the old spelling is widely used, some projects may need time to migrate their uses to the new triple spelling. The old spelling may eventually be removed altogether.

r? ``@tmandry``

17 months agoRollup merge of #106387 - jyn514:clippy, r=Mark-Simulacrum
Yuki Okushi [Mon, 9 Jan 2023 23:05:35 +0000 (08:05 +0900)]
Rollup merge of #106387 - jyn514:clippy, r=Mark-Simulacrum

Revert "bootstrap: Get rid of `tail_args` in `stream_cargo`"

This reverts commit 9dfe50440e6d48bd2fd40a4b7b3992998e55eace. (Note: that merged as part of https://github.com/rust-lang/rust/pull/106305, but https://github.com/rust-lang/rust/pull/106305/ contains more commits than just 9dfe50440e6d48bd2fd40a4b7b3992998e55eace.)

Fixes `x clippy`. It turns out `clippy` was the only one using `tail_args` ðŸ¤¦ sorry for not testing this earlier.

r? `@Mark-Simulacrum`

17 months agoRollup merge of #106204 - compiler-errors:no-take-opaques-in-compare, r=oli-obk
Yuki Okushi [Mon, 9 Jan 2023 23:05:34 +0000 (08:05 +0900)]
Rollup merge of #106204 - compiler-errors:no-take-opaques-in-compare, r=oli-obk

No need to take opaques in `check_type_bounds`

`InferCtxt` already has its defining use anchor set to err

r? ``@oli-obk``

17 months agoRollup merge of #106175 - compiler-errors:bad-import-sugg, r=oli-obk
Yuki Okushi [Mon, 9 Jan 2023 23:05:34 +0000 (08:05 +0900)]
Rollup merge of #106175 - compiler-errors:bad-import-sugg, r=oli-obk

Fix bad import suggestion with nested `use` tree

Fixes #105566
Fixes #105373

Ideally, we'd find some way to turn these into structured suggestions -- perhaps on a separate line as a different `use` statement, but I have no idea how to access the span for the whole `use` from this point in the import resolution code.

17 months agoRollup merge of #105708 - tomerze:enable-atomic-cas-bpf, r=nagisa
Yuki Okushi [Mon, 9 Jan 2023 23:05:33 +0000 (08:05 +0900)]
Rollup merge of #105708 - tomerze:enable-atomic-cas-bpf, r=nagisa

Enable atomic cas for bpf targets

It seems like LLVM now supports it.

https://reviews.llvm.org/D72184 - the PR in LLVM

17 months agoRollup merge of #105034 - HintringerFabian:improve_iterator_flatten_doc, r=cuviper
Yuki Okushi [Mon, 9 Jan 2023 23:05:32 +0000 (08:05 +0900)]
Rollup merge of #105034 - HintringerFabian:improve_iterator_flatten_doc, r=cuviper

Add example for iterator_flatten

Adds an Example to iterator_flatten
Fixes #82687

17 months agoFix help docs for -Zallow-features
Eric Huss [Mon, 9 Jan 2023 20:36:39 +0000 (12:36 -0800)]
Fix help docs for -Zallow-features

17 months agoCollect backtraces for delayed span-bugs too
Michael Goulet [Sat, 31 Dec 2022 01:56:59 +0000 (01:56 +0000)]
Collect backtraces for delayed span-bugs too

17 months agoAuto merge of #105855 - arcnmx:rust-analyzer-2022-12, r=lnicola
bors [Mon, 9 Jan 2023 21:14:32 +0000 (21:14 +0000)]
Auto merge of #105855 - arcnmx:rust-analyzer-2022-12, r=lnicola

:arrow_up: rust-analyzer

Updates rust-analyzer to https://github.com/rust-lang/rust-analyzer/commit/368e0bb32f1178cf162c2ce5f7e10b7ae211eb26

This is a continuation/replacement of #105834, close that if this is chosen instead.

17 months ago:arrow_up: rust-analyzer
arcnmx [Mon, 9 Jan 2023 18:36:22 +0000 (10:36 -0800)]
:arrow_up: rust-analyzer

Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'

17 months agoAdd issue number to FIXMEs
Tyler Mandry [Mon, 9 Jan 2023 18:23:50 +0000 (13:23 -0500)]
Add issue number to FIXMEs

17 months agoAuto merge of #106637 - fee1-dead-contrib:rollup-ticvmsd, r=fee1-dead
bors [Mon, 9 Jan 2023 18:20:00 +0000 (18:20 +0000)]
Auto merge of #106637 - fee1-dead-contrib:rollup-ticvmsd, r=fee1-dead

Rollup of 10 pull requests

Successful merges:

 - #105292 (Change a commit_if_ok call to probe)
 - #105655 (Remove invalid case for mutable borrow suggestion)
 - #106047 (Fix ui constant tests for big-endian platforms)
 - #106061 (Enable Shadow Call Stack for Fuchsia on AArch64)
 - #106164 (Move `check_region_obligations_and_report_errors` to `TypeErrCtxt`)
 - #106291 (Fix incorrect suggestion for extra `&` in pattern)
 - #106389 (Simplify some canonical type alias names)
 - #106468 (Use FxIndexSet when updating obligation causes in `adjust_fulfillment_errors_for_expr_obligation`)
 - #106549 (Use fmt named parameters in rustc_borrowck)
 - #106614 (error-code docs improvements (No. 2))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoAssert defining anchor is set in take_opaque_types
Michael Goulet [Mon, 9 Jan 2023 18:14:28 +0000 (18:14 +0000)]
Assert defining anchor is set in take_opaque_types

17 months agorustdoc: merge common CSS for `a`
Michael Howell [Mon, 9 Jan 2023 18:09:19 +0000 (11:09 -0700)]
rustdoc: merge common CSS for `a`

17 months agoreview comment
Michael Goulet [Mon, 9 Jan 2023 18:07:34 +0000 (18:07 +0000)]
review comment

17 months agohack: don't normalize xform_ret_ty for trait/object candidates unless needed
Michael Goulet [Mon, 9 Jan 2023 06:53:11 +0000 (06:53 +0000)]
hack: don't normalize xform_ret_ty for trait/object candidates unless needed

17 months agoAdd lookup_probe_for_diagnostic
Michael Goulet [Sun, 8 Jan 2023 22:54:05 +0000 (22:54 +0000)]
Add lookup_probe_for_diagnostic

17 months agoConsider method return type for various method suggestions
Michael Goulet [Sun, 8 Jan 2023 22:31:47 +0000 (22:31 +0000)]
Consider method return type for various method suggestions

17 months agoNo need to take opaques in check_type_bounds
Michael Goulet [Sat, 24 Dec 2022 21:30:15 +0000 (21:30 +0000)]
No need to take opaques in check_type_bounds

17 months agoUnconditionally normalize xform_ret_ty in probe
Michael Goulet [Sun, 8 Jan 2023 22:15:22 +0000 (22:15 +0000)]
Unconditionally normalize xform_ret_ty in probe

17 months agoCheck impl's where clauses in consider_impl_candidate in experimental solver
Michael Goulet [Tue, 3 Jan 2023 03:43:11 +0000 (03:43 +0000)]
Check impl's where clauses in consider_impl_candidate in experimental solver

17 months agoAccept old spelling of Fuchsia target triples
David Koloski [Mon, 9 Jan 2023 15:22:08 +0000 (10:22 -0500)]
Accept old spelling of Fuchsia target triples

Because the old spelling is widely used, some projects may need time to
migrate their uses to the new triple spelling. The old spelling may
eventually be removed altogether.

17 months agoAuto merge of #13848 - ian-h-chamberlain:feature/color-compiler-diagnostics, r=ian...
bors [Mon, 9 Jan 2023 17:07:35 +0000 (17:07 +0000)]
Auto merge of #13848 - ian-h-chamberlain:feature/color-compiler-diagnostics, r=ian-h-chamberlain

Colorize `cargo check` diagnostics in VSCode via text decorations

Fixes #13648

![colored-rustc-diagnostics](https://user-images.githubusercontent.com/11131775/209479884-10eef8ca-37b4-4aae-88f7-3591ac01b25e.gif)

Use ANSI control characters to display text decorations matching the VScode terminal theme, and strip them out when providing text content for rustc diagnostics.

This adds the small [`anser`](https://www.npmjs.com/package/anser) library (MIT license, no dependencies) to parse the control codes, and it also supports HTML output so it should be fairly easy to switch to a rendered HTML/webview implementation in the future

I also updated the default `cargo check` command to use the rendered ANSI diagnostics, although I'm not sure if it makes sense to put this kind of thing behind a feature flag, or whether it might have any issues on Windows (as I believe ANSI codes are not used for colorization there)?

17 months agoAdd docs for `colorDiagnosticOutput` capability
Ian Chamberlain [Mon, 9 Jan 2023 16:44:38 +0000 (11:44 -0500)]
Add docs for `colorDiagnosticOutput` capability

17 months agoUse experimental capability to enable color codes
Ian Chamberlain [Wed, 4 Jan 2023 17:04:45 +0000 (12:04 -0500)]
Use experimental capability to enable color codes

17 months agoStrip colors before matching preview diagnostics
Ian Chamberlain [Tue, 3 Jan 2023 15:49:47 +0000 (10:49 -0500)]
Strip colors before matching preview diagnostics

17 months agoUpdate docs to include note about ANSI diagnostics
Ian Chamberlain [Sun, 25 Dec 2022 18:52:42 +0000 (13:52 -0500)]
Update docs to include note about ANSI diagnostics

17 months agoDefault to use colored ANSI diagnostics
Ian Chamberlain [Wed, 28 Dec 2022 14:41:24 +0000 (09:41 -0500)]
Default to use colored ANSI diagnostics

17 months agoParse + decorate rendered ANSI cargo output
Ian Chamberlain [Tue, 3 Jan 2023 15:16:16 +0000 (10:16 -0500)]
Parse + decorate rendered ANSI cargo output

Use ANSI control characters to display text decorations matching the
VScode terminal theme, and strip them out when providing text content
for rustc diagnostics.

This adds the small `anser` library to parse the control codes, and it
also supports HTML output so it should be fairly easy to switch to a
rendered HTML/webview implementation if desired.

17 months agoAdd test for issue 106062
Albert Larsan [Mon, 9 Jan 2023 16:33:09 +0000 (16:33 +0000)]
Add test for issue 106062

17 months agoupdate test for inductive canonical cycles
lcnr [Mon, 9 Jan 2023 16:13:14 +0000 (17:13 +0100)]
update test for inductive canonical cycles

17 months agoAuto merge of #13915 - Veykril:lsp-server-msg, r=Veykril
bors [Mon, 9 Jan 2023 16:04:04 +0000 (16:04 +0000)]
Auto merge of #13915 - Veykril:lsp-server-msg, r=Veykril

Make it clearer when the server expects an initialized notification

17 months agoMake it clearer when the server expects an initialized notification
Lukas Wirth [Mon, 9 Jan 2023 16:03:36 +0000 (17:03 +0100)]
Make it clearer when the server expects an initialized notification

17 months agoAuto merge of #2755 - RalfJung:dtors_in_dtors_in_dtors, r=RalfJung
bors [Mon, 9 Jan 2023 15:36:18 +0000 (15:36 +0000)]
Auto merge of #2755 - RalfJung:dtors_in_dtors_in_dtors, r=RalfJung

add dtors_in_dtors_in_dtors

That's a pretty neat test from the standard library. Sadly not enough to check for https://github.com/rust-lang/miri/issues/2754, but still worth having here.

17 months agoAuto merge of #13799 - Veykril:flycheck, r=Veykril
bors [Mon, 9 Jan 2023 15:35:38 +0000 (15:35 +0000)]
Auto merge of #13799 - Veykril:flycheck, r=Veykril

Rename `checkOnSave` settings to `check`

Now that flychecks can be triggered without saving the setting name doesn't make that much sense anymore. This PR renames it to just `check`, but keeps `checkOnSave` as the enabling setting.

17 months agoRollup merge of #106614 - Ezrashaw:ui-test-fixups-2, r=GuillaumeGomez
fee1-dead [Mon, 9 Jan 2023 15:35:32 +0000 (23:35 +0800)]
Rollup merge of #106614 - Ezrashaw:ui-test-fixups-2, r=GuillaumeGomez

error-code docs improvements (No. 2)

- Added empty error-code docs for `E0208`, `E0640` and `E0717` with the "internal" header as discussed on Discord.
- Wrote docs and UI test for `E0711`, again with the header.
- `tidy` changes are common-sense and make everything pass, `style.rs` hack is annoying though.

r? ```@GuillaumeGomez```

17 months agoRollup merge of #106549 - wcampbell0x2a:use-fmt-named-parameters-borrowck, r=estebank
fee1-dead [Mon, 9 Jan 2023 15:35:31 +0000 (23:35 +0800)]
Rollup merge of #106549 - wcampbell0x2a:use-fmt-named-parameters-borrowck, r=estebank

Use fmt named parameters in rustc_borrowck

17 months agoRollup merge of #106468 - compiler-errors:err-instability, r=lcnr
fee1-dead [Mon, 9 Jan 2023 15:35:31 +0000 (23:35 +0800)]
Rollup merge of #106468 - compiler-errors:err-instability, r=lcnr

Use FxIndexSet when updating obligation causes in `adjust_fulfillment_errors_for_expr_obligation`

I have no idea how to test this reliably, but I've **manually** verified it fixes the instability in #106417 that isn't due to dtolnay/trybuild#212.

Fixes #106417

17 months agoRollup merge of #106389 - compiler-errors:no-canonicalized, r=lcnr
fee1-dead [Mon, 9 Jan 2023 15:35:30 +0000 (23:35 +0800)]
Rollup merge of #106389 - compiler-errors:no-canonicalized, r=lcnr

Simplify some canonical type alias names

* delete the `Canonicalized<'tcx>` type alias in favor for `Canonical<'tcx>`
* `CanonicalizedQueryResponse` -> `CanonicalQueryResponse`

I don't particularly care about the latter, but it should be consistent. We could alternatively delete the first alias and rename the struct to `Canonicalized`, and then keep the name of `CanonicalizedQueryResponse` untouched.

17 months agoRollup merge of #106291 - obeis:issue-106182, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:29 +0000 (23:35 +0800)]
Rollup merge of #106291 - obeis:issue-106182, r=oli-obk

Fix incorrect suggestion for extra `&` in pattern

Closes #106182

17 months agoRollup merge of #106164 - compiler-errors:check-region-tweak, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:29 +0000 (23:35 +0800)]
Rollup merge of #106164 - compiler-errors:check-region-tweak, r=oli-obk

Move `check_region_obligations_and_report_errors` to `TypeErrCtxt`

Makes sense for this function to live with its sibling `resolve_regions_and_report_errors`, around which it's basically just a wrapper.

17 months agoRollup merge of #106061 - ilovepi:fuchsia-scs, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:28 +0000 (23:35 +0800)]
Rollup merge of #106061 - ilovepi:fuchsia-scs, r=oli-obk

Enable Shadow Call Stack for Fuchsia on AArch64

Fuchsia already uses SCS by default for C/C++ code on ARM hardware. This patch allows SCS to be used for Rust code as well.

17 months agoRollup merge of #106047 - uweigand:s390x-test-bigendian-ui, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:27 +0000 (23:35 +0800)]
Rollup merge of #106047 - uweigand:s390x-test-bigendian-ui, r=oli-obk

Fix ui constant tests for big-endian platforms

A number of tests under ui/const-ptr and ui/consts are currently failing on big-endian platforms as the binary encoding of some constants is hard-coded in the stderr test files.

Fix this by a combination of two types of changes:

- Where possible (i.e. where the particular value of a constant does not affect the purpose of the test), choose constant values that have the same encoding on big- and little-endian platforms.

- Where this is not possible, provide a normalize-stderr-test rule that transforms the printed big-endian encoding of such constants into the corresponding little-endian form.

Fixes part of https://github.com/rust-lang/rust/issues/105383.

17 months agoRollup merge of #105655 - RedDocMD:bug-105645, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:27 +0000 (23:35 +0800)]
Rollup merge of #105655 - RedDocMD:bug-105645, r=oli-obk

Remove invalid case for mutable borrow suggestion

If we have a call such as `foo(&mut buf)` and after reference
collapsing the type is inferred as `&T` where-as the required type is
`&mut T`, don't suggest `foo(&mut mut buf)`. This is wrong syntactically
and the issue lies elsewhere, not in the borrow.

Fixes #105645

17 months agoRollup merge of #105292 - JulianKnodt:no_eager_commit, r=BoxyUwU
fee1-dead [Mon, 9 Jan 2023 15:35:26 +0000 (23:35 +0800)]
Rollup merge of #105292 - JulianKnodt:no_eager_commit, r=BoxyUwU

Change a commit_if_ok call to probe

Removes an over-eager `commit_if_ok` which makes inference worse.

I'm not entirely sure whether it's ok to remove the check that types are the same, because casting seems to cause equality checks with incorrect types?

Fixes #105037

r? ```@BoxyUwU```

17 months agoadd dtors_in_dtors_in_dtors
Ralf Jung [Mon, 9 Jan 2023 15:35:16 +0000 (16:35 +0100)]
add dtors_in_dtors_in_dtors

17 months agoAuto merge of #101947 - aliemjay:astconv-normalize, r=lcnr
bors [Mon, 9 Jan 2023 15:29:59 +0000 (15:29 +0000)]
Auto merge of #101947 - aliemjay:astconv-normalize, r=lcnr

Don't normalize in AstConv

See individual commits.

Fixes #101350
Fixes #54940

17 months agoAuto merge of #13914 - WaffleLapkin:qualify_method_call_rewrite, r=lnicola
bors [Mon, 9 Jan 2023 15:22:51 +0000 (15:22 +0000)]
Auto merge of #13914 - WaffleLapkin:qualify_method_call_rewrite, r=lnicola

minor: Make `qualify_method_call` `RefactorRewrite`

See https://github.com/rust-lang/rust-analyzer/pull/13825#issuecomment-1363289767

17 months agostd test: better type name, clarifying comment
Ralf Jung [Mon, 9 Jan 2023 15:08:26 +0000 (16:08 +0100)]
std test: better type name, clarifying comment

17 months agoAuto merge of #13890 - lowr:fix/unescape-inline-mod-name, r=Veykril
bors [Mon, 9 Jan 2023 15:07:06 +0000 (15:07 +0000)]
Auto merge of #13890 - lowr:fix/unescape-inline-mod-name, r=Veykril

fix: unescape inline module names in module resolution

Fixes #13884

17 months agoAuto merge of #13863 - danieleades:approx-constant, r=Veykril
bors [Mon, 9 Jan 2023 14:53:46 +0000 (14:53 +0000)]
Auto merge of #13863 - danieleades:approx-constant, r=Veykril

minor: suppress 'clippy::approx_constant' lint in test case

suppresses a false positive clippy lint

17 months agoAuto merge of #13825 - WaffleLapkin:ufcs_to_method_call_and_back, r=Veykril
bors [Mon, 9 Jan 2023 14:37:40 +0000 (14:37 +0000)]
Auto merge of #13825 - WaffleLapkin:ufcs_to_method_call_and_back, r=Veykril

feat: Add `unqualify_method_call` assist

...which is the inverse of `qualify_method_call` assist.

![Peek 2022-12-22 22-47](https://user-images.githubusercontent.com/38225716/209206554-8f067206-6fa6-48f8-849e-f6d36ee2e5a1.gif)

Optional future work:
- import the trait if needed
- remove excess references when auto-ref is possible

17 months agoMake `qualify_method_call` `RefactorRewrite`
Maybe Waffle [Mon, 9 Jan 2023 14:26:48 +0000 (14:26 +0000)]
Make `qualify_method_call` `RefactorRewrite`

17 months agoAuto merge of #13810 - tfpk:tfpk/macro-inline, r=Veykril
bors [Mon, 9 Jan 2023 14:24:41 +0000 (14:24 +0000)]
Auto merge of #13810 - tfpk:tfpk/macro-inline, r=Veykril

Add action to expand a declarative macro once, inline. Fixes #13598

This commit adds a new r-a method, `expandMacroInline`, which expands the macro that's currently selected. See  #13598 for the most applicable issue; though I suspect it'll resolve part of #5949 and make #11888 significantly easier).

The macro works like this:

![rust-analyser-feature](https://user-images.githubusercontent.com/10906982/208813167-3123e379-8fd5-4206-a4f4-5af1129565f9.gif)

I have 2 questions before this PR can be merged:

1. **Should we rustfmt the output?** The advantage of doing this is neater code. The disadvantages are we'd have to format the whole expr/stmt/block (since there's no point just formatting one part, especially over multiple lines), and maybe it moves the code around more in weird ways. My suggestion here is to start off by not doing any formatting; and if it appears useful we can decide to do formatting in a later release.
2.   **Is it worth solving the `$crate` hygiene issue now?** -- I think this PR is usable as of right now for some use-cases; but it is annoying that many common macros (i.e. `println!()`, `format!()`) can't be expanded further unless the user guesses the correct `$crate` value. The trouble with solving that issue is that I think it's complicated and imperfect. If we do solve it; we'd also need to either change the existing `expandMacro`/`expandMacroInline` commands; provide some option to allow/disallow `$crate` expanding; or come to some other compromise.

17 months agoRename assist: `convert_ufcs_to_method` => `unqualify_method_call`
Maybe Waffle [Mon, 9 Jan 2023 13:59:02 +0000 (13:59 +0000)]
Rename assist: `convert_ufcs_to_method` => `unqualify_method_call`