about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2020-01-15wrap expr id into GeneratorInteriorTypeCausecsmoe-7/+7
2020-01-14Add test for `ResultsCursor`Dylan MacKenzie-0/+25
This is a unit test that ensures the `seek` functions work correctly.
2020-01-14Avoid calling tcx.hir().get() on CRATE_HIR_IDAaron Hill-1/+1
This was causing an ICE when enabling trace logging for an unrelated module, since the arguments to `trace!` ended up getting evaluated
2020-01-15update async-await send/sync testcsmoe-27/+22
2020-01-14suggest to limit lifetime of temporary borrow with letcsmoe-1/+1
2020-01-14record generoator interior exprs in typecktablecsmoe-6/+41
2020-01-14Code review changes and fix rustdoc test.Ben Lewis-5/+5
2020-01-14perf: eagerly convert literals to consts, this avoids creating loads on ↵Ben Lewis-3/+40
unevaluated consts which requires a lot of unnecessary work to evaluate them further down the line.
2020-01-13Use TraitQueryMode::Canonical when testing predicates in const propAaron Hill-13/+49
2020-01-13Explain fold_listMarkus Westerlind-0/+5
2020-01-12Diagnostics should not end with a full stopvarkor-3/+3
2020-01-12Diagnostics should start lowercasevarkor-1/+1
2020-01-12Auto merge of #67901 - matthewjasper:split-mir-build, r=nagisabors-222/+237
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-222/+237
2020-01-12Rollup merge of #68089 - lzutao:revert-remote_item, r=sfacklerMazdak Farrokhzad-0/+1
Unstabilize `Vec::remove_item` As concerned by @kornelski, @LukasKalbertodt, and @gnzlbg in #40062. Reverts #67727
2020-01-12Rollup merge of #68045 - Centril:liberate-lints, r=Mark-SimulacrumMazdak Farrokhzad-2241/+410
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-12Rollup merge of #67867 - matthewjasper:opaque-assoc-lookup, r=oli-obkMazdak Farrokhzad-1/+1
Correctly check for opaque types in `assoc_ty_def` Closes #67856
2020-01-11use winapi for non-stdlib Windows bindingsAndy Russell-1/+0
2020-01-11Move some queries from rustc::ty to librustc_passes.Camille GILLOT-354/+2
2020-01-11Auto merge of #67000 - spastorino:remove-promoted-from-place, r=oli-obkbors-217/+104
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/+0
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-11Use Arena for interningJohn Kåre Alsaker-21/+14
2020-01-11Lift using interners instead of in_arenaJohn Kåre Alsaker-17/+22
2020-01-11pacify the parallel compilerMazdak Farrokhzad-2/+3
2020-01-11move rustc::lint::{context, passes} to rustc_lint.Mazdak Farrokhzad-1589/+49
Also do some cleanup of the interface.
2020-01-11{rustc::lint -> rustc_lint}::internalMazdak Farrokhzad-242/+0
2020-01-11lints: promote levels.rs to lint.rs & extract passes.rsMazdak Farrokhzad-13/+16
2020-01-11inline maybe_lint_level_rootMazdak Farrokhzad-14/+6
2020-01-11move struct_lint_level to levels.rsMazdak Farrokhzad-165/+161
2020-01-11move LintSource to levelsMazdak Farrokhzad-34/+33
2020-01-11move logic to LintLevelsBuilderMazdak Farrokhzad-48/+36
2020-01-11GlobalCtxt: Erase `LintStore` type.Mazdak Farrokhzad-3/+7
2020-01-11reduce diversity in linting methodsMazdak Farrokhzad-29/+4
2020-01-11move in_derive_expansion as Span methodMazdak Farrokhzad-11/+2
2020-01-11canonicalize some lint importsMazdak Farrokhzad-30/+32
2020-01-11Revert "Rollup merge of #67727 - Dylan-DPC:stabilise/remove_item, ↵Lzu Tao-0/+1
r=alexcrichton" This reverts commit 4ed415b5478c74094c2859abfddb959588cd6bb1, reversing changes made to 3cce950743e8aa74a4378dfdefbbc80223a00865.
2020-01-11Rollup merge of #67806 - Centril:splitsynmore, r=petrochenkovMazdak Farrokhzad-777/+140
Extract `rustc_ast_passes`, move gating, & refactor linting Based on https://github.com/rust-lang/rust/pull/67770. This PR extracts a crate `rustc_ast_passes`: - `ast_validation.rs`, which is contributed by `rustc_passes` (now only has HIR based passes) -- the goal here is to improve recompilation of the parser, - `feature_gate.rs`, which is contributed by `syntax` and performs post-expansion-gating & final erroring for pre-expansion gating, - `show_span`, which is contributed by `syntax`. To facilitate this, we first have to also: - Move `{leveled_}feature_err{_err}` from `syntax::feature_gate::check` into `rustc_session::parse`. - Move `get_features` into `rustc_parse::config`, the only place it is used. - Move some some lint datatypes and traits, e.g. `LintBuffer`, `BufferedEarlyLint`, `BuiltinLintDiagnostics`, `LintPass`, and `LintArray` into `rustc_session::lint`. - Move all the hard-wired lint `static`s into `rustc_session::lint::builtin`.
2020-01-10Remove unnecessary `const_fn` feature gatesDylan MacKenzie-1/+0
This flag opts out of the min-const-fn checks entirely, which is usually not what we want. The few cases where the flag is still necessary have been annotated.
2020-01-11nix syntax::early_buffered_lintsMazdak Farrokhzad-1/+1
2020-01-11move {rustc -> rustc_session}::lint::builtinMazdak Farrokhzad-510/+1
2020-01-11prepare moving HardwiredLints to rustc_sessionMazdak Farrokhzad-174/+133
2020-01-11buffered lint infra -> rustc_sessionMazdak Farrokhzad-90/+7
2020-01-11prepare for moving BuiltinLintDiagnostics to rustc_sessionMazdak Farrokhzad-75/+71
2020-01-11Remove unused derivesMazdak Farrokhzad-2/+2
2020-01-11simplify feature_err importsMazdak Farrokhzad-3/+3
2020-01-10Auto merge of #65241 - tmiasko:no-std-san, r=alexcrichtonbors-4/+0
build-std compatible sanitizer support ### Motivation When using `-Z sanitizer=*` feature it is essential that both user code and standard library is instrumented. Otherwise the utility of sanitizer will be limited, or its use will be impractical like in the case of memory sanitizer. The recently introduced cargo feature build-std makes it possible to rebuild standard library with arbitrary rustc flags. Unfortunately, those changes alone do not make it easy to rebuild standard library with sanitizers, since runtimes are dependencies of std that have to be build in specific environment, generally not available outside rustbuild process. Additionally rebuilding them requires presence of llvm-config and compiler-rt sources. The goal of changes proposed here is to make it possible to avoid rebuilding sanitizer runtimes when rebuilding the std, thus making it possible to instrument standard library for use with sanitizer with simple, although verbose command: ``` env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Zsanitizer=thread cargo test -Zbuild-std --target x86_64-unknown-linux-gnu ``` ### Implementation * Sanitizer runtimes are no long packed into crates. Instead, libraries build from compiler-rt are used as is, after renaming them into `librusc_rt.*`. * rustc obtains runtimes from target libdir for default sysroot, so that they are not required in custom build sysroots created with build-std. * The runtimes are only linked-in into executables to address issue #64629. (in previous design it was hard to avoid linking runtimes into static libraries produced by rustc as demonstrated by sanitizer-staticlib-link test, which still passes despite changes made in #64780). cc @kennytm, @japaric, @firstyear, @choller
2020-01-11Rollup merge of #68050 - Centril:canon-error, r=Mark-SimulacrumYuki Okushi-48/+43
Canonicalize rustc_error imports r? @Mark-Simulacrum
2020-01-11Rollup merge of #67258 - Centril:open-ended-ranges, r=oli-obkYuki Okushi-22/+73
Introduce `X..`, `..X`, and `..=X` range patterns Tracking issue: https://github.com/rust-lang/rust/issues/67264 Feature gate: `#![feature(half_open_range_patterns)]` --------------------------- In this PR, we introduce range-from (`X..`), range-to (`..X`), and range-to-inclusive (`..=X`) patterns. These correspond to the `RangeFrom`, `RangeTo`, and `RangeToInclusive` expression forms introduced with the same syntaxes. The correspondence is both syntactic and semantic (in the sense that e.g. a `X..` pattern matching on a scrutinee `s` holds exactly when `(X..).contains(&s)` holds). --------------------------- Noteworthy: - The compiler complexity added with this PR is around 10 lines (discounting new tests, which account for the large PR size). - `...X` is accepted syntactically with the same meaning as `..=X`. This is done primarily to simplify and unify the implementation & spec. If-and-when we decide to make `X...Y` a hard error on a new edition, we can do the same for `...X` patterns as well. - `X...` and `X..=` is rejected syntactically just like it is for the expression equivalents. We should perhaps make these into semantic restrictions (cc @petrochenkov). - In HAIR, these half-open ranges are represented by inserting the max/min values for the approprate types. That is, `X..` where `X: u8` would become `X..=u8::MAX` in HAIR (note the `..=` since `RangeFrom` includes the end). - Exhaustive integer / char matching does not (yet) allow for e.g. exhaustive matching on `0usize..` or `..5usize | 5..` (same idea for `isize`). This would be a substantially more invasive change, and could be added in some other PR. - The issues with slice pattern syntax has been resolved as we decided to use `..` to mean a "rest-pattern" and `[xs @ ..]` to bind the rest to a name in a slice pattern. - Like with https://github.com/rust-lang/rust/pull/35712, which provided `X..Y` range patterns, this is not yet backed up by an RFC. I'm providing this experimental implementation now to have something concrete to discuss. I would be happy to provide an RFC for this PR as well as for #35712 to finalize and confirm the ideas with the larger community. Closes https://github.com/rust-lang/rfcs/issues/947. --------------------------- r? @varkor cc @matthewjasper @oli-obk I would recommend reviewing this (in particular HAIR-lowering and pattern parsing changes) with whitespace changes ignored.
2020-01-10Fix some rebasing fallout.Michael Woerister-1/+1
2020-01-10Update measureme to 0.7.1 in order to fix compilation error on big-endian ↵Michael Woerister-1/+1
platforms.