about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2021-10-11Rollup merge of #89710 - sireliah:e0482, r=GuillaumeGomezMatthias Krüger-1/+74
Add long explanation for error E0482 This is longer explanation for error E0482 in the #61137. Please take a look and leave some feedback!
2021-10-11Rollup merge of #89675 - oli-obk:type_checker, r=davidtwcoMatthias Krüger-81/+53
Re-use TypeChecker instead of passing around some of its fields In the future (for lazy TAIT) we will need more of its fields, but even ignoring that, this change seems reasonable on its own to me.
2021-10-11Rollup merge of #89643 - cjgillot:overlap, r=matthewjasperMatthias Krüger-45/+65
Fix inherent impl overlap check. The current implementation of the overlap check was slightly buggy, and unified the wrong connected component in the `ids.len() <= 1` case. This became visible in another PR which changed the iteration order of items. r? ``@matthewjasper`` since you reviewed the other PR.
2021-10-11Rollup merge of #89471 - nbdd0121:const3, r=fee1-deadMatthias Krüger-18/+26
Use Ancestory to check default fn in const impl instead of comparing idents Fixes https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Const.20trait.20impl.20inside.20macro
2021-10-11Clarify the error descriptionssireliah-17/+22
2021-10-11Use Ancestory to check default fn in const impl instead of comparing identsGary Guo-18/+26
2021-10-11Auto merge of #83908 - Flying-Toast:master, r=davidtwcobors-0/+110
Add enum_intrinsics_non_enums lint There is a clippy lint to prevent calling [`mem::discriminant`](https://doc.rust-lang.org/std/mem/fn.discriminant.html) with a non-enum type. I think the lint is worthy of being included in rustc, given that `discriminant::<T>()` where `T` is a non-enum has an unspecified return value, and there are no valid use cases where you'd actually want this. I've also made the lint check [variant_count](https://doc.rust-lang.org/core/mem/fn.variant_count.html) (#73662). closes #83899
2021-10-11Auto merge of #89767 - GuillaumeGomez:rollup-sczixhk, r=GuillaumeGomezbors-1/+1
Rollup of 7 pull requests Successful merges: - #89655 (bootstrap: don't use `--merges` to look for commit hashes for downloading artifacts) - #89726 (Add #[must_use] to alloc constructors) - #89729 (Add #[must_use] to core and std constructors) - #89743 (Fix RUSTC_LOG handling) - #89753 (Add #[must_use] to from_value conversions) - #89754 (Cleanup .item-table CSS) - #89761 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-11Rollup merge of #89743 - matthewjasper:env-log-fix, r=jyn514Guillaume Gomez-1/+1
Fix RUSTC_LOG handling Rustc was incorrectly reading the value of `RUSTC_LOG` as the environment vairable with the logging configuration, rather than the logging configuration itself.
2021-10-11Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkovbors-71/+53
Apply clippy suggestions for rustc and core
2021-10-11Add enum_intrinsics_non_enums lintFlying-Toast-0/+110
2021-10-11Remove unnecessary variableClemens Wasser-2/+1
2021-10-11Auto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiserbors-41/+116
Create more accurate debuginfo for vtables. Before this PR all vtables would have the same name (`"vtable"`) in debuginfo. Now they get an unambiguous name that identifies the implementing type and the trait that is being implemented. This is only one of several possible improvements: - This PR describes vtables as arrays of `*const u8` pointers. It would nice to describe them as structs where function pointer is represented by a field with a name indicative of the method it maps to. However, this requires coming up with a naming scheme that avoids clashes between methods with the same name (which is possible if the vtable contains multiple traits). - The PR does not update the debuginfo we generate for the vtable-pointer field in a fat `dyn` pointer. Right now there does not seem to be an easy way of getting ahold of a vtable-layout without also knowing the concrete self-type of a trait object. r? `@wesleywiser`
2021-10-11Rollup merge of #89722 - jkugelman:cannonical-typo, r=joshtriplettMatthias Krüger-7/+7
Fix spelling: Cannonical -> Canonical
2021-10-10Auto merge of #89739 - matthiaskrgr:rollup-kskwqy5, r=matthiaskrgrbors-0/+8
Rollup of 11 pull requests Successful merges: - #88374 (Fix documentation in Cell) - #88713 (Improve docs for int_log) - #89428 (Feature gate the non_exhaustive_omitted_patterns lint) - #89438 (docs: `std::hash::Hash` should ensure prefix-free data) - #89520 (Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui) - #89705 (Cfg hide no_global_oom_handling and no_fp_fmt_parse) - #89713 (Fix ABNF of inline asm options) - #89718 (Add #[must_use] to is_condition tests) - #89719 (Add #[must_use] to char escape methods) - #89720 (Add #[must_use] to math and bit manipulation methods) - #89735 (Stabilize proc_macro::is_available) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-10Fix RUSTC_LOG handlingMatthew Jasper-1/+1
Rustc was incorrectly reading the value of `RUSTC_LOG` as the environment vairable with the logging configuration, rather than the logging configuration itself.
2021-10-10Rollup merge of #89428 - DevinR528:reachable-featuregate, r=Nadrieril,camelidMatthias Krüger-0/+8
Feature gate the non_exhaustive_omitted_patterns lint Fixes https://github.com/rust-lang/rust/issues/89374 Add the machinery to gate the new `non_exhaustive_omitted_patterns` lint. relates to https://github.com/rust-lang/rust/pull/89105 and https://github.com/rust-lang/rust/pull/89423
2021-10-10Auto merge of #89633 - rhysd:issue-65230, r=petrochenkovbors-2/+12
Show detailed expected/found types in error message when trait paths are the same Fixes #65230. ### Issue solved by this PR ```rust trait T { type U; fn f(&self) -> Self::U; } struct X<'a>(&'a mut i32); impl<'a> T for X<'a> { type U = &'a i32; fn f(&self) -> Self::U { self.0 } } fn main() {} ``` Compiler generates the following note: ``` note: ...so that the types are compatible --> test.rs:10:28 | 10 | fn f(&self) -> Self::U { | ____________________________^ 11 | | self.0 12 | | } | |_____^ = note: expected `T` found `T` ``` This note is not useful since the expected type and the found type are the same. ### How this PR solve the issue When the expected type and the found type are exactly the same in string representation, the note falls back to the detailed string representation of trait ref: ``` note: ...so that the types are compatible --> test.rs:10:28 | 10 | fn f(&self) -> Self::U { | ____________________________^ 11 | | self.0 12 | | } | |_____^ = note: expected `<X<'a> as T>` found `<X<'_> as T>` ``` So that a user can notice what was different between the expected one and the found one.
2021-10-10Remove for loop rangeClemens Wasser-2/+2
2021-10-10Apply clippy suggestionsClemens Wasser-69/+52
2021-10-10Auto merge of #88952 - skrap:add-armv7-uclibc, r=nagisabors-3/+29
Add new tier-3 target: armv7-unknown-linux-uclibceabihf This change adds a new tier-3 target: armv7-unknown-linux-uclibceabihf This target is primarily used in embedded linux devices where system resources are slim and glibc is deemed too heavyweight. Cross compilation C toolchains are available [here](https://toolchains.bootlin.com/) or via [buildroot](https://buildroot.org). The change is based largely on a previous PR #79380 with a few minor modifications. The author of that PR was unable to push the PR forward, and graciously allowed me to take it over. Per the [target tier 3 policy](https://github.com/rust-lang/rfcs/blob/master/text/2803-target-tier-policy.md), I volunteer to be the "target maintainer". This is my first PR to Rust itself, so I apologize if I've missed things!
2021-10-10Fix spelling: Cannonical -> CanonicalJohn Kugelman-7/+7
2021-10-09Add long explanation for error E0482sireliah-1/+69
2021-10-09Auto merge of #89343 - Mark-Simulacrum:no-args-queries, r=cjgillotbors-48/+74
Refactor fingerprint reconstruction This PR replaces can_reconstruct_query_key with fingerprint_style, which returns the style of the fingerprint for that query. This allows us to avoid trying to extract a DefId (or equivalent) from keys which *are* reconstructible because they're () but not as DefIds. This is done with the goal of fixing -Zdump-dep-graph, which seems to have broken a while ago (I didn't try to bisect). Currently even on a `fn main() {}` file it'll ICE (you need to also pass -Zquery-dep-graph for it to work at all), and this patch indirectly fixes the cause of that ICE. This also adds a test for it continuing to work.
2021-10-09Rollup merge of #89641 - asquared31415:asm-feature-attr-regs, r=oli-obkMatthias Krüger-78/+129
make #[target_feature] work with `asm` register classes Fixes #89289
2021-10-09Rollup merge of #89634 - hawkw:eliza/enable-err-warn, r=oli-obkMatthias Krüger-16/+18
rustc_driver: Enable the `WARN` log level by default This commit changes the `tracing_subscriber` initialization in `rustc_driver` so that the `WARN` verbosity level is enabled by default when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env variable is set, the filter string in the environment variable is honored, instead. Fixes #76824 Closes #89623 cc ``@eddyb,`` ``@oli-obk``
2021-10-09Rollup merge of #89605 - camelid:fix-version, r=nagisaMatthias Krüger-1/+1
Fix stabilization version for `bindings_after_at` According to the release notes and its PR milestone, it was stabilized in 1.56.0.
2021-10-08Add feature gate to non_exhaustive_omitted_patterns lintDevin Ragotzy-0/+8
Actually add the feature to the lints ui test Add tracking issue to the feature declaration Rename feature gate to non_exhaustive_omitted_patterns_lint Add more omitted_patterns lint feature gate
2021-10-08Auto merge of #89683 - GuillaumeGomez:rollup-q2mjd9m, r=GuillaumeGomezbors-56/+65
Rollup of 6 pull requests Successful merges: - #86506 (Don't normalize xform_ret_ty during method candidate assembly ) - #89538 (Make rustdoc not highlight `->` and `=>` as operators) - #89649 (clippy::complexity fixes) - #89668 (Cfg hide more conditions for core and alloc) - #89669 (Remove special-casing of never primitive in rustdoc-json-types) - #89672 (Remove unwrap_or! macro) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-08Rollup merge of #89672 - klensy:unwrap-or-macro, r=jackh726Guillaume Gomez-17/+8
Remove unwrap_or! macro Removes `unwrap_or!` macro and replaces it with `match`. It's kinda cleanup, as rustc_ast not the best place for this macro and this is used only in 2 places anyway.
2021-10-08Rollup merge of #89649 - matthiaskrgr:clippycompl, r=jyn514Guillaume Gomez-29/+22
clippy::complexity fixes
2021-10-08Rollup merge of #86506 - b-naber:gen_trait_impl_inconsistent, r=jackh726Guillaume Gomez-10/+35
Don't normalize xform_ret_ty during method candidate assembly Fixes https://github.com/rust-lang/rust/issues/85671 Normalizing the return type of a method candidate together with the expected receiver type of the method can lead to valid method candidates being rejected during probing. Specifically in the example of the fixed issue we have a `self_ty` of the form `&A<&[Coef]>` whereas the `impl_ty` of the method would be `&A<_>`, if we normalize the projection in the return type we unify the inference variable with `Cont`, which will lead us to reject the candidate in the sup type check in `consider_probe`. Since we don't actually need the normalized return type during candidate assembly, we postpone the normalization until we consider candidates in `consider_probe`.
2021-10-08Auto merge of #89666 - ↵bors-4/+13
rusticstuff:disable_new_llvm_pass_manager_on_s390x_take_two, r=nagisa Default to disabling the new pass manager for the s390x arch targets. This hack disables the new LLVM pass manager by default for s390x arch targets until the performance issues are fixed (see #89609). The command line option `-Z new-llvm-pass-manager=(yes|no)` continues to take precedence over this default.
2021-10-08clippy::complexity fixesMatthias Krüger-29/+22
2021-10-08Directly call relate_types function instead of having a method wrapperOli Scherer-37/+26
2021-10-08Re-use TypeChecker instead of passing around some of its fieldsOli Scherer-48/+31
2021-10-08remove unwrap_or! macroklensy-17/+8
2021-10-09Show detailed expected/found types in error message when trait paths are the ↵rhysd-2/+12
same
2021-10-08Auto merge of #89644 - matthiaskrgr:clippy_perf_okt, r=jyn514bors-3/+3
some clippy::perf fixes
2021-10-08Default to disabling the new pass manager for the s390x targets.Hans Kratz-4/+13
2021-10-08Auto merge of #89576 - tom7980:issue-89275-fix, r=estebankbors-17/+37
Prevent error reporting from outputting a recursion error if it finds an ambiguous trait impl during suggestions Closes #89275 This fixes the compiler reporting a recursion error during another already in progress error by trying to make a conversion method suggestion and encounters ambiguous trait implementations that can convert a the original type into a type that can then be recursively converted into itself via another method in the trait. Updated OverflowError struct to be an enum so I could differentiate between passes - it's no longer a ZST but I don't think that should be a problem as they only generate when there's an error in compiling code anyway
2021-10-08Auto merge of #89619 - michaelwoerister:incr-vtables, r=nagisabors-82/+84
Turn vtable_allocation() into a query This PR removes the untracked vtable-const-allocation cache from the `tcx` and turns the `vtable_allocation()` method into a query. The change is pretty straightforward and should be backportable without too much effort. Fixes https://github.com/rust-lang/rust/issues/89598.
2021-10-08dont normalize return type during candidate assembly in method probingb-naber-10/+35
2021-10-08Create more accurate debuginfo for vtables.Michael Woerister-41/+116
Before this commit all vtables would have the same name "vtable" in debuginfo. Now they get a name that identifies the implementing type and the trait that is being implemented.
2021-10-07Rollup merge of #89622 - m-ou-se:debug-assert-2021, r=estebankJubilee-4/+22
Use correct edition for panic in [debug_]assert!(). See https://github.com/rust-lang/rust/issues/88638#issuecomment-915472783
2021-10-07Rollup merge of #89476 - cjgillot:expn-id, r=petrochenkovJubilee-19/+40
Correct decoding of foreign expansions during incr. comp. Fixes https://github.com/rust-lang/rust/issues/74946 The original issue was due to a wrong assertion in `expn_hash_to_expn_id`. The secondary issue was due to a mismatch between the encoding and decoding paths for expansions that are created after the TyCtxt is created.
2021-10-07Rollup merge of #89025 - ricobbe:raw-dylib-link-ordinal, r=michaelwoeristerJubilee-17/+60
Implement `#[link_ordinal(n)]` Allows the use of `#[link_ordinal(n)]` with `#[link(kind = "raw-dylib")]`, allowing Rust to link against DLLs that export symbols by ordinal rather than by name. As long as the ordinal matches, the name of the function in Rust is not required to match the name of the corresponding function in the exporting DLL. Part of #58713.
2021-10-07Rollup merge of #88137 - joshtriplett:osx-strip-symbols-no-option, ↵Jubilee-12/+10
r=michaelwoerister On macOS, make strip="symbols" not pass any options to strip This makes the output with `strip="symbols"` match the result of just calling `strip` on the output binary, minimizing the size of the binary.
2021-10-07Rollup merge of #87918 - mikebenfield:pr-afdo, r=nikicJubilee-9/+75
Enable AutoFDO. This largely involves implementing the options debug-info-for-profiling and profile-sample-use and forwarding them on to LLVM. AutoFDO can be used on x86-64 Linux like this: rustc -O -Clink-arg='Wl,--no-rosegment' -Cdebug-info-for-profiling main.rs -o main perf record -b ./main create_llvm_prof --binary=main --out=code.prof rustc -O -Cprofile-sample-use=code.prof main.rs -o main2 Now `main2` will have feedback directed optimization applied to it. The create_llvm_prof tool can be obtained from this github repository: https://github.com/google/autofdo The option -Clink-arg='Wl,--no-rosegment' is necessary to avoid lld putting an extra RO segment before the executable code, which would make the binary silently incompatible with create_llvm_prof.
2021-10-07Fix inherent impl overlap check.Camille GILLOT-45/+65