summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2020-11-15Replace run_compiler with RunCompiler builder pattern.Darshan Kathiriya-2/+45
RunCompiler::new takes non-optional params, and optional params can be set using set_*field_name* method. finally `run` will forward all fields to `run_compiler`.
2020-11-15Don't re-export std::ops::ControlFlow in the compiler.Leonora Tindall-4/+3
2020-11-15change the order of type arguments on ControlFlowLeonora Tindall-2/+1
This allows ControlFlow<BreakType> which is much more ergonomic for common iterator combinator use cases.
2020-11-15Revert "Revert "resolve: Avoid "self-confirming" import resolutions in one ↵Mark Rousskov-2/+11
more case"" This reverts commit b20bce8ce54ea9d47c2e3eb0b17cbb6baf916ae2. It retains the test added in that commit as a check-pass test, intended to prevent future (unintentional) regressions.
2020-11-07Auto merge of #78146 - Mark-Simulacrum:revert-76605, r=petrochenkovbors-16/+86
[beta] Revert "Promote missing_fragment_specifier to hard error #75516" This reverts "Promote missing_fragment_specifier to hard error #75516" on just beta. I would like us to explore a more principled fix, perhaps along the lines `@petrochenkov` suggested in #76605, on master when we have more time to test it but I don't want us shipping the breakage in the meantime. I don't personally feel comfortable immediately backporting anything more than a revert here. cc `@matklad` This matches #77456 for 1.47 but targets 1.48 (current beta) instead. r? `@petrochenkov`
2020-11-06Revert "Remove missing_fragment_specifier lint"Mark Rousskov-0/+33
This reverts commit 5ba961018c482e050af908de60e4f8bd1a00f0ae.
2020-11-06Tweak `if let` suggestion to be more liberal with suggestion and to not ICEEsteban Küber-22/+28
Fix #77218. Fix #77238.
2020-11-06review commentsEsteban Küber-14/+10
2020-11-06Do not ICE with TraitPredicates containing [type error]Esteban Küber-6/+13
Fix #77919.
2020-11-06Disable MatchBranchSimplificationTomasz Miąsko-0/+7
This optimization can result in unsoundness, because it introduces additional uses of a place holding the discriminant value without ensuring that it is valid to do so.
2020-11-06Disable "optimization to avoid load of address" in InstCombineTomasz Miąsko-0/+5
2020-11-06Do not try to report on closures to avoid ICEYuki Okushi-0/+8
2020-11-06revert #75443 update mir validatorBastian Kauschke-77/+23
2020-11-06Do not ICE on invalid inputEsteban Küber-7/+13
2020-11-06Revert "Promote missing_fragment_specifier to hard error"Mark Rousskov-16/+53
This reverts commit 02eae432e7476a0686633a8c2b7cb1d5aab1bd2c.
2020-11-05Add delay_span_bug to no longer ICEkadmin-1/+7
2020-10-20rustc_parse: More precise spans for `tuple.0.0`Vadim Petrochenkov-7/+33
2020-10-08Move `EarlyOtherwiseBranch` to mir-opt-level 2Dylan MacKenzie-1/+1
This didn't have an effect in most cases, and is not trivially sound. Let it bake at `mir-opt-level=2` for a while.
2020-10-08Fix miscompile in SimplifyBranchSameSimon Vandel Sillesen-1/+2
2020-10-08Instruct lld that our @ files are posix-style, not WindowsMark Rousskov-0/+6
An upstream LLVM change changed behavior here to respect the host system quoting rules; previously the posix-style format was always used for @files.
2020-10-03Rollup merge of #77452 - Mark-Simulacrum:fix-symbol-v0, r=eddybJonas Schievink-0/+1
Permit ty::Bool in const generics for v0 mangling This should unbreak using new-symbol-mangling = true in config.toml (once it lands in beta anyway). Fixes #76365 (well, it will, but seems fine to close as soon as we have support) r? @eddyb (for mangling) but I'm okay with some other reviewer too :)
2020-10-03Rollup merge of #77421 - petrochenkov:globtravel, r=nagisaJonas Schievink-11/+2
Revert "resolve: Avoid "self-confirming" import resolutions in one more case" And remove the assert that https://github.com/rust-lang/rust/pull/70236 tried to avoid instead. Closes https://github.com/rust-lang/rust/issues/74556.
2020-10-03Rollup merge of #77251 - dtolnay:drop, r=Aaron1011Jonas Schievink-1/+30
Bypass const_item_mutation if const's type has Drop impl Follow-up to #75573. This PR disables the const_item_mutation lint in cases that the const has a Drop impl which observes the mutation. ```rust struct Log { msg: &'static str } const LOG: Log = Log { msg: "" }; impl Drop for Log { fn drop(&mut self) { println!("{}", self.msg); } } LOG.msg = "wow"; // prints "wow" ``` r? @Aaron1011
2020-10-02Auto merge of #77462 - jonas-schievink:rollup-m0rqdh5, r=jonas-schievinkbors-11/+87
Rollup of 12 pull requests Successful merges: - #76101 (Update RELEASES.md for 1.47.0) - #76739 (resolve: prohibit anon const non-static lifetimes) - #76811 (Doc alias name restriction) - #77405 (Add tracking issue of iter_advance_by feature) - #77409 (Add example for iter chain struct) - #77415 (Better error message for `async` blocks in a const-context) - #77423 (Add `-Zprecise-enum-drop-elaboration`) - #77432 (Use posix_spawn on musl targets) - #77441 (Fix AVR stack corruption bug) - #77442 (Clean up on example doc fixes for ptr::copy) - #77444 (Fix span for incorrect pattern field and add label) - #77453 (Stop running macOS builds on Azure Pipelines) Failed merges: r? `@ghost`
2020-10-02Rollup merge of #77444 - estebank:pat-field-label, r=davidtwcoJonas Schievink-1/+2
Fix span for incorrect pattern field and add label Address #73750.
2020-10-02Rollup merge of #77423 - ecstatic-morse:discriminant-switch-effect-config, ↵Jonas Schievink-0/+13
r=pnkfelix Add `-Zprecise-enum-drop-elaboration` Its purpose is to assist in debugging #77382 and #74551. Passing `-Zprecise-enum-drop-elaboration=no` will turn off the added precision that seems to be causing issues on some platforms. This assumes that we can reproduce #77382 on the latest master. I should have done this earlier. Oh well. cc @cuviper r? @pnkfelix
2020-10-02Rollup merge of #77415 - ecstatic-morse:const-checking-async-block, r=oli-obkJonas Schievink-3/+12
Better error message for `async` blocks in a const-context Improves the error message for the case in #77361. r? @oli-obk
2020-10-02Rollup merge of #76811 - GuillaumeGomez:doc-alias-name-restriction, ↵Jonas Schievink-7/+27
r=oli-obk,ollie27 Doc alias name restriction Fixes #76705.
2020-10-02Rollup merge of #76739 - ↵Jonas Schievink-0/+33
davidtwco:issue-75323-non-static-lifetime-in-anonconst, r=varkor resolve: prohibit anon const non-static lifetimes Fixes #75323, fixes #74447 and fixes #73375. This PR prohibits non-static lifetimes in anonymous constants when only the `min_const_generics` feature is enabled. ~~To do so, `to_region_vid`'s `bug!` had to be changed into a delayed bug, which unfortunately required providing it a `TyCtxt`.~~ --- ~~While I am happy with how the implementation of the error turned out in `rustc_passes::check_const`, emitting an error wasn't sufficient to avoid hitting the ICE later. I also tried implementing the error in `rustc_mir::transform::check_consts::validation` and that worked, but it didn't silence the ICE either. To silence the ICE, I changed it to a delayed bug which worked but was more invasive that I would have liked, and required I return an incorrect lifetime. It's possible that this check should be implemented earlier in the compiler to make the invasive changes unnecessary, but I wasn't sure where that would be and wanted to get some feedback first.~~ The approach taken by this PR has been changed to implement the error in name resolution, which ended up being much simpler. cc @rust-lang/wg-const-eval r? @lcnr
2020-10-02Forbid some characters to be used as doc aliasGuillaume Gomez-7/+27
2020-10-02validate: skip debuginfoJonas Schievink-15/+14
2020-10-02validate: storage must be allocated on local useJonas Schievink-3/+29
2020-10-02Permit ty::Bool in const generics for v0 manglingMark Rousskov-0/+1
2020-10-02resolve: prohibit anon const non-static lifetimesDavid Wood-0/+33
This commit modifies name resolution to emit an error when non-static lifetimes are used in anonymous constants when the `min_const_generics` feature is enabled. Signed-off-by: David Wood <david@davidtw.co>
2020-10-02Auto merge of #77396 - wesleywiser:disable-simplifyarmidentity, r=oli-obkbors-1/+6
Disable the SimplifyArmIdentity mir-opt The optimization still has some bugs that need to be worked out such as #77359. We can try re-enabling this again after the known issues are resolved. r? `@oli-obk`
2020-10-02Fix span for incorrect pattern field and add labelEsteban Küber-1/+2
2020-10-01Disable the SimplifyArmIdentity mir-optWesley Wiser-1/+6
The optimization still has some bugs that need to be worked out such as #77359. We can try re-enabling this again after the known issues are resolved.
2020-10-02Rollup merge of #77375 - petrochenkov:inherext, r=oli-obkYuki Okushi-0/+1
rustc_metadata: Do not forget to encode inherent impls for foreign types So I tried to move FFI interface for LLVM from `rustc_codegen_llvm` to `rustc_llvm` and immediately encountered this fascinating issue. Fixes https://github.com/rust-lang/rust/issues/46665.
2020-10-02Rollup merge of #76851 - fusion-engineering-forks:fixme-nonzero, r=petrochenkovYuki Okushi-17/+20
Fix 'FIXME' about using NonZeroU32 instead of u32. It was blocked by #58732 (const fn NonZeroU32::new), which is fixed now.
2020-10-02Revert "resolve: Avoid "self-confirming" import resolutions in one more case"Vadim Petrochenkov-11/+2
2020-10-01Fixme with link for re-enabling const mutation lint for Drop constsDavid Tolnay-2/+9
2020-10-01Add `-Zprecise-enum-drop-elaboration`Dylan MacKenzie-0/+13
Its purpose is to assist in debugging #77382 and #74551.
2020-10-01Give better const-checking error for `async` blocksDylan MacKenzie-3/+12
2020-10-01Add note about possible future improvementMara Bos-0/+2
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-10-01Auto merge of #74839 - alarsyo:multiple_return_terminators, r=oli-obkbors-0/+41
Implement multiple return terminator optimization Closes #72022
2020-10-01Implement multiple return terminators optimizationAntoine Martin-0/+41
2020-10-01Auto merge of #77354 - ecstatic-morse:const-checking-moar-errors, r=oli-obkbors-247/+244
Overhaul const-checking diagnostics The primary purpose of this PR was to remove `NonConstOp::STOPS_CONST_CHECKING`, which causes any additional errors found by the const-checker to be silenced. I used this flag to preserve diagnostic parity with `qualify_min_const_fn.rs`, which has since been removed. However, simply removing the flag caused a deluge of errors in some cases, since an error would be emitted any time a local or temporary had a wrong type. To remedy this, I added an alternative system (`DiagnosticImportance`) to silence additional error messages that were likely to distract the user from the underlying issue. When an error of the highest importance occurs, all less important errors are silenced. When no error of the highest importance occurs, all less important errors are emitted after checking is complete. Following the suggestions from the important error is usually enough to fix the less important errors, so this should lead to better UX most of the time. There's also some unrelated diagnostics improvements in this PR isolated in their own commits. Splitting them out would be possible, but a bit of a pain. This isn't as tidy as some of my other PRs, but it should *only* affect diagnostics, never whether or not something passes const-checking. Note that there are a few trivial exceptions to this, like banning `Yield` in all const-contexts, not just `const fn`. As always, meant to be reviewed commit-by-commit. r? `@oli-obk`
2020-09-30Warn on method call mutating const, even if it has destructorDavid Tolnay-1/+1
2020-09-30Skip dropck::check_drop_impl in is_const_item_without_destructorDavid Tolnay-1/+2
adt_destructor by default also validates the Drop impl using dropck::check_drop_impl, which contains an expect_local(). This leads to ICE in check_const_item_mutation if the const's type is not a local type. thread 'rustc' panicked at 'DefId::expect_local: `DefId(5:4805 ~ alloc[d7e9]::vec::{impl#50})` isn't local', compiler/rustc_span/src/def_id.rs:174:43 stack backtrace: 0: rust_begin_unwind 1: rustc_span::def_id::DefId::expect_local::{{closure}} 2: rustc_typeck::check::dropck::check_drop_impl 3: rustc_middle::ty::util::<impl rustc_middle::ty::context::TyCtxt>::calculate_dtor::{{closure}} 4: rustc_middle::ty::trait_def::<impl rustc_middle::ty::context::TyCtxt>::for_each_relevant_impl 5: rustc_middle::ty::util::<impl rustc_middle::ty::context::TyCtxt>::calculate_dtor 6: rustc_typeck::check::adt_destructor 7: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::adt_destructor>::compute 8: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl 9: rustc_query_system::query::plumbing::get_query_impl 10: rustc_mir::transform::check_const_item_mutation::ConstMutationChecker::is_const_item_without_destructor
2020-09-30Simplify defid destructor checkDavid Tolnay-1/+1