about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2020-01-15Promoteds can contain raw pointers, but these must still only point to ↵Oliver Scherer-4/+4
immutable allocations
2020-01-14Use unified dataflow framework in `check_consts`Dylan MacKenzie-10/+12
2020-01-14Add unreachable propagation mir optimization passKonstantinos Triantafyllou-0/+110
2020-01-13Use TraitQueryMode::Canonical when testing predicates in const propAaron Hill-0/+16
2020-01-13Fix typoAaron Hill-1/+1
2020-01-13Don't run const propagation on items with inconsistent boundsAaron Hill-0/+25
Using `#![feature(trivial_bounds)]`, it's possible to write functions with unsatisfiable 'where' clauses, making them uncallable. However, the user can act as if these 'where' clauses are true inside the body of the function, leading to code that would normally be impossible to write. Since const propgation can run even without any user-written calls to a function, we need to explcitly check for these uncallable functions.
2020-01-12Turn off const propagation of ref takingWesley Wiser-20/+3
Fixes #67529 Fixes #67640 Fixes #67641 Fixes #67862
2020-01-12Auto merge of #67901 - matthewjasper:split-mir-build, r=nagisabors-7/+4
Split MIR building into its own crate This moves `rustc_mir::{build, hair, lints}` to `rustc_mir_build`. The new crate only has a `provide` function as it's public API. Based on #67898 cc @Centril @rust-lang/compiler r? @oli-obk
2020-01-12Split `rustc_mir::{build, hair, lints}` into their own crateMatthew Jasper-7/+4
2020-01-12Rollup merge of #68045 - Centril:liberate-lints, r=Mark-SimulacrumMazdak Farrokhzad-5/+5
Move more of `rustc::lint` into `rustc_lint` Based on https://github.com/rust-lang/rust/pull/67806. Here we try to consolidate more of the linting infra into `rustc::lint`. Some high-level notes: - We now store an `Lrc<dyn Any + Send + Sync>` as opposed to `Lrc<LintStore>` in the `GlobalCtxt`. This enables us to avoid referring to the type, breaking a cyclic dependency, and so we can move things from `rustc::lint` to `rustc_lint`. - `in_derive_expansion` is, and needs to, be moved as a method on `Span`. - We reduce the number of ways on `tcx` to emit a lint so that the developer UX is more streamlined. - `LintLevelsBuilder` is moved to `rustc_lint::levels`, leaving behind `LintLevelMap/Set` in a purified form due to current constraints (hopefully fixable in the future after https://github.com/rust-lang/rust/pull/68133). - `struct_lint_level` is moved to `rustc::lint` due to current dependency constraints. - `rustc::lint::context` is moved to `rustc_lint::context`. - The visitors in `rustc::lint` are moved to `rustc_lint::passes`.
2020-01-11Auto merge of #67000 - spastorino:remove-promoted-from-place, r=oli-obkbors-206/+208
Promote references to constants instead of statics r? @oli-obk
2020-01-11Rollup merge of #68114 - ecstatic-morse:fix-feature-gating, r=CentrilMazdak Farrokhzad-1/+15
Don't require `allow_internal_unstable` unless `staged_api` is enabled. #63770 changed `qualify_min_const_fn` to require `allow_internal_unstable` for *all* crates that used an unstable feature, regardless of whether `staged_api` was enabled or the `fn` that used that feature was stably const. In practice, this meant that every crate in the ecosystem that wanted to use nightly features added `#![feature(const_fn)]`, which skips `qualify_min_const_fn` entirely. After this PR, crates that do not have `#![feature(staged_api)]` will only need to enable the feature they are interested in. For example, `#![feature(const_if_match)]` will be enough to enable `if` and `match` in constants. Crates with `staged_api` (e.g., `libstd`) require `#[allow_internal_unstable]` to be added to a function if it uses nightly features unless that function is also marked `#[rustc_const_unstable]`. This prevents proliferation of `#[allow_internal_unstable]` into functions that are not callable in a `const` context on stable. r? @oli-obk (author of #63770) cc @Centril
2020-01-11reduce diversity in linting methodsMazdak Farrokhzad-5/+5
2020-01-10Expand commentecstatic-morse-1/+2
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-01-11Rollup merge of #68079 - varkor:E0013-clarify, r=CentrilMazdak Farrokhzad-5/+7
Clarify suggestion for E0013 Fixes https://github.com/rust-lang/rust/issues/68038.
2020-01-11simplify feature_err importsMazdak Farrokhzad-1/+1
2020-01-10Only require `allow_internal_unstable` for stable `const fn`Dylan MacKenzie-1/+14
2020-01-10Clarify suggestion for E0013varkor-5/+7
2020-01-10Errors in promoteds may only cause lints not hard errorsOliver Scherer-5/+13
2020-01-10Do not store lint_rootSantiago Pastorino-9/+13
2020-01-10Use re_erased instead of re_staticSantiago Pastorino-3/+3
2020-01-10Remove PlaceBase enum and make Place base field be local: LocalSantiago Pastorino-126/+87
2020-01-10Remove Static from PlaceBaseSantiago Pastorino-53/+23
2020-01-10Remove StaticKindSantiago Pastorino-3/+3
2020-01-10Remove StaticKind::PromotedSantiago Pastorino-3/+0
2020-01-10Add promoted_operand closure to reuse code across differentSantiago Pastorino-54/+20
2020-01-10Promote `Argument`s to constants instead of staticsSantiago Pastorino-17/+19
2020-01-10Promote `Repeat`s to constants instead of staticsSantiago Pastorino-4/+19
2020-01-10Promote `Ref`s to constants instead of staticSantiago Pastorino-42/+121
2020-01-10Rollup merge of #67501 - oli-obk:test-slice-patterns, r=RalfJungMazdak Farrokhzad-1/+2
Reduce special treatment for zsts addresses https://github.com/rust-lang/rust/pull/67467#discussion_r360650846 cc @RalfJung
2020-01-10Rollup merge of #67967 - JohnTitor:fix-ice-0107, r=matthewjasperYuki Okushi-1/+7
Delay bug to prevent ICE in MIR borrowck Fixes #67947 r? @matthewjasper
2020-01-09Rollup merge of #67979 - Centril:hir-cleanup, r=ZoxcMazdak Farrokhzad-4/+9
Move `intravisit` => `rustc_hir` + misc cleanup Working towards https://github.com/rust-lang/rust/issues/65031. This should eventually enable getting rid of rustc as a dependency in various passes (e.g. lints). cc https://github.com/rust-lang/rust/pull/67806 (this also facilitates liberating lints from tcx) cc https://github.com/rust-lang/rust/pull/67922 (some other dep reductions) r? @Zoxc
2020-01-08normalize rustc::hir::intravisit importsMazdak Farrokhzad-2/+2
2020-01-08intravisit: abstract over HIR MapMazdak Farrokhzad-2/+7
2020-01-09Delay bug to prevent ICE in MIR borrowckYuki Okushi-1/+7
2020-01-09Rollup merge of #67781 - cjgillot:passes-const, r=oli-obkYuki Okushi-7/+10
Move `is_min_const_fn` query to librustc_mir. The only two uses of the associated methods are in `librustc_mir` and `librustdoc`. Please tell me if there is a better choice. cc #65031
2020-01-08Move `is_min_const_fn` query to librustc_mir.Camille GILLOT-7/+10
The only two uses of the associated methods are in librustc_mir and librustdoc. Please tell me if there is a better choice.
2020-01-08- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}Mazdak Farrokhzad-10/+10
- remove syntax::{help!, span_help!, span_note!} - remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!} - lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints - inline syntax::{struct_span_warn!, diagnostic_used!} - stringify_error_code! -> error_code! & use it more. - find_plugin_registrar: de-fatalize an error - de-fatalize metadata errors - move type_error_struct! to rustc_typeck - struct_span_err! -> rustc_errors
2020-01-07Automatically prefer integer addresses for zst MPlaceOliver Scherer-1/+2
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-28/+28
2020-01-05simplify reexports in rustc::hirMazdak Farrokhzad-1/+1
2020-01-04Auto merge of #67803 - Centril:librustc_hir, r=Zoxcbors-5/+4
Extract `rustc_hir` out of `rustc` The new crate contains: ```rust pub mod def; pub mod def_id; mod hir; pub mod hir_id; pub mod itemlikevisit; pub mod pat_util; pub mod print; mod stable_hash_impls; pub use hir::*; pub use hir_id::*; pub use stable_hash_impls::HashStableContext; ``` Remains to be done in follow-up PRs: - Move `rustc::hir::map` into `rustc_hir_map` -- this has to be a separate crate due to the `dep_graph` (blocked on https://github.com/rust-lang/rust/pull/67761). - Move references to `rustc::hir` to `rustc_hir` where possible. cc https://github.com/rust-lang/rust/issues/65031 r? @Zoxc
2020-01-04Rollup merge of #67137 - anp:tracked-panic-internals, r=eddybDylan DPC-0/+1
libstd uses `core::panic::Location` where possible. cc @eddyb
2020-01-04Update ABI in const impls of panic_fn/begin_panic_fn.Adam Perry-0/+1
2020-01-04DefId{Map,Set} -> rustc::hir::def_idMazdak Farrokhzad-2/+1
2020-01-04canonicalize FxHash{Map,Set} importsMazdak Farrokhzad-2/+2
2020-01-04extract rustc::middle::codegen_fn_attrsMazdak Farrokhzad-1/+1
2020-01-04Rollup merge of #67822 - wesleywiser:revert_67676, r=oli-obkGuillaume Gomez-63/+7
Revert `const_err` lint checking of casts Reverts part of #67676 r? @oli-obk cc @SimonSapin
2020-01-04Rollup merge of #67786 - Centril:canon-span, r=petrochenkovMazdak Farrokhzad-6/+6
Nix reexports from `rustc_span` in `syntax` Remove reexports `syntax::{source_map, symbol, edition}` and use `rustc_span` paths directly. r? @petrochenkov
2020-01-02Revert `const_err` lint checking of castsWesley Wiser-63/+7
Reverts part of #67676