]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #89030 - nbdd0121:box2, r=jonas-schievink
bors [Sat, 25 Sep 2021 11:01:13 +0000 (11:01 +0000)]
Auto merge of #89030 - nbdd0121:box2, r=jonas-schievink

Introduce `Rvalue::ShallowInitBox`

Polished version of #88700.

Implements MCP rust-lang/compiler-team#460, and should allow #43596 to go forward.

In short, creating an empty box is split from a nullary-op `NullOp::Box` into two steps, first a call to `exchange_malloc`, then a `Rvalue::ShallowInitBox` which transmutes `*mut u8` to a shallow-initialized `Box<T>`. This allows the `exchange_malloc` call to unwind. Details can be found in the MCP.

`NullOp::Box` is not yet removed, purely to make reverting easier in case anything goes wrong as the result of this PR. If revert is needed a reversion of "Use Rvalue::ShallowInitBox for box expression" commit followed by a test bless should be sufficient.

Experiments in #88700 showed a very slight compile-time perf regression due to (supposedly) slightly more time spent in LLVM. We could omit unwind edge generation (in non-`oom=panic` case) in box expression MIR construction to restore perf; but I don't think it's necessary since runtime perf isn't affected and perf difference is rather small.

2 years agoAuto merge of #89237 - BoxyUwU:trackersMcCaller, r=eddyb
bors [Sat, 25 Sep 2021 07:33:25 +0000 (07:33 +0000)]
Auto merge of #89237 - BoxyUwU:trackersMcCaller, r=eddyb

make `#[track_caller]` actually do stuff in `Steal::borrow`

makes this ICE message useful:
``thread 'rustc' panicked at 'attempted to read from stolen value', /rustc/ac2d9fc509e36d1b32513744adf58c34bcc4f43c\compiler\rustc_data_structures\src\steal.rs:37:21``

2 years agoAuto merge of #87220 - petrochenkov:derivecfglimit2, r=Aaron1011
bors [Sat, 25 Sep 2021 04:35:59 +0000 (04:35 +0000)]
Auto merge of #87220 - petrochenkov:derivecfglimit2, r=Aaron1011

Make `#[derive(A, B, ...)]` cfg-eval its input only for `A, B, ...` and stabilize `feature(macro_attributes_in_derive_output)`

Stabilization report: https://github.com/rust-lang/rust/pull/87220#issuecomment-881923657

Closes #81119
r? `@Aaron1011`

2 years agoAuto merge of #89230 - workingjubilee:rollup-1swktdq, r=workingjubilee
bors [Sat, 25 Sep 2021 00:20:28 +0000 (00:20 +0000)]
Auto merge of #89230 - workingjubilee:rollup-1swktdq, r=workingjubilee

Rollup of 8 pull requests

Successful merges:

 - #88893 (Add 1.56.0 release notes)
 - #89001 (Be explicit about using Binder::dummy)
 - #89072 (Avoid a couple of Symbol::as_str calls in cg_llvm )
 - #89104 (Simplify scoped_thread)
 - #89208 ([rfc 2229] Drop fully captured upvars in the same order as the regular drop code)
 - #89210 (Add missing time complexities to linked_list.rs)
 - #89217 (Enable "generate-link-to-definition" option on rust tools docs as well)
 - #89221 (Give better error for `macro_rules! name!`)

Failed merges:

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

2 years agoBless tests
Gary Guo [Thu, 16 Sep 2021 22:04:02 +0000 (23:04 +0100)]
Bless tests

2 years agoReport heap allocation instead of non-const fn for exchange_malloc call
Gary Guo [Thu, 16 Sep 2021 21:49:34 +0000 (22:49 +0100)]
Report heap allocation instead of non-const fn for exchange_malloc call

2 years agoUse Rvalue::ShallowInitBox for box expression
Gary Guo [Sat, 11 Sep 2021 22:24:55 +0000 (23:24 +0100)]
Use Rvalue::ShallowInitBox for box expression

2 years agoIntroduce `Rvalue::ShallowInitBox`
Gary Guo [Mon, 6 Sep 2021 17:33:23 +0000 (18:33 +0100)]
Introduce `Rvalue::ShallowInitBox`

2 years agoarrr caught ya caller
Ellen [Fri, 24 Sep 2021 23:34:02 +0000 (00:34 +0100)]
arrr caught ya caller

awd

2 years agoAuto merge of #86246 - FabianWolff:issue-83471, r=estebank
bors [Fri, 24 Sep 2021 21:30:35 +0000 (21:30 +0000)]
Auto merge of #86246 - FabianWolff:issue-83471, r=estebank

Add basic checks for well-formedness of `fn`/`fn_mut` lang items

This pull request fixes #83471. Lang items are never actually checked for well-formedness (#9307). This means that one can get an ICE quite easily, e.g. as follows:
```rust
#![feature(lang_items)]
#[lang = "fn"]
trait MyFn {
    const call: i32 = 42;
}

fn main() {
    (|| 42)();
}
```
or this:
```rust
#![feature(lang_items)]
#[lang = "fn"]
trait MyFn {
    fn call(i: i32, j: i32);
}

fn main() {
    (|| 42)();
}
```
Ideally, there should probably be a more comprehensive strategy for checking lang items for well-formedness, but for the time being, I have added some rudimentary well-formedness checks that prevent #83471 and similar issues.

2 years agoStabilize `feature(macro_attributes_in_derive_output)`
Vadim Petrochenkov [Sat, 17 Jul 2021 14:50:33 +0000 (17:50 +0300)]
Stabilize `feature(macro_attributes_in_derive_output)`

2 years agoderive: Do not configure or clone items unless necessary
Vadim Petrochenkov [Sat, 17 Jul 2021 14:28:43 +0000 (17:28 +0300)]
derive: Do not configure or clone items unless necessary

2 years agobuiltin_macros: Make #[derive(A, B, ...)] cfg-eval its input only for `A, B, ...`
Vadim Petrochenkov [Sat, 17 Jul 2021 14:10:03 +0000 (17:10 +0300)]
builtin_macros: Make #[derive(A, B, ...)] cfg-eval its input only for `A, B, ...`

2 years agoRollup merge of #89221 - aDotInTheVoid:macro-error-1, r=estebank
Jubilee [Fri, 24 Sep 2021 18:40:17 +0000 (11:40 -0700)]
Rollup merge of #89221 - aDotInTheVoid:macro-error-1, r=estebank

