about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-11-09Rollup merge of #90035 - SparrowLii:rfc2528, r=jackh726Matthias Krüger-14/+205
implement rfc-2528 type_changing-struct-update This PR implement rfc2528-type_changing-struct-update. The main change process is as follows: 1. Move the processing part of `base_expr` into `check_expr_struct_fields` to avoid returning `remaining_fields` (a relatively complex hash table) 2. Before performing the type consistency check(`check_expr_has_type_or_error`), if the `type_changing_struct_update` feature is set, enter a different processing flow, otherwise keep the original flow 3. In the case of the same structure definition, check each field in `remaining_fields`. If the field in `base_expr` is not the suptype of the field in `adt_ty`, an error(`FeildMisMatch`) will be reported. The MIR part does not need to be changed, because only the items contained in `remaining_fields` will be extracted from `base_expr` when MIR is generated. This means that fields with different types in `base_expr` will not be used Updates #86618 cc `@nikomatsakis`
2021-11-09Rollup merge of #89561 - nbdd0121:const_typeck, r=nikomatsakisMatthias Krüger-7/+191
Type inference for inline consts Fixes #78132 Fixes #78174 Fixes #81857 Fixes #89964 Perform type checking/inference of inline consts in the same context as the outer def, similar to what is currently done to closure. Doing so would require `closure_base_def_id` of the inline const to return the outer def, and since `closure_base_def_id` can be called on non-local crate (and thus have no HIR available), a new `DefKind` is created for inline consts. The type of the generated anon const can capture lifetime of outer def, so we couldn't just use the typeck result as the type of the inline const's def. Closure has a similar issue, and it uses extra type params `CK, CS, U` to capture closure kind, input/output signature and upvars. I use a similar approach for inline consts, letting it have an extra type param `R`, and then `typeof(InlineConst<[paremt generics], R>)` would just be `R`. In borrowck region requirements are also propagated to the outer MIR body just like it's currently done for closure. With this PR, inline consts in expression position are quitely usable now; however the usage in pattern position is still incomplete -- since those does not remain in the MIR borrowck couldn't verify the lifetime there. I have left an ignored test as a FIXME. Some disucssions can be found on [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/inline.20consts.20typeck). cc `````@spastorino````` `````@lcnr````` r? `````@nikomatsakis````` `````@rustbot````` label A-inference F-inline_const T-compiler
2021-11-09Auto merge of #90724 - JohnTitor:rollup-zg0kbm3, r=JohnTitorbors-2/+127
Rollup of 6 pull requests Successful merges: - #87530 (Add comments regarding superfluous `!Sync` impls) - #90591 (treat illumos like solaris in failing ui tests which need it) - #90678 (Add some GATs-related regression tests) - #90688 (enable `dotprod` target feature in arm) - #90708 (Add a note about feature(explicit_generic_args_with_impl_trait) to the relevant error message) - #90720 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-11-09Rollup merge of #90720 - ehuss:update-cargo, r=ehussYuki Okushi-0/+0
Update cargo 4 commits in 94ca096afbf25f670e76e07dca754fcfe27134be..2e2a16e983f597da62bc132eb191bc3276d4b1bb 2021-10-29 14:45:06 +0000 to 2021-11-08 15:13:38 +0000 - Fix debug panic on download with redirect body. (rust-lang/cargo#10048) - no need to clone (rust-lang/cargo#10051) - Update curl. (rust-lang/cargo#10040) - Fix --scrape-examples-target-crate using package name (with dashes) instead of crate name (with underscores) (rust-lang/cargo#10037)
2021-11-09Rollup merge of #90708 - NieDzejkob:feature-note, r=jackh726Yuki Okushi-0/+21
Add a note about feature(explicit_generic_args_with_impl_trait) to the relevant error message Fixes #90615
2021-11-09Rollup merge of #90678 - JohnTitor:add-some-gats-tests, r=jackh726Yuki Okushi-0/+101
Add some GATs-related regression tests Closes #88595, closes #90014 r? `@jackh726`
2021-11-09Rollup merge of #90591 - richlowe:illumos-ui-target, r=Mark-SimulacrumYuki Okushi-2/+5
treat illumos like solaris in failing ui tests which need it Just adding the right cfg target for tests which fail because they don't know illumos is a thing. (cc `````@jclulow)`````
2021-11-09Auto merge of #90700 - fee1-dead:select-returns-vec, r=davidtwcobors-2/+2
Make `select_*` methods return `Vec` for `TraitEngine` This reduces some complexity as an empty vec means no errors and non-empty vec means errors occurred.
2021-11-09Update cargoEric Huss-0/+0
2021-11-09Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995bors-194/+435
Don't abort compilation after giving a lint error The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors. Closes https://github.com/rust-lang/rust/issues/82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.
2021-11-09Auto merge of #90485 - camsteffen:fmt-args-less-bind, r=m-ou-sebors-16/+10
Don't destructure args tuple in format_args! This allows Clippy to parse the HIR more simply since `arg0` is changed to `_args.0`. (cc rust-lang/rust-clippy#7843). From rustc's perspective, I think this is something between a lateral move and a tiny improvement since there are fewer bindings. r? `@m-ou-se`
2021-11-09Auto merge of #90695 - GuillaumeGomez:rollup-kxvvw4o, r=GuillaumeGomezbors-22/+25
Rollup of 4 pull requests Successful merges: - #90494 (ARMv6K Horizon OS panic change) - #90652 (use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))) - #90657 (Fix bug with `#[doc]` string single-character last lines) - #90689 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-11-09Add some GATs-related regression testsYuki Okushi-0/+101
2021-11-08Auto merge of #90443 - camelid:rustdoc-subst, r=GuillaumeGomezbors-118/+132
Merge `DocContext.{ty,lt,ct}_substs` into one map It should be impossible to have more than one entry with a particular key across the three maps, so they should be one map. In addition to making it impossible for multiple entries to exist, this should improve memory usage since now only one map is allocated on the stack and heap. r? `@GuillaumeGomez`
2021-11-08Add a note about feature(explicit_generic_args_with_impl_trait) to the ↵Jakub Kądziołka-0/+21
relevant error message
2021-11-08Make select_* methods return Vec for TraitEngineDeadbeef-2/+2
2021-11-08Rollup merge of #90689 - lnicola:rust-analyzer-2021-11-08, r=lnicolaGuillaume Gomez-22/+16
:arrow_up: rust-analyzer r? ``@ghost``
2021-11-08Rollup merge of #90657 - GuillaumeGomez:one-char-last-line-removed, r=jyn514Guillaume Gomez-0/+9
Fix bug with `#[doc]` string single-character last lines Fixes #90618. This is because `.iter().all(|c| c == '*')` returns `true` if there is no character checked. And in case the last line has only one character, it simply returns `true`, making the last line behind removed.
2021-11-08:arrow_up: rust-analyzerLaurențiu Nicola-22/+16
2021-11-08Auto merge of #90675 - camelid:cleanup-impl, r=jyn514bors-158/+143
rustdoc: Cleanup `clean::Impl` and other parts of `clean` This PR cleans up and reduces the size of `clean::Impl`, makes some other small performance improvements, and removes some Clean impls that are either unnecessary or potentially confusing. r? `@jyn514`
2021-11-08Auto merge of #90680 - calebcartwright:rustfmt-sync, r=calebcartwrightbors-372/+670
sync rustfmt subtree
2021-11-07Merge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-syncCaleb Cartwright-372/+670
2021-11-07rustdoc: Remove top-level wrappers for `ImplKind` methodsNoah Lev-20/+8
The `ImplKind` methods can just be used directly instead.
2021-11-08Auto merge of #89488 - c410-f3r:testsssssss, r=petrochenkovbors-117/+3
Move some tests to more reasonable directories - 8 cc #73494 r? `@petrochenkov`
2021-11-08Use `has_errors_or_lint_errors` in rustdoc instead of `abort_if_errors()`Joshua Nelson-5/+9
Rustdoc is special as usual and doesn't go through RunCompiler, so it needs its own explicit checks. The rest of the tools go through RunCompiler, so they should be fine.
2021-11-08Don't abort compilation after giving a lint errorJoshua Nelson-189/+426
The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors.
2021-11-07Auto merge of #88368 - jyn514:metadata-error, r=petrochenkovbors-1/+28
Improve error when an .rlib can't be parsed This usually describes either an error in the compiler itself or some sort of IO error. Either way, we should report it to the user rather than just saying "crate not found". This only gives an error if the crate couldn't be loaded at all - if the compiler finds another .rlib or .rmeta file which was valid, it will continue to compile the crate. Example output: ``` error[E0785]: found invalid metadata files for crate `foo` --> bar.rs:3:24 | 3 | println!("{}", foo::FOO_11_49[0]); | ^^^ | = warning: failed to parse rlib '/home/joshua/test-rustdoc/libfoo.rlib': Invalid archive extended name offset ``` cc `@ehuss`
2021-11-07Merge remote-tracking branch 'upstream/master' into rustup-2021-11-s1Caleb Cartwright-350/+292
2021-11-07Remove Clean impl for `&T`Noah Lev-7/+1
2021-11-07Remove unused Clean impl for `Rc<T>`Noah Lev-7/+0
2021-11-07Remove Clean impl for `Vec<T>`Noah Lev-49/+47
2021-11-07Remove Clean impl for `IndexVec<T>`Noah Lev-8/+1
2021-11-07Remove Clean impl for `Option<T>`Noah Lev-11/+5
2021-11-07rustdoc: Use `ty::ImplPolarity` instead of custom enumNoah Lev-34/+17
2021-11-07Use an enum to record polarity in `clean::Impl`Noah Lev-23/+34
2021-11-07rustdoc: Refactor `Impl.{synthetic,blanket_impl}` into enumNoah Lev-36/+66
This change has two advantages: 1. It makes the possible states clearer, and it makes it impossible to construct invalid states, such as a blanket impl that is also an auto trait impl. 2. It shrinks the size of `Impl` a bit, since now there is only one field, rather than two.
2021-11-07Improve error when an .rlib can't be parsedJoshua Nelson-1/+28
This usually describes either an error in the compiler itself or some sort of IO error. Either way, we should report it to the user rather than just saying "crate not found". This only gives an error if the crate couldn't be loaded at all - if the compiler finds another .rlib or .rmeta file which was valid, it will continue to compile the crate. Example output: ``` error[E0785]: found invalid metadata files for crate `foo` --> bar.rs:3:24 | 3 | println!("{}", foo::FOO_11_49[0]); | ^^^ | = warning: failed to parse rlib '/home/joshua/test-rustdoc/libfoo.rlib': Invalid archive extended name offset ```
2021-11-07refactor: dedupe associated item visitationCaleb Cartwright-55/+35
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-56/+86
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-78/+117
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-06rustdoc: Remove redundant `Impl.span` fieldNoah Lev-12/+13
It can be computed on-demand in `Item::span()`.
2021-11-07Auto merge of #90348 - Amanieu:asm_feature_gates, r=joshtriplettbors-99/+194
Add features gates for experimental asm features This PR splits off parts of `asm!` into separate features because they are not ready for stabilization. Specifically this adds: - `asm_const` for `const` operands. - `asm_sym` for `sym` operands. - `asm_experimental_arch` for architectures other than x86, x86_64, arm, aarch64 and riscv. r? `@nagisa`
2021-11-07Rename functions reflect that inline const is also "typeck_child"Gary Guo-3/+3
2021-11-07Add a FIXME note about what's missingGary Guo-0/+34
2021-11-07Ensure closure requirements are proven for inline constGary Guo-0/+48
2021-11-07Add unit test for issue 78174Gary Guo-0/+72
2021-11-07Add unit test for issue 78132Gary Guo-0/+24
2021-11-07Give inline const separate DefKindGary Guo-4/+10
2021-11-07Restrict tests that use needs-asm-support to non-experimentalAmanieu d'Antras-5/+10
architectures
2021-11-07Auto merge of #90635 - matthiaskrgr:rustdoc_compl, r=GuillaumeGomezbors-5/+4
rustdoc: clippy::complexity fixes