about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-09-24resolve: Use a single common map for local and foreign modulesVadim Petrochenkov-20/+13
2021-09-24resolve: Rename some expansion def scope methodsVadim Petrochenkov-23/+19
2021-09-24resolve: Cleanup module allocationVadim Petrochenkov-56/+73
Construction of all modules is now centralized and performed by `fn new_module`.
2021-09-24resolve: Do not cache nearest parent mod in `ModuleData`Vadim Petrochenkov-57/+36
2021-09-24Auto merge of #88835 - FabianWolff:issue-88770, r=petrochenkovbors-18/+94
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.
2021-09-24Auto merge of #89130 - nikic:update-llvm-2, r=cuviperbors-0/+0
Update LLVM submodule This merges the upstream `release/13.x` branch to pull in the second fix for #88769.
2021-09-24Auto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebankbors-29/+54
Disable visible path calculation for PrettyPrinter in Ok path of compiler
2021-09-24Auto merge of #89211 - workingjubilee:rollup-fj4eduk, r=workingjubileebors-54/+146
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-23Rollup merge of #89200 - hkmatsumoto:patch, r=workingjubileeJubilee-1/+1
Fix typo
2021-09-23Rollup merge of #89184 - joshtriplett:master, r=estebankJubilee-48/+48
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-23Rollup merge of #89176 - TaKO8Ki:change-singular-to-plural, r=lcnrJubilee-1/+1
Change singular to plural
2021-09-23Rollup merge of #89171 - rusticstuff:aarch64_macos_rustdoc_ci_fixes, r=jyn514Jubilee-2/+2
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-23Rollup merge of #89148 - estebank:used-type-param, r=oli-obkJubilee-1/+57
Suggest `_` in turbofish if param will be inferred from fn argument
2021-09-23Rollup merge of #89023 - Wardenfar:issue-85066, r=nagisaJubilee-0/+32
Resolve issue : Somewhat confusing error with extended_key_value_attributes Fixes #85066
2021-09-23Rollup merge of #88612 - lovasoa:patch-1, r=m-ou-seJubilee-1/+5
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-23Auto merge of #88804 - Mark-Simulacrum:never-algo-v2, r=nikomatsakis,jackh726bors-174/+733
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-23Auto merge of #89024 - ↵bors-272/+433
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-23Auto merge of #89016 - lcnr:non_blanket_impls, r=nikomatsakis,michaelwoeristerbors-118/+43
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-23Suggest `_` in turbofish if param will be inferred from fn argumentEsteban Kuber-1/+57
2021-09-23Check that TAIT generics are fully generic in mir typeck instead of ↵Oli Scherer-272/+433
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
2021-09-23Auto merge of #87064 - Aaron1011:new-closure-track-caller, r=estebankbors-23/+267
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.
2021-09-23Update compiler/rustc_infer/src/infer/error_reporting/mod.rsTakayuki Maeda-1/+1
Co-authored-by: mbartlett21 <29034492+mbartlett21@users.noreply.github.com>
2021-09-23Fix typoHirochika Matsumoto-1/+1
2021-09-23Auto merge of #88587 - bdbai:fix/uwpio, r=joshtriplettbors-4/+7
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.
2021-09-23Auto merge of #89139 - camsteffen:write-perf, r=Mark-Simulacrumbors-103/+111
Use ZST for fmt unsafety as suggested here - https://github.com/rust-lang/rust/pull/83302#issuecomment-923529151.
2021-09-23Reason safety for unsafe blocks for uwp stdinbdbai-0/+2
2021-09-22Auto merge of #89187 - ehuss:update-cargo, r=ehussbors-2/+2
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)
2021-09-22Update cargoEric Huss-2/+2
2021-09-22Temporarily rename int_roundings functions to avoid conflictsJosh Triplett-48/+48
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-22Support `#[track_caller]` on closures and generatorsAaron Hill-23/+267
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.
2021-09-22Auto merge of #89179 - the8472:rollup-moxrtaj, r=the8472bors-56/+130
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
2021-09-22Update library/std/src/sync/mpsc/shared.rsMara Bos-1/+1
2021-09-22Rollup merge of #89170 - rusticstuff:aarch64_macos_disable_leak_sanitizer, ↵the8472-2/+5
r=petrochenkov Disable the leak sanitizer on Macos aarch64 for now It is currently broken, see #88132.
2021-09-22Rollup merge of #89164 - camelid:show-type-layout-docs, r=jyn514the8472-2/+18
Document `--show-type-layout` in the rustdoc book I also made a few small, related changes as separate commits. r? `@jyn514`
2021-09-22Rollup merge of #89162 - petrochenkov:ivmap, r=davidtwcothe8472-24/+28
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.
2021-09-22Rollup merge of #89133 - FabianWolff:issue-79546, r=michaelwoeristerthe8472-1/+14
Fix ICE with `--cap-lints=allow` and `-Zfuel=...=0` Fixes #79546.
2021-09-22Rollup merge of #89127 - wesleywiser:reenable_mutex_debuginfo_test, r=ehussthe8472-7/+5
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`
2021-09-22Rollup merge of #89046 - oli-obk:fix_oflo, r=estebankthe8472-10/+37
"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
2021-09-22Rollup merge of #89041 - sticnarf:sticnarf/fat-lto-dwarf, r=nagisathe8472-10/+20
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.
2021-09-22Rollup merge of #89036 - nbdd0121:alloc, r=yaahcthe8472-0/+3
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.
2021-09-22Fix testCameron Steffen-3/+3
2021-09-23change singular to pluralTakayuki Maeda-1/+1
2021-09-22Run no_core rustdoc tests on Linux only.Hans Kratz-2/+2
Windows on Macos ARM64 produce linker errors.
2021-09-22Auto merge of #89134 - est31:revert_rustdoc_box_syntax, r=GuillaumeGomezbors-54/+47
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
2021-09-22Auto merge of #88865 - guswynn:must_not_suspend, r=oli-obkbors-5/+701
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`
2021-09-22Disable the leak sanitizer on Macos aarch64 for now.Hans Kratz-2/+5
It is currently broken, see #88132.
2021-09-22Auto merge of #88846 - jackh726:issue-88360, r=nikomatsakisbors-1/+41
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`
2021-09-21rustdoc: Emphasize "completely unstable"Noah Lev-1/+1
2021-09-21rustdoc: Note that type layout may differ between compilationsNoah Lev-1/+1
2021-09-21Fix inconsistent heading level in the rustdoc bookNoah Lev-1/+1