Give better error for `macro_rules! name!`

r? ``@estebank``

``@rustbot`` modify labels: +A-diagnostics +A-parser

2 years agoRollup merge of #89217 - GuillaumeGomez:generate-link-to-def-rust-tools, r=jyn514
Jubilee [Fri, 24 Sep 2021 18:40:16 +0000 (11:40 -0700)]
Rollup merge of #89217 - GuillaumeGomez:generate-link-to-def-rust-tools, r=jyn514

Enable "generate-link-to-definition" option on rust tools docs as well

Just realized that we enable the option for the compiler crates, but we don't have it for rustdoc and the other tools documentation...

Part of https://github.com/rust-lang/rust/issues/89095.

cc ``@rust-lang/rustdoc``
r? ``@Mark-Simulacrum``

2 years agoRollup merge of #89210 - Takashiidobe:master, r=kennytm
Jubilee [Fri, 24 Sep 2021 18:40:15 +0000 (11:40 -0700)]
Rollup merge of #89210 - Takashiidobe:master, r=kennytm

Add missing time complexities to linked_list.rs

Most functions in LinkedList have time complexities in their description:
Like push front:

```
Adds an element first in the list.

This operation should compute in O(1) time.
```

Time complexities were missing for the following, so I've added them in this PR:

contains: O(n)
front: O(1)
front_mut: O(1)
back: O(1)
back_mut: O(1)

2 years agoRollup merge of #89208 - wesleywiser:rfc_2229_droporder, r=nikomatsakis
Jubilee [Fri, 24 Sep 2021 18:40:14 +0000 (11:40 -0700)]
Rollup merge of #89208 - wesleywiser:rfc_2229_droporder, r=nikomatsakis

[rfc 2229] Drop fully captured upvars in the same order as the regular drop code

Currently, with the new 2021 edition, if a closure captures all of the
fields of an upvar, we'll drop those fields in the order they are used
within the closure instead of the normal drop order (the definition
order of the fields in the type).

This changes that so we sort the captured fields by the definition order
which causes them to drop in that same order as well.

Fixes rust-lang/project-rfc-2229#42

r? `@nikomatsakis`

2 years agoRollup merge of #89104 - Mark-Simulacrum:spawn-unchecked, r=nagisa,bjorn3
Jubilee [Fri, 24 Sep 2021 18:40:13 +0000 (11:40 -0700)]
Rollup merge of #89104 - Mark-Simulacrum:spawn-unchecked, r=nagisa,bjorn3

Simplify scoped_thread

Avoids a bunch of manual pointer manipulation in favor of using the appropriate std API.

2 years agoRollup merge of #89072 - bjorn3:less_symbol_as_str, r=michaelwoerister
Jubilee [Fri, 24 Sep 2021 18:40:12 +0000 (11:40 -0700)]
Rollup merge of #89072 - bjorn3:less_symbol_as_str, r=michaelwoerister

Avoid a couple of Symbol::as_str calls in cg_llvm

This should improve performance a tiny bit. Also remove `Symbol::len` and make `SymbolIndex` private.

2 years agoRollup merge of #89001 - jackh726:binder-cleanup, r=nikomatsakis
Jubilee [Fri, 24 Sep 2021 18:40:11 +0000 (11:40 -0700)]
Rollup merge of #89001 - jackh726:binder-cleanup, r=nikomatsakis

Be explicit about using Binder::dummy

This is somewhat of a late followup to the binder refactor PR. It removes `ToPredicate` and `ToPolyTraitImpls` that hide the use of `Binder::dummy`. While this does make code a bit more verbose, it allows us be more careful about where we create binders.

