summary refs log tree commit diff
path: root/compiler/rustc_passes/src
AgeCommit message (Collapse)AuthorLines
2021-07-21Allow some temporarily dead code.Felix S. Klock II-0/+2
I expect these two methods to come back very soon; noise of removing them to satisfy lint seems wrong.
2021-07-21Revert PR 81473 to resolve (on mainline) issues 81626 and 81658.Felix S. Klock II-6/+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-07-14Warn about useless assignments of variables/fields to themselvesFabian Wolff-0/+54
2021-07-13Auto merge of #86857 - fee1-dead:add-attr, r=oli-obkbors-18/+52
Add #[default_method_body_is_const] `@rustbot` label F-const_trait_impl
2021-07-12Auto merge of #86320 - hi-rustin:rustin-patch-fix-span, r=estebankbors-1/+2
shrinking the deprecated span ref: https://github.com/rust-lang/rust/pull/85617#issuecomment-854947988 part of #85403 r? `@estebank` The reason is that if we use method_span directly, it will cause the in_derive_expansion judgment to fail.
2021-07-11Auto merge of #85941 - cjgillot:qresolve, r=Aaron1011bors-24/+27
Reduce the amount of untracked state in TyCtxt -- Take 2 Main part of #85153 The offending line (https://github.com/rust-lang/rust/pull/85153#discussion_r642866298) is replaced by a FIXME until the possible bug and the perf concern are both resolved. r? `@Aaron1011`
2021-07-10Check if the attribute is applied correctlyDeadbeef-0/+26
2021-07-10Applied suggestionsDeadbeef-11/+6
2021-07-10Add #[default_method_body_is_const]Deadbeef-18/+31
2021-07-08Rollup merge of #86838 - lambinoo:I-69630-rust_const_unstable_check_const, ↵Guillaume Gomez-1/+60
r=oli-obk Checking that function is const if marked with rustc_const_unstable Fixes #69630 This one is still missing tests to check the behavior but I checked by hand and it seemed to work. I would not mind some direction for writing those unit tests!
2021-07-08Rollup merge of #86726 - ↵Guillaume Gomez-3/+0
sexxi-goose:use-diagnostic-item-for-rfc2229-migration, r=nikomatsakis Use diagnostic items instead of lang items for rfc2229 migrations This PR removes the `Send`, `UnwindSafe` and `RefUnwindSafe` lang items introduced in https://github.com/rust-lang/rust/pull/84730, and uses diagnostic items instead to check for `Send`, `UnwindSafe` and `RefUnwindSafe` traits for RFC2229 migrations. r? ```@nikomatsakis```
2021-07-08fn must be const if marked with stability attributLamb-1/+60
remove trailing newline fix: test with attribute but missing const Update compiler/rustc_passes/src/stability.rs Co-authored-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com> Add test for extern functions fix: using span_help instead of span_suggestion add test for some ABIs + fmt fix Update compiler/rustc_passes/src/stability.rs Co-authored-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com> Refractor and add test for `impl const` Add test to make sure no output + cleanup condition ----------------------------- remove stdcall test, failing CI test C abi is already tested in this, so it is not that useful to test another one. The tested code is blind to which specific ABI for now, as long as it's not an intrinsic one
2021-07-06Make resolutions a query.Camille GILLOT-24/+27
2021-07-03Auto merge of #86571 - fee1-dead:const-trait-impl-fix, r=jackh726bors-0/+63
deny using default function in impl const Trait Fixes #79450. I don't know if my implementation is correct: - The check is in `rustc_passes::check_const`, should I put it somewhere else instead? - Is my approach (to checking the impl) optimal? It works for the current tests, but it might have some issues or there might be a better way of doing this.
2021-07-01Auto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkovbors-4/+4
Rename all_crate_nums query to crates and remove useless wrapper Split out of https://github.com/rust-lang/rust/pull/86105 r? `@petrochenkov`
2021-07-01Rename all_crate_nums query to crates and remove useless wrapperbjorn3-4/+4
2021-07-01Auto merge of #86190 - asquared31415:extern-main-86110-fix, r=varkorbors-1/+15
Fix ICE when `main` is declared in an `extern` block Changes in #84401 to implement `imported_main` changed how the crate entry point is found, and a declared `main` in an `extern` block was detected erroneously. This was causing the ICE described in #86110. This PR adds a check for this case and emits an error instead. Previously a `main` declaration in an `extern` block was not detected as an entry point at all, so emitting an error shouldn't break anything that worked previously. In 1.52.1 stable this is demonstrated, with a `` `main` function not found`` error. Fixes #86110
2021-07-01Do the check even when the feature is not enabledDeadbeef-3/+6
2021-06-29Remove lang items Send, UnwindSafe and RefUnwindSafeRoxane Fruytier-3/+0
2021-06-25Check that `#[cmse_nonsecure_entry]` is applied to a function definitionFabian Wolff-0/+20
2021-06-23deny using default function in impl const TraitDeadbeef-0/+60
2021-06-17Fix ICE when using `#[doc(keyword = "...")]` on non-itemsFabian Wolff-2/+5
2021-06-15Fix ICE when doc aliases were put on function paramsRyan Levick-0/+2
2021-06-15Use last segmenthi-rustin-4/+1
2021-06-15shrinking the deprecated method spanhi-rustin-1/+5
2021-06-14Use the now available implementation of `IntoIterator` for arraysLeSeulArtichaut-1/+1
2021-06-09Fix ICE when `main` is declared in an `extern` blockasquared31415-1/+15
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