about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2021-01-30Fix typo in E0759Steve Heindel-1/+1
2021-01-30Rollup merge of #81515 - eltociear:patch-7, r=jonas-schievinkYuki Okushi-1/+1
Fix typo in pat.rs parentesized -> parenthesized
2021-01-30Rollup merge of #81505 - henryboisdequin:cold_path-not-pub, r=sanxiynYuki Okushi-2/+2
`fn cold_path` doesn't need to be pub Fixes #81429 Note: this PR also fixes a small typo that I found
2021-01-30Rollup merge of #81473 - sanxiyn:write-only-field, r=oli-obkYuki Okushi-0/+15
Warn write-only fields cc `@Boscop's` example in #49256.
2021-01-30Rollup merge of #81468 - est31:cfg_version, r=petrochenkovYuki Okushi-5/+14
cfg(version): treat nightlies as complete This PR makes cfg(version) treat the nightlies for version 1.n.0 as 1.n.0, even though that nightly version might not have all stabilizations and features of the released 1.n.0. This is done for greater convenience for people who want to test a newly stabilized feature on nightly, or in other words, give newly stabilized features as many eyeballs as possible. For users who wish to pin nightlies, this commit adds a -Z assume-incomplete-release option that they can enable if they run into any issues due to this change. Implements the suggestion in https://github.com/rust-lang/rust/issues/64796#issuecomment-640851454
2021-01-30Rollup merge of #81291 - ↵Yuki Okushi-5/+10
sexxi-goose:fix-struct-update-functional-record-update-syntax-error, r=nikomatsakis Support FRU pattern with `[feature(capture_disjoint_fields)]` In case of a functional record update syntax for creating a structure, `ExprUseVisitor` to only detect the precise use of some of the field in the `..x` part of the syntax. However, when we start building MIR, we 1. First, build the place for `x` 2. and then, add precise field projections so that only some parts of `x` end up getting read. When `capture_disjoint_fields` is enabled, and FRU is used within a closure `x` won't be completely captured, and therefore the first step will fail. This PR updates `mir_build` to create a place builder in the first step and then create place from the builder only after applying the field projection. Closes https://github.com/rust-lang/project-rfc-2229/issues/32 r? ``````@nikomatsakis``````
2021-01-30Rollup merge of #80959 - jhpratt:unsigned_abs-stabilization, r=m-ou-seYuki Okushi-14/+5
Stabilize `unsigned_abs` Resolves #74913. This PR stabilizes the `i*::unsigned_abs()` method, which returns the absolute value of an integer _as its unsigned equivalent_. This has the advantage that it does not overflow on `i*::MIN`. I have gone ahead and used this in a couple locations throughout the repository.
2021-01-30Consider Scalar to be a bool only if its unsignedSimonas Kazlauskas-2/+7
This seems right, given that conceptually bools are unsigned, but the implications of this change may have more action at distance that I'm not sure how to exhaustively consider. For instance there are a number of cases where code attaches range metadata if `scalar.is_bool()` holds. Supposedly it would no longer be attached to the `repr(i8)` enums? Though I'm not sure why booleans are being special-cased here in the first place... Fixes #80556
2021-01-29Fix typo in pat.rsIkko Ashimine-1/+1
parentesized -> parenthesized
2021-01-29Auto merge of #81470 - tmiasko:remove-allocations, r=matthewjasperbors-7/+6
Avoid memory allocation when removing dead blocks Use `reachable_as_bitset` to reuse a bitset from the traversal rather than allocating it seprately. Additionally check if there are any unreachable blocks before proceeding.
2021-01-29fix typoHenry Boisdequin-1/+1
2021-01-29Auto merge of #81419 - rylev:canocalize-extern-entries, r=petrochenkovbors-20/+54
Pre-canoncalize ExternLocation::ExactPaths This stores pre-canacolized paths inside `ExternLocation::ExactPaths` so that we don't need to canoncalize them every time we want to compare them to source lib paths. This is related to #81414.
2021-01-29Pre-canoncalize ExternLocation::ExactPathsRyan Levick-20/+54
2021-01-29`fn cold_path` doesn't need to be pubHenry Boisdequin-1/+1
2021-01-29Treat nightlies for a version as completeest31-5/+14
This commit makes cfg(version) treat the nightlies for version 1.n.0 as 1.n.0, even though that nightly version might not have all stabilizations and features of the released 1.n.0. This is done for greater convenience for people who want to test a newly stabilized feature on nightly. For users who wish to pin nightlies, this commit adds a -Z assume-incomplete-release option that they can enable if there are any issues due to this change.
2021-01-29Auto merge of #81440 - tmiasko:always-live-locals, r=matthewjasperbors-19/+12
Visit only statements in always live locals No functional changes intended.
2021-01-29Auto merge of #81493 - JohnTitor:rollup-sa4m4zh, r=JohnTitorbors-215/+388
Rollup of 10 pull requests Successful merges: - #79570 (rustc: Stabilize `-Zrun-dsymutil` as `-Csplit-debuginfo`) - #79819 (Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint) - #79991 (rustdoc: Render HRTB correctly for bare functions) - #80215 (Use -target when linking binaries for Mac Catalyst) - #81158 (Point to span of upvar making closure FnMut) - #81176 (Improve safety of `LateContext::qpath_res`) - #81287 (Split rustdoc JSON types into separately versioned crate) - #81306 (Fuse inner iterator in FlattenCompat and improve related tests) - #81333 (clean up some const error reporting around promoteds) - #81459 (Fix rustdoc text selection for page titles) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-01-29Rollup merge of #81333 - RalfJung:const-err-simplify, r=oli-obkYuki Okushi-85/+32
clean up some const error reporting around promoteds These are some error reporting simplifications enabled by https://github.com/rust-lang/rust/pull/80579. Further simplifications are possible but could be blocked on making `const_err` a hard error. r? ``````@oli-obk``````
2021-01-29Rollup merge of #81176 - camsteffen:qpath-res, r=oli-obkYuki Okushi-0/+12
Improve safety of `LateContext::qpath_res` This is my first rustc code change, inspired by hacking on clippy! The first change is to clear cached `TypeckResults` from `LateContext` when visiting a nested item. I took a hint from [here](https://github.com/rust-lang/rust/blob/5e91c4ecc09312d8b63d250a432b0f3ef83f1df7/compiler/rustc_privacy/src/lib.rs#L1300). Clippy has a `qpath_res` util function to avoid a possible ICE in `LateContext::qpath_res`. But the docs of `LateContext::qpath_res` promise no ICE. So this updates the `LateContext` method to keep its promises, and removes the util function. Related: rust-lang/rust-clippy#4545 CC ````````````@eddyb```````````` since you've done related work CC ````````````@flip1995```````````` FYI
2021-01-29Rollup merge of #81158 - 1000teslas:issue-80313-fix, r=Aaron1011Yuki Okushi-1/+55
Point to span of upvar making closure FnMut For #80313.
2021-01-29Rollup merge of #80215 - visigoth:issue-80202-fix, r=estebankYuki Okushi-2/+7
Use -target when linking binaries for Mac Catalyst When running `rustc` with `-target x86_64-apple-ios-macabi`, the linker eventually gets run with `-arch x86_64`, because the linker back end splits the LLVM target triple and uses the first token as the target architecture. However, this does not work for the Mac Catalyst ABI, which is a separate target from Darwin. Specifying the full target triple with `-target` allows Mac Catalyst binaries to link and run. closes #80202
2021-01-29Rollup merge of #79819 - Aaron1011:feature/macro-trailing-semicolon, ↵Yuki Okushi-1/+64
r=petrochenkov Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint cc #79813 This PR adds an allow-by-default future-compatibility lint `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS`. It fires when a trailing semicolon in a macro body is ignored due to the macro being used in expression position: ```rust macro_rules! foo { () => { true; // WARN } } fn main() { let val = match true { true => false, _ => foo!() }; } ``` The lint takes its level from the macro call site, and can be allowed for a particular macro by adding `#[allow(macro_trailing_semicolon)]`. The lint is set to warn for all internal rustc crates (when being built by a stage1 compiler). After the next beta bump, we can enable the lint for the bootstrap compiler as well.
2021-01-29Rollup merge of #79570 - alexcrichton:split-debuginfo, r=bjorn3Yuki Okushi-126/+218
rustc: Stabilize `-Zrun-dsymutil` as `-Csplit-debuginfo` This commit adds a new stable codegen option to rustc, `-Csplit-debuginfo`. The old `-Zrun-dsymutil` flag is deleted and now subsumed by this stable flag. Additionally `-Zsplit-dwarf` is also subsumed by this flag but still requires `-Zunstable-options` to actually activate. The `-Csplit-debuginfo` flag takes one of three values: * `off` - This indicates that split-debuginfo from the final artifact is not desired. This is not supported on Windows and is the default on Unix platforms except macOS. On macOS this means that `dsymutil` is not executed. * `packed` - This means that debuginfo is desired in one location separate from the main executable. This is the default on Windows (`*.pdb`) and macOS (`*.dSYM`). On other Unix platforms this subsumes `-Zsplit-dwarf=single` and produces a `*.dwp` file. * `unpacked` - This means that debuginfo will be roughly equivalent to object files, meaning that it's throughout the build directory rather than in one location (often the fastest for local development). This is not the default on any platform and is not supported on Windows. Each target can indicate its own default preference for how debuginfo is handled. Almost all platforms default to `off` except for Windows and macOS which default to `packed` for historical reasons. Some equivalencies for previous unstable flags with the new flags are: * `-Zrun-dsymutil=yes` -> `-Csplit-debuginfo=packed` * `-Zrun-dsymutil=no` -> `-Csplit-debuginfo=unpacked` * `-Zsplit-dwarf=single` -> `-Csplit-debuginfo=packed` * `-Zsplit-dwarf=split` -> `-Csplit-debuginfo=unpacked` Note that `-Csplit-debuginfo` still requires `-Zunstable-options` for non-macOS platforms since split-dwarf support was *just* implemented in rustc. There's some more rationale listed on #79361, but the main gist of the motivation for this commit is that `dsymutil` can take quite a long time to execute in debug builds and provides little benefit. This means that incremental compile times appear that much worse on macOS because the compiler is constantly running `dsymutil` over every single binary it produces during `cargo build` (even build scripts!). Ideally rustc would switch to not running `dsymutil` by default, but that's a problem left to get tackled another day. Closes #79361
2021-01-28Auto merge of #81388 - bjorn3:wasm_bindgen_fix, r=nikomatsakisbors-6/+5
Fix abi for wasm-bindgen Hopefully fixes https://github.com/rust-lang/rust/issues/81386. `@alexcrichton` can you confirm this fixes wasm-bindgen? r? `@alexcrichton`
2021-01-28Auto merge of #81055 - matthewjasper:non-fatal-overflow, r=nikomatsakisbors-12/+3
Make hitting the recursion limit in projection non-fatal This change was originally made in #80246 to avoid future (effectively) infinite loop bugs in projections, but wundergraph relies on rustc recovering here. cc #80953 r? `@nikomatsakis`
2021-01-28rustc: Stabilize `-Zrun-dsymutil` as `-Csplit-debuginfo`Alex Crichton-126/+218
This commit adds a new stable codegen option to rustc, `-Csplit-debuginfo`. The old `-Zrun-dsymutil` flag is deleted and now subsumed by this stable flag. Additionally `-Zsplit-dwarf` is also subsumed by this flag but still requires `-Zunstable-options` to actually activate. The `-Csplit-debuginfo` flag takes one of three values: * `off` - This indicates that split-debuginfo from the final artifact is not desired. This is not supported on Windows and is the default on Unix platforms except macOS. On macOS this means that `dsymutil` is not executed. * `packed` - This means that debuginfo is desired in one location separate from the main executable. This is the default on Windows (`*.pdb`) and macOS (`*.dSYM`). On other Unix platforms this subsumes `-Zsplit-dwarf=single` and produces a `*.dwp` file. * `unpacked` - This means that debuginfo will be roughly equivalent to object files, meaning that it's throughout the build directory rather than in one location (often the fastest for local development). This is not the default on any platform and is not supported on Windows. Each target can indicate its own default preference for how debuginfo is handled. Almost all platforms default to `off` except for Windows and macOS which default to `packed` for historical reasons. Some equivalencies for previous unstable flags with the new flags are: * `-Zrun-dsymutil=yes` -> `-Csplit-debuginfo=packed` * `-Zrun-dsymutil=no` -> `-Csplit-debuginfo=unpacked` * `-Zsplit-dwarf=single` -> `-Csplit-debuginfo=packed` * `-Zsplit-dwarf=split` -> `-Csplit-debuginfo=unpacked` Note that `-Csplit-debuginfo` still requires `-Zunstable-options` for non-macOS platforms since split-dwarf support was *just* implemented in rustc. There's some more rationale listed on #79361, but the main gist of the motivation for this commit is that `dsymutil` can take quite a long time to execute in debug builds and provides little benefit. This means that incremental compile times appear that much worse on macOS because the compiler is constantly running `dsymutil` over every single binary it produces during `cargo build` (even build scripts!). Ideally rustc would switch to not running `dsymutil` by default, but that's a problem left to get tackled another day. Closes #79361
2021-01-28Add missing braceOli Scherer-1/+1
2021-01-29Simplify base_exprSeo Sanghyeon-8/+4
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2021-01-28Auto merge of #81441 - tmiasko:ctfe-inline, r=oli-obkbors-2/+19
Try inlining trivial functions used by CTFE r? `@ghost`
2021-01-28Warn write-only fieldsSeo Sanghyeon-0/+19
2021-01-28Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lintAaron Hill-1/+64
cc #79813 This PR adds an allow-by-default future-compatibility lint `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS`. It fires when a trailing semicolon in a macro body is ignored due to the macro being used in expression position: ```rust macro_rules! foo { () => { true; // WARN } } fn main() { let val = match true { true => false, _ => foo!() }; } ``` The lint takes its level from the macro call site, and can be allowed for a particular macro by adding `#[allow(semicolon_in_expressions_from_macros)]`. The lint is set to warn for all internal rustc crates (when being built by a stage1 compiler). After the next beta bump, we can enable the lint for the bootstrap compiler as well.
2021-01-28Auto merge of #81149 - Aaron1011:feature/better-no-method-found-err, r=estebankbors-23/+39
Avoid describing a method as 'not found' when bounds are unsatisfied Fixes #76267 When there is a single applicable method candidate, but its trait bounds are not satisfied, we avoid saying that the method is "not found". Insted, we update the error message to directly mention which bounds are not satisfied, rather than mentioning them in a note.
2021-01-28Rollup merge of #81433 - lcnr:stop-looking-into-ty-alias, r=oli-obkYuki Okushi-34/+0
const_evaluatable: stop looking into type aliases see https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/const_evaluatable.3A.20type.20alias r? ````@oli-obk````
2021-01-28Rollup merge of #81426 - BoxyUwU:boxychangesv2, r=oli-obkYuki Okushi-4/+22
const_evaluatable: expand abstract consts in try_unify See this [zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/combining.20const.20bounds) for more info cc ```@lcnr``` r? ```@oli-obk```
2021-01-28Rollup merge of #81416 - estebank:suggestion-span-tweak, r=petrochenkovYuki Okushi-18/+7
Tweak suggestion for missing field in patterns Account for parser recovered struct and tuple patterns to avoid invalid suggestion. Follow up to #81103.
2021-01-28Rollup merge of #81284 - jyn514:impl-times, r=wesleywiserYuki Okushi-8/+17
Make `-Z time-passes` less noisy - Add the module name to `pre_AST_expansion_passes` and don't make it a verbose event (since it normally doesn't take very long, and it's emitted many times) - Don't make the following rustdoc events verbose; they're emitted many times. + build_extern_trait_impl + build_local_trait_impl + build_primitive_trait_impl + get_auto_trait_impls + get_blanket_trait_impls - Remove the `get_auto_trait_and_blanket_synthetic_impls` rustdoc event; it's wholly covered by get_{auto,blanket}_trait_impls and not very useful. I found this while working on https://github.com/rust-lang/rust/pull/81275 but it's independent of those changes.
2021-01-28Rollup merge of #81277 - flip1995:from_diag_items, r=matthewjasperYuki Okushi-0/+3
Make more traits of the From/Into family diagnostic items Following traits are now diagnostic items: - `From` (unchanged) - `Into` - `TryFrom` - `TryInto` This also adds symbols for those items: - `into_trait` - `try_from_trait` - `try_into_trait` Related: https://github.com/rust-lang/rust-clippy/pull/6620#discussion_r562482587
2021-01-28Rollup merge of #81062 - sexxi-goose:precise_capture_diagnostics, r=nikomatsakisYuki Okushi-29/+145
Improve diagnostics for Precise Capture This is just the capture analysis part and borrow checker logging will updated as part of rust-lang/project-rfc-2229#8 Closes rust-lang/project-rfc-2229#22
2021-01-28Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakisYuki Okushi-533/+756
Refractor a few more types to `rustc_type_ir` In the continuation of #79169, ~~blocked on that PR~~. This PR: - moves `IntVarValue`, `FloatVarValue`, `InferTy` (and friends) and `Variance` - creates the `IntTy`, `UintTy` and `FloatTy` enums in `rustc_type_ir`, based on their `ast` and `chalk_ir` equilavents, and uses them for types in the rest of the compiler. ~~I will split up that commit to make this easier to review and to have a better commit history.~~ EDIT: done, I split the PR in commits of 200-ish lines each r? `````@nikomatsakis````` cc `````@jackh726`````
2021-01-28Auto merge of #81414 - rylev:fetch-rmeta-crates, r=petrochenkovbors-2/+3
Check for rmeta crates when getting existing crates from cache This change makes sure to check for rmeta files when resolving crates instead of always going to disk in that case.
2021-01-28Avoid memory allocation when removing dead blocksTomasz Miąsko-7/+6
Use `reachable_as_bitset` to reuse a bitset from the traversal rather than allocating it seprately. Additionally check if there are any unreachable blocks before proceeding.
2021-01-27Inline MemPlace::offsetTomasz Miąsko-0/+1
2021-01-27Inline trivial implementation of rustc_target::abi::AlignTomasz Miąsko-2/+18
2021-01-27commentsEllen-1/+3
2021-01-27const_evaluatable: stop looking into type aliasesBastian Kauschke-34/+0
2021-01-27Auto merge of #79591 - estebank:unexpected-generics, r=oli-obkbors-1/+9
Point only at generic arguments when they are unexpected
2021-01-26Avoid describing a method as 'not found' when bounds are unsatisfiedAaron Hill-23/+39
Fixes #76267 When there is a single applicable method candidate, but its trait bounds are not satisfied, we avoid saying that the method is "not found". Insted, we update the error message to directly mention which bounds are not satisfied, rather than mentioning them in a note.
2021-01-27boop, ur abstract consts are now expandedEllen-4/+20
2021-01-27Auto merge of #81393 - ↵bors-4/+4
pnkfelix:issue-81296-make-weak-item-traversal-deterministic, r=estebank Make weak item traversal deterministic Fix #81296. (No test added. The relevant test *is* ui/panic-handler/weak-lang-item.rs, and this change should make it less flaky.)
2021-01-27Visit only statements in always live localsTomasz Miąsko-19/+12
No functional changes intended.