Another alternative here might be to add a new trait `ToBinder` or something with a `dummy()` fn. Which could still allow grepping but allows doing something like `trait_ref.dummy()` (but I also wonder if longer-term, it would be better to be even more explicit with a `bind_with_vars(ty::List::empty())` *but* that's not clear yet.

r? ``@nikomatsakis``

2 years agoRollup merge of #88893 - Mark-Simulacrum:relnotes, r=pietroalbini
Jubilee [Fri, 24 Sep 2021 18:40:11 +0000 (11:40 -0700)]
Rollup merge of #88893 - Mark-Simulacrum:relnotes, r=pietroalbini

Add 1.56.0 release notes

Notable things:

* Rustdoc section currently absent, for lack of things to call out that I could find. It seems like https://github.com/rust-lang/rust/pull/87451 is the only potential candidate, but that seems like more of a bugfix and doesn't seem to warrant inclusion to me. But we can add it if desired.

As with the 1.55.0 release notes, my intent is to leave this open for approximately 1-2 weeks at the early part of the cycle, and then merge it in (after fixing any feedback). Further iteration can happen in subsequent issues (and PRs).

[Rendered](https://github.com/Mark-Simulacrum/rust/blob/relnotes/RELEASES.md)

2 years agoMake error message for malformed `fn`/`fn_mut` lang item more specific
Fabian Wolff [Fri, 24 Sep 2021 16:55:14 +0000 (18:55 +0200)]
Make error message for malformed `fn`/`fn_mut` lang item more specific

2 years agoAuto merge of #88872 - petrochenkov:getmod2, r=cjgillot
bors [Fri, 24 Sep 2021 18:12:33 +0000 (18:12 +0000)]
Auto merge of #88872 - petrochenkov:getmod2, r=cjgillot

resolve: Some module-related refactorings

See the individual commits.

2 years agoDisable a spuriously failing test
Vadim Petrochenkov [Fri, 24 Sep 2021 17:28:47 +0000 (20:28 +0300)]
Disable a spuriously failing test

2 years agoUpdate and add more tests
Wesley Wiser [Fri, 24 Sep 2021 16:26:24 +0000 (12:26 -0400)]
Update and add more tests

2 years agoAdd basic checks for well-formedness of `fn`/`fn_mut` lang items
Fabian Wolff [Sat, 12 Jun 2021 10:48:04 +0000 (12:48 +0200)]
Add basic checks for well-formedness of `fn`/`fn_mut` lang items

2 years agoresolve: Refactor obtaining `Module` from its `DefId`
Vadim Petrochenkov [Sat, 11 Sep 2021 23:06:27 +0000 (02:06 +0300)]
resolve: Refactor obtaining `Module` from its `DefId`

The `Option<Module>` version is supported for the case where we don't know whether the `DefId` refers to a module or not.
Non-local traits and enums are also correctly found now.

2 years agoresolve: Use a single common map for local and foreign modules
Vadim Petrochenkov [Sat, 11 Sep 2021 22:59:05 +0000 (01:59 +0300)]
resolve: Use a single common map for local and foreign modules

2 years agoresolve: Rename some expansion def scope methods
Vadim Petrochenkov [Sat, 11 Sep 2021 22:47:46 +0000 (01:47 +0300)]
resolve: Rename some expansion def scope methods

2 years agoresolve: Cleanup module allocation
Vadim Petrochenkov [Sat, 11 Sep 2021 13:37:34 +0000 (16:37 +0300)]
resolve: Cleanup module allocation

Construction of all modules is now centralized and performed by `fn new_module`.

2 years agoresolve: Do not cache nearest parent mod in `ModuleData`
Vadim Petrochenkov [Mon, 13 Sep 2021 21:13:14 +0000 (00:13 +0300)]
resolve: Do not cache nearest parent mod in `ModuleData`

2 years agoAdd 1.56.0 release notes
Mark Rousskov [Sun, 12 Sep 2021 19:13:54 +0000 (15:13 -0400)]
Add 1.56.0 release notes

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2 years agoAuto merge of #88999 - Migi:master, r=oli-obk
bors [Fri, 24 Sep 2021 15:22:26 +0000 (15:22 +0000)]
Auto merge of #88999 - Migi:master, r=oli-obk

Make `Duration` respect `width` when formatting using `Debug`

When printing or writing a `std::time::Duration` using `Debug` formatting, it previously completely ignored any specified `width`. This is unlike types like integers and floats, which do pad to `width`, for both `Display` and `Debug`, though not all types consider `width` in their `Debug` output (see e.g. #30164). Curiously, `Duration`'s `Debug` formatting *did* consider `precision`.

This PR makes `Duration` pad to `width` just like integers and floats, so that
```rust
format!("|{:8?}|", Duration::from_millis(1234))
```
returns
```
|1.234s  |
```

Before you ask "who formats `Debug` output?", note that `Duration` doesn't actually implement `Display`, so `Debug` is currently the only way to format `Duration`s. I think that's wrong, and `Duration` should get a `Display` implementation, but in the meantime there's no harm in making the `Debug` formatting respect `width` rather than ignore it.

I chose the default alignment to be left-aligned. The general rule Rust uses is: numeric types are right-aligned by default, non-numeric types left-aligned. It wasn't clear to me whether `Duration` is a numeric type or not. The fact that a formatted `Duration` can end with suffixes of variable length (`"s"`, `"ms"`, `"µs"`, etc.) made me lean towards left-alignment, but it would be trivial to change it.

Fixes issue #88059.

2 years agoGive better error for `macro_rules! name!`
Nixon Enraght-Moony [Fri, 24 Sep 2021 12:31:01 +0000 (13:31 +0100)]
Give better error for `macro_rules! name!`

2 years agounitalicize O(1) complexities
Takashi Idobe [Fri, 24 Sep 2021 13:33:49 +0000 (08:33 -0500)]
unitalicize O(1) complexities

2 years agoMerge branch 'rust-lang:master' into master
Takashi Idobe [Fri, 24 Sep 2021 13:31:03 +0000 (08:31 -0500)]
Merge branch 'rust-lang:master' into master

2 years agoAuto merge of #88835 - FabianWolff:issue-88770, r=petrochenkov
bors [Fri, 24 Sep 2021 11:54:29 +0000 (11:54 +0000)]
Auto merge of #88835 - FabianWolff:issue-88770, r=petrochenkov

Fix error recovery in format macro parsing

Fixes #88770. Basically, the assumption in the following comment is incorrect:
https://github.com/rust-lang/rust/blob/b69fe57261086e70aea9d5b58819a1794bf7c121/compiler/rustc_builtin_macros/src/format.rs#L167-L172

This is only true in the first iteration of the loop, when [`p.clear_expected_tokens()`](https://github.com/rust-lang/rust/blob/b69fe57261086e70aea9d5b58819a1794bf7c121/compiler/rustc_builtin_macros/src/format.rs#L164) is called. In subsequent iterations, `p.expected_tokens` won't be empty, so `p.expect()` won't actually call `unexpected_try_recover()`:
https://github.com/rust-lang/rust/blob/b69fe57261086e70aea9d5b58819a1794bf7c121/compiler/rustc_parse/src/parser/mod.rs#L487-L498

Instead, it will call `expect_one_of()`, which _can_ recover and return `Ok()`. This PR handles this case to fix the ICE in #88770.

2 years agoEnable "generate-link-to-definition" option on rust tools docs as well
Guillaume Gomez [Fri, 24 Sep 2021 10:05:35 +0000 (12:05 +0200)]
Enable "generate-link-to-definition" option on rust tools docs as well

2 years agoAuto merge of #89130 - nikic:update-llvm-2, r=cuviper
bors [Fri, 24 Sep 2021 08:12:15 +0000 (08:12 +0000)]
Auto merge of #89130 - nikic:update-llvm-2, r=cuviper

Update LLVM submodule

This merges the upstream `release/13.x` branch to pull in the second fix for #88769.

2 years agoAuto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebank
bors [Fri, 24 Sep 2021 05:29:49 +0000 (05:29 +0000)]
Auto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebank

Disable visible path calculation for PrettyPrinter in Ok path of compiler

2 years agoFix tidy and respond to some feedback
Wesley Wiser [Fri, 24 Sep 2021 02:15:12 +0000 (22:15 -0400)]
Fix tidy and respond to some feedback

2 years agoAuto merge of #89211 - workingjubilee:rollup-fj4eduk, r=workingjubilee
bors [Fri, 24 Sep 2021 01:48:02 +0000 (01:48 +0000)]
Auto merge of #89211 - workingjubilee:rollup-fj4eduk, r=workingjubilee

Rollup of 7 pull requests

Successful merges:

 - #88612 (Add a better error message for #39364)
 - #89023 (Resolve issue : Somewhat confusing error with extended_key_value_attributes)
 - #89148 (Suggest `_` in turbofish if param will be inferred from fn argument)
 - #89171 (Run `no_core` rustdoc tests only on Linux)
 - #89176 (Change singular to plural)
 - #89184 (Temporarily rename int_roundings functions to avoid conflicts)
 - #89200 (Fix typo)

Failed merges:

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

2 years agoRollup merge of #89200 - hkmatsumoto:patch, r=workingjubilee
Jubilee [Fri, 24 Sep 2021 00:31:47 +0000 (17:31 -0700)]
Rollup merge of #89200 - hkmatsumoto:patch, r=workingjubilee

Fix typo

2 years agoRollup merge of #89184 - joshtriplett:master, r=estebank
Jubilee [Fri, 24 Sep 2021 00:31:46 +0000 (17:31 -0700)]
Rollup merge of #89184 - joshtriplett:master, r=estebank

Temporarily rename int_roundings functions to avoid conflicts

These functions are unstable, but because they're inherent they still
introduce conflicts with stable trait functions in crates. Temporarily
rename them to fix these conflicts, until we can resolve those conflicts
in a better way.

2 years agoRollup merge of #89176 - TaKO8Ki:change-singular-to-plural, r=lcnr
Jubilee [Fri, 24 Sep 2021 00:31:45 +0000 (17:31 -0700)]
Rollup merge of #89176 - TaKO8Ki:change-singular-to-plural, r=lcnr

Change singular to plural

2 years agoRollup merge of #89171 - rusticstuff:aarch64_macos_rustdoc_ci_fixes, r=jyn514
Jubilee [Fri, 24 Sep 2021 00:31:44 +0000 (17:31 -0700)]
Rollup merge of #89171 - rusticstuff:aarch64_macos_rustdoc_ci_fixes, r=jyn514

Run `no_core` rustdoc tests only on Linux

I don't think this is really worth investigating further so I just disabled them.

They currently fail like this:
```
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-Wl,-exported_symbols_list,/var/folders/pg/gjhzdz7n361f0pv665d0723w0000gn/T/rustcPUsMpx/list" "-arch" "arm64" "/Users/hans/dev/rust/build/aarch64-apple-darwin/test/rustdoc/intra-doc/prim-methods-external-core/auxiliary/my-core.my_core.9f3c60de-cgu.0.rcgu.o" "/Users/hans/dev/rust/build/aarch64-apple-darwin/test/rustdoc/intra-doc/prim-methods-external-core/auxiliary/my-core.50fu2g9urkmisdsg.rcgu.o" "-L" "/Users/hans/dev/rust/build/aarch64-apple-darwin/native/rust-test-helpers" "-L" "/Users/hans/dev/rust/build/aarch64-apple-darwin/test/rustdoc/intra-doc/prim-methods-external-core/auxiliary" "-L" "/Users/hans/dev/rust/build/aarch64-apple-darwin/stage1/lib/rustlib/aarch64-apple-darwin/lib" "-L" "/Users/hans/dev/rust/build/aarch64-apple-darwin/stage1/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/hans/dev/rust/build/aarch64-apple-darwin/test/rustdoc/intra-doc/prim-methods-external-core/auxiliary/libmy_core.dylib" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-Wl,-install_name" "-Wl,``@rpath/libmy_core.dylib"`` "-nodefaultlibs"
  = note: ld: dynamic main executables must link with libSystem.dylib for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

r? ``@jyn514``

2 years agoRollup merge of #89148 - estebank:used-type-param, r=oli-obk
Jubilee [Fri, 24 Sep 2021 00:31:43 +0000 (17:31 -0700)]
Rollup merge of #89148 - estebank:used-type-param, r=oli-obk

Suggest `_` in turbofish if param will be inferred from fn argument

2 years agoRollup merge of #89023 - Wardenfar:issue-85066, r=nagisa
Jubilee [Fri, 24 Sep 2021 00:31:42 +0000 (17:31 -0700)]
Rollup merge of #89023 - Wardenfar:issue-85066, r=nagisa

Resolve issue : Somewhat confusing error with extended_key_value_attributes

Fixes #85066

2 years agoRollup merge of #88612 - lovasoa:patch-1, r=m-ou-se
Jubilee [Fri, 24 Sep 2021 00:31:41 +0000 (17:31 -0700)]
Rollup merge of #88612 - lovasoa:patch-1, r=m-ou-se

Add a better error message for #39364

There is a known bug in the implementation of mpsc channels in rust.
This adds a clearer error message when the bug occurs, so that developers don't lose too much time looking for the origin of the bug.
See https://github.com/rust-lang/rust/issues/39364

2 years agoremove trailing whitespace
Takashi Idobe [Thu, 23 Sep 2021 23:20:46 +0000 (18:20 -0500)]
remove trailing whitespace

2 years agoAdd time complexities to linked_list.rs
Takashi Idobe [Thu, 23 Sep 2021 22:58:02 +0000 (17:58 -0500)]
Add time complexities to linked_list.rs

2 years agoAuto merge of #88804 - Mark-Simulacrum:never-algo-v2, r=nikomatsakis,jackh726
bors [Thu, 23 Sep 2021 22:45:22 +0000 (22:45 +0000)]
Auto merge of #88804 - Mark-Simulacrum:never-algo-v2, r=nikomatsakis,jackh726

Revise never type fallback algorithm

This is a rebase of https://github.com/rust-lang/rust/pull/84573, but dropping the stabilization of never type (and the accompanying large test diff).

Each commit builds & has tests updated alongside it, and could be reviewed in a more or less standalone fashion. But it may make more sense to review the PR as a whole, I'm not sure. It should be noted that tests being updated isn't really a good indicator of final behavior -- never_type_fallback is not enabled by default in this PR, so we can't really see the full effects of the commits here.

This combines the work by Niko, which is [documented in this gist](https://gist.github.com/nikomatsakis/7a07b265dc12f5c3b3bd0422018fa660), with some additional rules largely derived to target specific known patterns that regress with the algorithm solely derived by Niko. We build these from an intuition that:

* In general, fallback to `()` is *sound* in all cases
* But, in general, we *prefer* fallback to `!` as it accepts more code, particularly that written to intentionally use `!` (e.g., Result's with a Infallible/! variant).

When evaluating Niko's proposed algorithm, we find that there are certain cases where fallback to `!` leads to compilation failures in real-world code, and fallback to `()` fixes those errors. In order to allow for stabilization, we need to fix a good portion of these patterns.

The final rule set this PR proposes is that, by default, we fallback from `?T` to `!`, with the following exceptions:

1. `?T: Foo` and `Bar::Baz = ?T` and `(): Foo`, then fallback to `()`
2. Per [Niko's algorithm](https://gist.github.com/nikomatsakis/7a07b265dc12f5c3b3bd0422018fa660#proposal-fallback-chooses-between--and--based-on-the-coercion-graph), the "live" `?T` also fallback to `()`.

The first rule is necessary to address a fairly common pattern which boils down to something like the snippet below. Without rule 1, we do not see the closure's return type as needing a () fallback, which leads to compilation failure.

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

trait Bar { }
impl Bar for () {  }
impl Bar for u32 {  }

fn foo<R: Bar>(_: impl Fn() -> R) {}

fn main() {
    foo(|| panic!());
}
```

r? `@jackh726`

2 years agoDrop fully captured upvars in the same order as the regular drop code
Wesley Wiser [Thu, 23 Sep 2021 20:36:49 +0000 (16:36 -0400)]
Drop fully captured upvars in the same order as the regular drop code

Currently, with the new 2021 edition, if a closure captures all of the
fields of an upvar, we'll drop those fields in the order they are used
within the closure instead of the normal drop order (the definition
order of the fields in the type).

This changes that so we sort the captured fields by the definition order
which causes them to drop in that same order as well.

Fixes https://github.com/rust-lang/project-rfc-2229/issues/42

2 years agoAdd tests to verify the drop order of fields in fully captured upvars
Wesley Wiser [Thu, 23 Sep 2021 19:15:51 +0000 (15:15 -0400)]
Add tests to verify the drop order of fields in fully captured upvars

2 years agoAuto merge of #89024 - oli-obk:lazy_tait_is_not_limited_to_being_used_in_return_posit...
bors [Thu, 23 Sep 2021 19:38:30 +0000 (19:38 +0000)]
Auto merge of #89024 - oli-obk:lazy_tait_is_not_limited_to_being_used_in_return_position, r=nikomatsakis

Lazy TAIT preparation cleanups

Check that TAIT generics are fully generic in mir typeck instead of wf-check, as wf-check can by definition only check TAIT in return position and not account for TAITs defined in the body of the function

r? `@spastorino` `@nikomatsakis`

2 years agoSimplify scoped_thread
Mark Rousskov [Sun, 19 Sep 2021 18:02:38 +0000 (14:02 -0400)]
Simplify scoped_thread

Avoids a bunch of manual pointer manipulation.

2 years agoAuto merge of #89016 - lcnr:non_blanket_impls, r=nikomatsakis,michaelwoerister
bors [Thu, 23 Sep 2021 15:44:53 +0000 (15:44 +0000)]
Auto merge of #89016 - lcnr:non_blanket_impls, r=nikomatsakis,michaelwoerister

fix non_blanket_impls iteration order

We sometimes iterate over all `non_blanket_impls`, not sure if this is observable outside
of error messages (i.e. as incremental bugs). This should fix the underlying issue of #86986.

second attempt of #88718

r? `@nikomatsakis`

2 years agoSuggest `_` in turbofish if param will be inferred from fn argument
Esteban Kuber [Tue, 21 Sep 2021 13:18:26 +0000 (13:18 +0000)]
Suggest `_` in turbofish if param will be inferred from fn argument

2 years agoCheck that TAIT generics are fully generic in mir typeck instead of wf-check, as...
Oli Scherer [Thu, 16 Sep 2021 19:08:25 +0000 (19:08 +0000)]
Check that TAIT generics are fully generic in mir typeck instead of wf-check, as wf-check can by definition only check TAIT in return position and not account for TAITs defined in the body of the function

2 years agoAuto merge of #87064 - Aaron1011:new-closure-track-caller, r=estebank
bors [Thu, 23 Sep 2021 12:26:51 +0000 (12:26 +0000)]
Auto merge of #87064 - Aaron1011:new-closure-track-caller, r=estebank

Support `#[track_caller]` on closures and generators

## Lang team summary

This PR adds support for placing the `#[track_caller]` attribute on closure and generator expressions. This attribute's addition behaves identically (from a users perspective) to the attribute being placed on the method in impl Fn/FnOnce/FnMut for ... generated by compiler.

The attribute is currently "double" feature gated -- both `stmt_expr_attributes` (preexisting) and `closure_track_caller` (newly added) must be enabled in order to place these attributes on closures.

As the Fn* traits lack a `#[track_caller]` attribute in their definition, caller information does not propagate when invoking closures through dyn Fn*. There is no limitation that this PR adds in supporting this; it can be added in the future.

# Implementation details

This is implemented in the same way as for functions - an extra
location argument is appended to the end of the ABI. For closures,
this argument is *not* part of the 'tupled' argument storing the
parameters - the final closure argument for `#[track_caller]` closures
is no longer a tuple.

For direct (monomorphized) calls, the necessary support was already
implemented - we just needeed to adjust some assertions around checking
the ABI and argument count to take closures into account.

For calls through a trait object, more work was needed.
When creating a `ReifyShim`, we need to create a shim
for the trait method (e.g. `FnOnce::call_mut`) - unlike normal
functions, closures are never invoked directly, and always go through a
trait method.

Additional handling was needed for `InstanceDef::ClosureOnceShim`. In
order to pass location information throgh a direct (monomorphized) call
to `FnOnce::call_once` on an `FnMut` closure, we need to make
`ClosureOnceShim` aware of `#[tracked_caller]`. A new field
`track_caller` is added to `ClosureOnceShim` - this is used by
`InstanceDef::requires_caller` location, allowing codegen to
pass through the extra location argument.

Since `ClosureOnceShim.track_caller` is only used by codegen,
we end up generating two identical MIR shims - one for
`track_caller == true`, and one for `track_caller == false`. However,
these two shims are used by the entire crate (i.e. it's two shims total,
not two shims per unique closure), so this shouldn't a big deal.

2 years agoUpdate compiler/rustc_infer/src/infer/error_reporting/mod.rs
Takayuki Maeda [Thu, 23 Sep 2021 11:27:20 +0000 (20:27 +0900)]
Update compiler/rustc_infer/src/infer/error_reporting/mod.rs

Co-authored-by: mbartlett21 <29034492+mbartlett21@users.noreply.github.com>
2 years agoFix typo
Hirochika Matsumoto [Thu, 23 Sep 2021 09:57:23 +0000 (18:57 +0900)]
Fix typo

2 years agoAuto merge of #88587 - bdbai:fix/uwpio, r=joshtriplett
bors [Thu, 23 Sep 2021 06:18:07 +0000 (06:18 +0000)]
Auto merge of #88587 - bdbai:fix/uwpio, r=joshtriplett

Fix WinUWP std compilation errors due to I/O safety

I/O safety for Windows has landed in #87329. However, it does not cover UWP specific parts and prevents all UWP targets from building. See https://github.com/YtFlow/Maple/issues/18. This PR fixes these compile errors when building std for UWP targets.

2 years agoAuto merge of #89139 - camsteffen:write-perf, r=Mark-Simulacrum
bors [Thu, 23 Sep 2021 02:10:26 +0000 (02:10 +0000)]
Auto merge of #89139 - camsteffen:write-perf, r=Mark-Simulacrum

Use ZST for fmt unsafety

as suggested here - https://github.com/rust-lang/rust/pull/83302#issuecomment-923529151.

2 years agoReason safety for unsafe blocks for uwp stdin
bdbai [Wed, 22 Sep 2021 23:29:52 +0000 (07:29 +0800)]
Reason safety for unsafe blocks for uwp stdin

2 years agoAuto merge of #89187 - ehuss:update-cargo, r=ehuss
bors [Wed, 22 Sep 2021 22:38:03 +0000 (22:38 +0000)]
Auto merge of #89187 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in 9a28ac83c9eb73e42ffafac552c0a55f00dbf40c..0121d66aa2ef5ffa9735f86c2b56f5fdc5a837a6
2021-09-18 15:42:28 -0500 to 2021-09-22 16:08:27 +0000
- Implement example completion for zsh (rust-lang/cargo#9939)
- Bump curl-sys dependency (rust-lang/cargo#9937)
- Add fetch smoke test. (rust-lang/cargo#9921)
- Differentiate tests in progress bar. (rust-lang/cargo#9934)
- Remove TOML incompatibility hacks (rust-lang/cargo#9932)
- Change diesel compatibility messages (rust-lang/cargo#9927)
- Remove broken link in contrib docs. (rust-lang/cargo#9928)

2 years agoUpdate cargo
Eric Huss [Wed, 22 Sep 2021 22:06:52 +0000 (15:06 -0700)]
Update cargo

2 years agoTemporarily rename int_roundings functions to avoid conflicts
Josh Triplett [Wed, 22 Sep 2021 20:56:01 +0000 (13:56 -0700)]
Temporarily rename int_roundings functions to avoid conflicts

These functions are unstable, but because they're inherent they still
introduce conflicts with stable trait functions in crates. Temporarily
rename them to fix these conflicts, until we can resolve those conflicts
in a better way.

2 years agoSupport `#[track_caller]` on closures and generators
Aaron Hill [Sun, 27 Jun 2021 19:01:11 +0000 (14:01 -0500)]
Support `#[track_caller]` on closures and generators

This PR allows applying a `#[track_caller]` attribute to a
closure/generator expression. The attribute as interpreted as applying
to the compiler-generated implementation of the corresponding trait
method (`FnOnce::call_once`, `FnMut::call_mut`, `Fn::call`, or
`Generator::resume`).

This feature does not have its own feature gate - however, it requires
`#![feature(stmt_expr_attributes)]` in order to actually apply
an attribute to a closure or generator.

This is implemented in the same way as for functions - an extra
location argument is appended to the end of the ABI. For closures,
this argument is *not* part of the 'tupled' argument storing the
parameters - the final closure argument for `#[track_caller]` closures
is no longer a tuple.

For direct (monomorphized) calls, the necessary support was already
implemented - we just needeed to adjust some assertions around checking
the ABI and argument count to take closures into account.

For calls through a trait object, more work was needed.
When creating a `ReifyShim`, we need to create a shim
for the trait method (e.g. `FnOnce::call_mut`) - unlike normal
functions, closures are never invoked directly, and always go through a
trait method.

Additional handling was needed for `InstanceDef::ClosureOnceShim`. In
order to pass location information throgh a direct (monomorphized) call
to `FnOnce::call_once` on an `FnMut` closure, we need to make
`ClosureOnceShim` aware of `#[tracked_caller]`. A new field
`track_caller` is added to `ClosureOnceShim` - this is used by
`InstanceDef::requires_caller` location, allowing codegen to
pass through the extra location argument.

Since `ClosureOnceShim.track_caller` is only used by codegen,
we end up generating two identical MIR shims - one for
`track_caller == true`, and one for `track_caller == false`. However,
these two shims are used by the entire crate (i.e. it's two shims total,
not two shims per unique closure), so this shouldn't a big deal.

2 years agoAuto merge of #89179 - the8472:rollup-moxrtaj, r=the8472
bors [Wed, 22 Sep 2021 19:40:13 +0000 (19:40 +0000)]
Auto merge of #89179 - the8472:rollup-moxrtaj, r=the8472

Rollup of 8 pull requests

Successful merges:

 - #89036 (Fix missing `no_global_oom_handling` cfg-gating)
 - #89041 (Work around invalid DWARF bugs for fat LTO)
 - #89046 ("Fix" an overflow in byte position math)
 - #89127 (Re-enable the `src/test/debuginfo/mutex.rs` test on Windows)
 - #89133 (Fix ICE with `--cap-lints=allow` and `-Zfuel=...=0`)
 - #89162 (rustc_index: Add some map-like APIs to `IndexVec`)
 - #89164 (Document `--show-type-layout` in the rustdoc book)
 - #89170 (Disable the leak sanitizer on Macos aarch64 for now)

Failed merges:

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

2 years agoUpdate library/std/src/sync/mpsc/shared.rs
Mara Bos [Wed, 22 Sep 2021 18:20:33 +0000 (20:20 +0200)]
Update library/std/src/sync/mpsc/shared.rs

2 years agoRollup merge of #89170 - rusticstuff:aarch64_macos_disable_leak_sanitizer, r=petrochenkov
the8472 [Wed, 22 Sep 2021 17:03:27 +0000 (19:03 +0200)]
Rollup merge of #89170 - rusticstuff:aarch64_macos_disable_leak_sanitizer, r=petrochenkov

Disable the leak sanitizer on Macos aarch64 for now

It is currently broken, see #88132.

2 years agoRollup merge of #89164 - camelid:show-type-layout-docs, r=jyn514
the8472 [Wed, 22 Sep 2021 17:03:26 +0000 (19:03 +0200)]
Rollup merge of #89164 - camelid:show-type-layout-docs, r=jyn514

Document `--show-type-layout` in the rustdoc book

I also made a few small, related changes as separate commits.

r? `@jyn514`

2 years agoRollup merge of #89162 - petrochenkov:ivmap, r=davidtwco
the8472 [Wed, 22 Sep 2021 17:03:25 +0000 (19:03 +0200)]
Rollup merge of #89162 - petrochenkov:ivmap, r=davidtwco

rustc_index: Add some map-like APIs to `IndexVec`

`IndexVec` is often used as a map, but its map APIs are lacking.
This PR adds a couple of useful methods.

2 years agoRollup merge of #89133 - FabianWolff:issue-79546, r=michaelwoerister
the8472 [Wed, 22 Sep 2021 17:03:24 +0000 (19:03 +0200)]
Rollup merge of #89133 - FabianWolff:issue-79546, r=michaelwoerister

Fix ICE with `--cap-lints=allow` and `-Zfuel=...=0`

Fixes #79546.

2 years agoRollup merge of #89127 - wesleywiser:reenable_mutex_debuginfo_test, r=ehuss
the8472 [Wed, 22 Sep 2021 17:03:23 +0000 (19:03 +0200)]
Rollup merge of #89127 - wesleywiser:reenable_mutex_debuginfo_test, r=ehuss

Re-enable the `src/test/debuginfo/mutex.rs` test on Windows

This test required a newer version of cdb than was previously enabled in
CI thus leading to some bitrot in the test since the time it was
originally created. With the update to the `windows-latest` image last
week, we're now running this test in CI and thus uncovered the
regression.

I've updated the test and it now passes.

r? `@ehuss`

2 years agoRollup merge of #89046 - oli-obk:fix_oflo, r=estebank
the8472 [Wed, 22 Sep 2021 17:03:22 +0000 (19:03 +0200)]
Rollup merge of #89046 - oli-obk:fix_oflo, r=estebank

"Fix" an overflow in byte position math

r? `@estebank`

help! I fixed the ICE only to brick the diagnostic.

I mean, it was wrong previously (using an already expanded macro span), but it is really bad now XD

2 years agoRollup merge of #89041 - sticnarf:sticnarf/fat-lto-dwarf, r=nagisa
the8472 [Wed, 22 Sep 2021 17:03:21 +0000 (19:03 +0200)]
Rollup merge of #89041 - sticnarf:sticnarf/fat-lto-dwarf, r=nagisa

Work around invalid DWARF bugs for fat LTO

This PR applies the same workaround in #46772 to fat LTO.

It seems to fix the bug reported in https://github.com/rust-lang/rust/issues/66118#issuecomment-917434036.

2 years agoRollup merge of #89036 - nbdd0121:alloc, r=yaahc
the8472 [Wed, 22 Sep 2021 17:03:20 +0000 (19:03 +0200)]
Rollup merge of #89036 - nbdd0121:alloc, r=yaahc

Fix missing `no_global_oom_handling` cfg-gating

Cfg-gate these trait impls that are neglected.

These functions compile now because they use `box` syntax which depends on `exchange_malloc` during codegen only; as a result they compiles with cfg `no_global_oom_handling` but shouldn't.

Discovered in #89030 because that PR makes `box` syntax depend on `exchange_malloc` lang item during MIR construction.

2 years agoFix test
Cameron Steffen [Wed, 22 Sep 2021 16:48:01 +0000 (11:48 -0500)]
Fix test

2 years agochange singular to plural
Takayuki Maeda [Wed, 22 Sep 2021 15:43:51 +0000 (00:43 +0900)]
change singular to plural

2 years agoMake SymbolIndex private
bjorn3 [Sat, 18 Sep 2021 16:04:20 +0000 (18:04 +0200)]
Make SymbolIndex private

2 years agoAvoid a couple of Symbol::as_str calls in cg_llvm
bjorn3 [Sat, 18 Sep 2021 16:03:58 +0000 (18:03 +0200)]
Avoid a couple of Symbol::as_str calls in cg_llvm

2 years agoRemove Symbol::len
bjorn3 [Sat, 18 Sep 2021 16:01:36 +0000 (18:01 +0200)]
Remove Symbol::len

It is used exactly once and can be replaced with the equally fast
.as_str().len()

2 years agoRun no_core rustdoc tests on Linux only.
Hans Kratz [Wed, 22 Sep 2021 07:05:39 +0000 (09:05 +0200)]
Run no_core rustdoc tests on Linux only.

Windows on Macos ARM64 produce linker errors.

2 years agoAuto merge of #89134 - est31:revert_rustdoc_box_syntax, r=GuillaumeGomez
bors [Wed, 22 Sep 2021 09:55:13 +0000 (09:55 +0000)]
Auto merge of #89134 - est31:revert_rustdoc_box_syntax, r=GuillaumeGomez

Revert the rustdoc box syntax removal

Reverts the rustdoc box syntax removal from #87781.

It turned out to cause (minor) perf regressions.

Requested in https://github.com/rust-lang/rust/pull/87781#issuecomment-922589168

2 years agoAuto merge of #88865 - guswynn:must_not_suspend, r=oli-obk
bors [Wed, 22 Sep 2021 06:43:33 +0000 (06:43 +0000)]
Auto merge of #88865 - guswynn:must_not_suspend, r=oli-obk

Implement `#[must_not_suspend]`

implements #83310

Some notes on the impl:

1. The code that searches for the attribute on the ADT is basically copied from the `must_use` lint. It's not shared, as the logic did diverge
2. The RFC does specify that the attribute can be placed on fn's (and fn-like objects), like `must_use`. I think this is a direct copy from the `must_use` reference definition. This implementation does NOT support this, as I felt that ADT's (+ `impl Trait` + `dyn Trait`) cover the usecase's people actually want on the RFC, and adding an imp for the fn call case would be significantly harder. The `must_use` impl can do a single check at fn call stmt time, but `must_not_suspend` would need to answer the question: "for some value X with type T, find any fn call that COULD have produced this value". That would require significant changes to `generator_interior.rs`, and I would need mentorship on that. `@eholk` and I are discussing it.
3. `@estebank` do you know a way I can make the user-provided `reason` note pop out? right now it seems quite hidden

Also, I am not sure if we should run perf on this

r? `@nikomatsakis`

2 years agoDisable the leak sanitizer on Macos aarch64 for now.
Hans Kratz [Wed, 22 Sep 2021 04:42:28 +0000 (06:42 +0200)]
Disable the leak sanitizer on Macos aarch64 for now.

It is currently broken, see #88132.

2 years agoAuto merge of #88846 - jackh726:issue-88360, r=nikomatsakis
bors [Wed, 22 Sep 2021 04:02:01 +0000 (04:02 +0000)]
Auto merge of #88846 - jackh726:issue-88360, r=nikomatsakis

In suggest_missing_return_type, erase late bound regions after normalizing

Fixes #88360

There might be some hardening that could be done to not error or avoid erroring with LUBing `ReErased` with `ReEmpty`, but this was the most simple fix for this particular case.

r? `@nikomatsakis`

2 years agorustdoc: Emphasize "completely unstable"
Noah Lev [Wed, 22 Sep 2021 02:15:29 +0000 (19:15 -0700)]
rustdoc: Emphasize "completely unstable"

2 years agorustdoc: Note that type layout may differ between compilations
Noah Lev [Wed, 22 Sep 2021 02:13:15 +0000 (19:13 -0700)]
rustdoc: Note that type layout may differ between compilations

2 years agoFix inconsistent heading level in the rustdoc book
Noah Lev [Wed, 22 Sep 2021 02:17:09 +0000 (19:17 -0700)]
Fix inconsistent heading level in the rustdoc book

2 years agoDocument `--show-type-layout` in the rustdoc book
Noah Lev [Wed, 22 Sep 2021 02:12:10 +0000 (19:12 -0700)]
Document `--show-type-layout` in the rustdoc book

2 years agoAuto merge of #88629 - wesleywiser:fix_debuginfo_for_scalarpair_params, r=oli-obk
bors [Wed, 22 Sep 2021 01:13:49 +0000 (01:13 +0000)]
Auto merge of #88629 - wesleywiser:fix_debuginfo_for_scalarpair_params, r=oli-obk

Fix debuginfo for parameters passed via the ScalarPair abi on Windows

Mark all of these as locals so the debugger does not try to interpret
them as being a pointer to the value. This extends the approach used
in #81898.

Fixes #88625

2 years agorustc_index: Add some map-like APIs to `IndexVec`
Vadim Petrochenkov [Tue, 21 Sep 2021 22:59:46 +0000 (01:59 +0300)]
rustc_index: Add some map-like APIs to `IndexVec`

2 years agoAuto merge of #89158 - the8472:rollup-3e4ijth, r=the8472
bors [Tue, 21 Sep 2021 22:07:32 +0000 (22:07 +0000)]
Auto merge of #89158 - the8472:rollup-3e4ijth, r=the8472

Rollup of 12 pull requests

Successful merges:

 - #88795 (Print a note if a character literal contains a variation selector)
 - #89015 (core::ascii::escape_default: reduce struct size)
 - #89078 (Cleanup: Remove needless reference in ParentHirIterator)
 - #89086 (Stabilize `Iterator::map_while`)
 - #89096 ([bootstrap] Improve the error message when `ninja` is not found to link to installation instructions)
 - #89113 (dont `.ensure()` the `thir_abstract_const` query call in `mir_build`)
 - #89114 (Fixes a technicality regarding the size of C's `char` type)
 - #89115 (:arrow_up: rust-analyzer)
 - #89126 (Fix ICE when `indirect_structural_match` is allowed)
 - #89141 (Impl `Error` for `FromSecsError` without foreign type)
 - #89142 (Fix match for placeholder region)
 - #89147 (add case for checking const refs in check_const_value_eq)

Failed merges:

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

2 years agoRollup merge of #89147 - b-naber:refs_in_check_const_value_eq, r=oli-obk
the8472 [Tue, 21 Sep 2021 20:54:08 +0000 (22:54 +0200)]
Rollup merge of #89147 - b-naber:refs_in_check_const_value_eq, r=oli-obk

add case for checking const refs in check_const_value_eq

Previously in `check_const_value_eq` we destructured `ConstValue::ByRef` instances, this didn't account for `ty::Ref`s however, which led to an ICE.

Fixes https://github.com/rust-lang/rust/issues/88876
Fixes https://github.com/rust-lang/rust/issues/88384

r? `@oli-obk`

2 years agoRollup merge of #89142 - nerandell:master, r=jackh726
the8472 [Tue, 21 Sep 2021 20:54:07 +0000 (22:54 +0200)]
Rollup merge of #89142 - nerandell:master, r=jackh726

Fix match for placeholder region

cc #89118

2 years agoRollup merge of #89141 - mbartlett21:patch-2, r=kennytm
the8472 [Tue, 21 Sep 2021 20:54:07 +0000 (22:54 +0200)]
Rollup merge of #89141 - mbartlett21:patch-2, r=kennytm

Impl `Error` for `FromSecsError` without foreign type

Using it through the crate-local path in `std` means that it shouldn't make an "Implementations on Foreign Types" section in the `std::error::Error` docs.

2 years agoRollup merge of #89126 - FabianWolff:issue-89088, r=petrochenkov
the8472 [Tue, 21 Sep 2021 20:54:06 +0000 (22:54 +0200)]
Rollup merge of #89126 - FabianWolff:issue-89088, r=petrochenkov

Fix ICE when `indirect_structural_match` is allowed

Fixes #89088. The ICE is caused by `delay_good_path_bug()`, which is called (indirectly) from a `format!()` macro invocation. I have moved the macro invocation into the `decorate` closure of `struct_span_lint_hir()`, so that the macro is only invoked if the lint is not allowed (i.e., causes at least a warning, and thus prevents `delay_good_path_bug()` from firing).