summary refs log tree commit diff
path: root/compiler/rustc_passes/src
AgeCommit message (Collapse)AuthorLines
2021-07-22Allow some temporarily dead code.Felix S. Klock II-0/+1
I expect thi8s method to come back very soon; noise of removing them to satisfy lint seems wrong.
2021-07-22Revert PR 81473 to resolve (on mainline) issues 81626 and 81658.Felix S. Klock II-5/+0
Revert "Add missing brace" This reverts commit 85ad773049536d7fed9a94ae0ac74f97135c8655. Revert "Simplify base_expr" This reverts commit 899aae465eb4ef295dc1eeb2603f744568e0768c. Revert "Warn write-only fields" This reverts commit d3c69a4c0dd98af2611b7553d1a65afef6a6ccb0.
2021-06-19Revert "Allow specifying alignment for functions"Mark Rousskov-40/+6
This reverts commit 448d07683a6defd567996114793a09c9a8aef5df.
2021-06-06Rollup merge of #86047 - jyn514:doc-attrs, r=petrochenkovYuki Okushi-1/+1
Don't fire `invalid_doc_attributes` on `extern crate` items Fixes https://github.com/rust-lang/rust/issues/86046.
2021-06-05Don't fire `invalid_doc_attributes` on `extern crate` itemsJoshua Nelson-1/+1
2021-06-05Auto merge of #86001 - richkadel:revert-85617-rustin-patch-fix, ↵bors-5/+1
r=Mark-Simulacrum Revert "shrinking the deprecated method span" Reverts rust-lang/rust#85617 Fixes: #86000 r? `@Mark-Simulacrum`
2021-06-04Revert "shrinking the deprecated method span"Rich Kadel-5/+1
2021-06-04Remove `doc(include)`Joshua Nelson-2/+25
2021-06-04Rollup merge of #85850 - bjorn3:less_feature_gates, r=jyn514Yuki Okushi-2/+0
Remove unused feature gates The first commit removes a usage of a feature gate, but I don't expect it to be controversial as the feature gate was only used to workaround a limitation of rust in the past. (closures never being `Clone`) The second commit uses `#[allow_internal_unstable]` to avoid leaking the `trusted_step` feature gate usage from inside the index newtype macro. It didn't work for the `min_specialization` feature gate though. The third commit removes (almost) all feature gates from the compiler that weren't used anyway.
2021-06-03Auto merge of #85617 - hi-rustin:rustin-patch-fix, r=estebankbors-1/+5
shrinking the deprecated method span part of https://github.com/rust-lang/rust/issues/85403 r? `@estebank`
2021-06-02Address commenthi-rustin-4/+3
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-16/+13
2021-05-31Remove unused feature gatesbjorn3-2/+0
2021-05-30Make resolutions a query.Camille GILLOT-13/+16
2021-05-26Specialize implementationsJacob Pratt-0/+2
Implementations in stdlib are now optimized as they were before.
2021-05-25Address commenthi-rustin-4/+1
2021-05-24remove cfg(bootstrap)Pietro Albini-1/+0
2021-05-24shrinking the deprecated method spanhi-rustin-1/+9
2021-05-18Rollup merge of #85339 - FabianWolff:issue-83893, r=varkorGuillaume Gomez-3/+124
Report an error if a lang item has the wrong number of generic arguments This pull request fixes #83893. The issue is that the lang item code currently checks whether the lang item has the correct item kind (e.g. a `#[lang="add"]` has to be a trait), but not whether the item has the correct number of generic arguments. This can lead to an "index out of bounds" ICE when the compiler tries to create more substitutions than there are suitable types available (if the lang item was declared with too many generic arguments). For instance, here is a reduced ("reduced" in the sense that it does not trigger additional errors) version of the example given in #83893: ```rust #![feature(lang_items,no_core)] #![no_core] #![crate_type="lib"] #[lang = "sized"] trait MySized {} #[lang = "add"] trait MyAdd<'a, T> {} fn ice() { let r = 5; let a = 6; r + a } ``` On current nightly, this immediately causes an ICE without any warnings or errors emitted. With the changes in this PR, however, I get no ICE and two errors: ``` error[E0718]: `add` language item must be applied to a trait with 1 generic argument --> pr-ex.rs:8:1 | 8 | #[lang = "add"] | ^^^^^^^^^^^^^^^ 9 | trait MyAdd<'a, T> {} | ------- this trait has 2 generic arguments, not 1 error[E0369]: cannot add `{integer}` to `{integer}` --> pr-ex.rs:14:7 | 14 | r + a | - ^ - {integer} | | | {integer} error: aborting due to 2 previous errors Some errors have detailed explanations: E0369, E0718. For more information about an error, try `rustc --explain E0369`. ```
2021-05-17Two minor changes for readability and efficiencyFabian Wolff-3/+2
2021-05-17Auto merge of #85178 - cjgillot:local-crate, r=oli-obkbors-47/+23
Remove CrateNum parameter for queries that only work on local crate The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea. Using `()` as query key in those cases avoids having to worry about the validity of the query key.
2021-05-16Auto merge of #85290 - Amanieu:asm_const_int, r=nagisabors-41/+2
Remove support for floating-point constants in asm! Floating-point constants aren't very useful anyways and this simplifies the code since the type check can now be done in typeck. cc `@rust-lang/wg-inline-asm` r? `@nagisa`
2021-05-16Implement changes suggested by varkorFabian Wolff-5/+49
2021-05-16Auto merge of #84549 - tmiasko:static-initializer, r=varkorbors-2/+1
Reachable statics have reachable initializers Static initializer can read other statics. Initializers are evaluated at compile time, and so their content could become inlined into another crate. Ensure that initializers of reachable statics are also reachable. Previously, when an item incorrectly considered to be unreachable was reached from another crate an attempt would be made to codegen it. The attempt could fail with an ICE (in the case MIR wasn't available to do so) in some circumstances the attempt could also succeed resulting in a local codegen of non-local items, including static ones. Fixes #84455.
2021-05-15Report an error if a lang item has the wrong number of generic argumentsFabian Wolff-5/+83
2021-05-15Warn about unused pub fields in non-pub structsFabian Wolff-20/+29
2021-05-14Remove support for floating-point constants in asm!Amanieu d'Antras-41/+2
Floating-point constants aren't very useful anyways and this simplifies the code since the type check can now be done in typeck.
2021-05-13Add support for const operands and options to global_asm!Amanieu d'Antras-0/+27
On x86, the default syntax is also switched to Intel to match asm!
2021-05-12entirely remove rustc_args_required_const attributeRalf Jung-79/+1
2021-05-12Use () for lang items.Camille GILLOT-29/+14
2021-05-12Use () for privacy.Camille GILLOT-5/+4
2021-05-12Use () for entry_fn.Camille GILLOT-9/+3
2021-05-12Use () in reachable_set.Camille GILLOT-4/+2
2021-05-12Auto merge of #83813 - cbeuw:remap-std, r=michaelwoeristerbors-4/+4
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped. `RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path. `RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure. When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host". `rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`. cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-12Rollup merge of #85018 - hi-rustin:rustin-patch-84637, r=estebankYuki Okushi-3/+3
shrinking the deprecated method span close https://github.com/rust-lang/rust/issues/84637
2021-05-11Split span_to_string into span_to_diagnostic/embeddable_stringAndy Wang-4/+4
2021-05-10Add documentationLeSeulArtichaut-0/+17
2021-05-08Error on conflicting `#[doc(inline)]`/`#[doc(no_inline)]` attributesLeSeulArtichaut-26/+74
2021-05-08Emit `invalid_doc_attributes` warnings in more casesLeSeulArtichaut-12/+75
2021-05-07shrinking the deprecated method spanhi-rustin-3/+3
2021-04-29Implement RFC 1260 with feature_name `imported_main`.Charles Lew-24/+31
2021-04-26Auto merge of #84546 - CohenArthur:fix-liveness-typo, r=jyn514bors-3/+3
Fix typo in report_unsed_assign The function was called `report_unsed_assign`, which I assume is a typo, considering the rest of the file. This replaces `report_unsed_assign` with `report_unused_assign`.
2021-04-25liveness: Fix typo report_unsed_assign -> report_unused_assignCohenArthur-3/+3
2021-04-25Reachable statics have reachable initializersTomasz Miąsko-2/+1
Static initializer can read other statics. Initializers are evaluated at compile time, and so their content could become inlined into another crate. Ensure that initializers of reachable statics are also reachable. Previously, when an item incorrectly considered to be unreachable was reached from another crate an attempt would be made to codegen it. The attempt could fail with an ICE (in the case MIR wasn't available to do so) in some circumstances the attempt could also succeed resulting in a local codegen of non-local items, including static ones.
2021-04-24Auto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obkbors-1/+0
further split up const_fn feature flag This continues the work on splitting up `const_fn` into separate feature flags: * `const_fn_trait_bound` for `const fn` with trait bounds * `const_fn_unsize` for unsizing coercions in `const fn` (looks like only `dyn` unsizing is still guarded here) I don't know if there are even any things left that `const_fn` guards... at least libcore and liballoc do not need it any more. `@oli-obk` are you currently able to do reviews?
2021-04-22Rollup merge of #84343 - camsteffen:closure-tree, r=varkorDylan DPC-14/+1
Remove `ScopeTree::closure_tree` Seems to be dead code since #50649.
2021-04-19Remove closure_treeCameron Steffen-14/+1
2021-04-19Auto merge of #84091 - tmiasko:check-attrs-sym, r=davidtwcobors-49/+42
Match against attribute name when validating attributes Extract attribute name once and match it against symbols that are being validated, instead of using `Session::check_name` for each symbol individually. Assume that all validated attributes are used, instead of marking them as such, since the attribute check should be exhaustive.
2021-04-18fix feature use in rustc libsRalf Jung-1/+0
2021-04-16Remove #[main] attribute.Charles Lew-8/+5