Commit graph

155325 commits

Author SHA1 Message Date
Vadim Petrochenkov
8f035b87e0 Disable a spuriously failing test 2021-09-24 20:28:47 +03:00
Adam Gemmell
27213b0254 Disable some tests for platforms without registers.
Update new tests to run on aarch64 platforms.
2021-09-24 17:00:57 +00:00
Wesley Wiser
dd918048a5 Update and add more tests 2021-09-24 12:27:42 -04:00
Fabian Wolff
4337089098 Add basic checks for well-formedness of fn/fn_mut lang items 2021-09-24 18:26:27 +02:00
Adam Gemmell
6d218d02d9 Add inline asm! tests for aarch64
Enable tests which are largely architecture-independent on all supported
platforms
2021-09-24 16:23:37 +00:00
Vadim Petrochenkov
ab834e5ea9 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.
2021-09-24 18:57:15 +03:00
Vadim Petrochenkov
a8021888c8 resolve: Use a single common map for local and foreign modules 2021-09-24 18:57:15 +03:00
Vadim Petrochenkov
1a23858983 resolve: Rename some expansion def scope methods 2021-09-24 18:57:15 +03:00
Vadim Petrochenkov
6e9adcbd82 resolve: Cleanup module allocation
Construction of all modules is now centralized and performed by `fn new_module`.
2021-09-24 18:57:15 +03:00
Vadim Petrochenkov
fd58eea4e1 resolve: Do not cache nearest parent mod in ModuleData 2021-09-24 18:57:14 +03:00
Mark Rousskov
a307dcc962 Add 1.56.0 release notes
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-09-24 11:24:00 -04:00
Takayuki Maeda
353d6373ff change the order of path suggestions 2021-09-25 00:22:59 +09:00
bors
f06f9bbd3a 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.
2021-09-24 15:22:26 +00:00
Nixon Enraght-Moony
ed3b751799 Give better error for macro_rules! name! 2021-09-24 16:21:34 +01:00
bors
fb61d04896 Auto merge of #7669 - Labelray:if_then_panic, r=giraffate
New lint `if_then_panic`

changelog: add the new lint [`if_then_panic`]
fix #7645
2021-09-24 14:43:51 +00:00
bors
2e38bc16eb Auto merge of #7715 - F3real:vec2, r=camsteffen
Avoid needless heap allocation in box_collection

Fix issue left from previous PR

changelog: none.

r? `@Manishearth`
2021-09-24 14:24:41 +00:00
Labelray
543b638dbe Add new lint if_then_panic 2021-09-24 22:14:20 +08:00
Takashi Idobe
cebba31d4a
unitalicize O(1) complexities 2021-09-24 08:33:49 -05:00
Takashi Idobe
cb1c06fdd8
Merge branch 'rust-lang:master' into master 2021-09-24 08:31:03 -05:00
bors
a0648eab36 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:
b69fe57261/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()`](b69fe57261/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()`:
b69fe57261/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.
2021-09-24 11:54:29 +00:00
r00ster91
7355376d5b consistent big O notation 2021-09-24 12:44:28 +02:00
r00ster91
956f87fb04 consistent big O notation 2021-09-24 12:44:28 +02:00
Guillaume Gomez
9fa59e19e5 Enable "generate-link-to-definition" option on rust tools docs as well 2021-09-24 12:05:35 +02:00
Guillaume Gomez
10bef56fff Simplify explicit request check 2021-09-24 12:01:57 +02:00
F3real
7a4a556100 Avoid needless heap allocation in box_collection 2021-09-24 11:02:22 +02:00
bors
91d8da1f4b 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.
2021-09-24 08:12:15 +00:00
bors
197fc8591e Auto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebank
Disable visible path calculation for PrettyPrinter in Ok path of compiler
2021-09-24 05:29:49 +00:00
Wesley Wiser
389365631d Fix tidy and respond to some feedback 2021-09-23 22:15:12 -04:00
Samuel E. Moelius III
551220c48d Add known-tool-in-submodule test
The test currently fails. The next commit fixes it.
2021-09-23 22:05:26 -04:00
bors
293b8f2c11 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
2021-09-24 01:48:02 +00:00
Jubilee
1875cecfd4
Rollup merge of #89200 - hkmatsumoto:patch, r=workingjubilee
Fix typo
2021-09-23 17:31:47 -07:00
Jubilee
384dd53641
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.
2021-09-23 17:31:46 -07:00
Jubilee
a071193826
Rollup merge of #89176 - TaKO8Ki:change-singular-to-plural, r=lcnr
Change singular to plural
2021-09-23 17:31:45 -07:00
Jubilee
23efc96e3e
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``
2021-09-23 17:31:44 -07:00
Jubilee
9e11d1cca4
Rollup merge of #89148 - estebank:used-type-param, r=oli-obk
Suggest `_` in turbofish if param will be inferred from fn argument
2021-09-23 17:31:43 -07:00
Jubilee
5da2f460b3
Rollup merge of #89023 - Wardenfar:issue-85066, r=nagisa
Resolve issue : Somewhat confusing error with extended_key_value_attributes

Fixes #85066
2021-09-23 17:31:42 -07:00
Jubilee
586d028d0e
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
2021-09-23 17:31:41 -07:00
Takashi Idobe
b146525140
remove trailing whitespace 2021-09-23 18:20:46 -05:00
Takashi Idobe
d63e0f0e47
Add time complexities to linked_list.rs 2021-09-23 17:58:02 -05:00
bors
900cf5e890 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`
2021-09-23 22:45:22 +00:00
Wesley Wiser
ab8aef40b1 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
2021-09-23 18:01:32 -04:00
Wesley Wiser
7a3e450df4 Add tests to verify the drop order of fields in fully captured upvars 2021-09-23 17:45:17 -04:00
bors
2b862bed98 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`
2021-09-23 19:38:30 +00:00
Eric Huss
2da6e66948 Support incremental in compiletest for non-incremental modes. 2021-09-23 12:16:51 -07:00
Guillaume Gomez
1c23349504 Clean up clean/types.rs file by making the implementations follow the type declaration 2021-09-23 20:03:38 +02:00
Mark Rousskov
0222556c07 Simplify scoped_thread
Avoids a bunch of manual pointer manipulation.
2021-09-23 12:56:59 -04:00
bors
cd3f3cf8a8 Auto merge of #7707 - Jarcho:suspicious_else_proc_mac, r=Manishearth
Don't lint `suspicious_else_formatting` inside proc-macros

fixes: #7650

I'll add a test for this one soon.

changelog: Don't lint `suspicious_else_formatting` inside proc-macros
2021-09-23 16:14:29 +00:00
bors
bf642323d6 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`
2021-09-23 15:44:53 +00:00
Jason Newcomb
e69154f370
Add test for #7650 2021-09-23 11:22:38 -04:00
Esteban Kuber
affea730e9 Suggest _ in turbofish if param will be inferred from fn argument 2021-09-23 14:08:47 +00:00