about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
AgeCommit message (Collapse)AuthorLines
2021-08-16feature gate doc(primitive)Joshua Nelson-1/+16
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-9/+18
2021-08-15Use correct drop scopes for if expressionsMatthew Jasper-4/+20
2021-08-14Fix dead code warning when inline const is used in patternGary Guo-0/+7
2021-08-15Fix `reachable_set` for non-function items in non-library crateshyd-dev-15/+16
2021-08-12Forbid `!` from being used in `asm!` outputGary Guo-5/+10
2021-08-12Adjust `check_no_mangle` and `check_export_name` to warn/error on ↵hyd-dev-12/+20
`#[no_mangle]`/`#[export_name]` on trait methods
2021-08-12Add associated functions that have custom linkage to `reachable_set`hyd-dev-13/+21
2021-08-07Auto merge of #87772 - npmccallum:naked_abi, r=Amanieubors-1/+2
Move naked function ABI check to its own lint This check was previously categorized under the lint named `UNSUPPORTED_NAKED_FUNCTIONS`. That lint is future incompatible and will be turned into an error in a future release. However, as defined in the Constrained Naked Functions RFC, this check should only be a warning. This is because it is possible for a naked function to be implemented in such a way that it does not break even the undefined ABI. For example, a `jmp` to a `const`. Therefore, this patch defines a new lint named `UNDEFINED_NAKED_FUNCTION_ABI` which contains just this single check. Unlike `UNSUPPORTED_NAKED_FUNCTIONS`, `UNDEFINED_NAKED_FUNCTION_ABI` will not be converted to an error in the future. rust-lang/rfcs#2774 rust-lang/rfcs#2972
2021-08-04Disable unused variable lint for naked functionsNathaniel McCallum-0/+5
In most calling conventions, accessing function parameters may require stack access. However, naked functions have no assembly prelude to set up stack access. This is why naked functions may only contain a single `asm!()` block. All parameter access is done inside the `asm!()` block, so we cannot validate the liveness of the input parameters. Therefore, we should disable the lint for naked functions. rust-lang/rfcs#2774 rust-lang/rfcs#2972
2021-08-04Move naked function ABI check to its own lintNathaniel McCallum-1/+2
This check was previously categorized under the lint named `UNSUPPORTED_NAKED_FUNCTIONS`. That lint is future incompatible and will be turned into an error in a future release. However, as defined in the Constrained Naked Functions RFC, this check should only be a warning. This is because it is possible for a naked function to be implemented in such a way that it does not break even the undefined ABI. For example, a `jmp` to a `const`. Therefore, this patch defines a new lint named `UNDEFINED_NAKED_FUNCTION_ABI` which contains just this single check. Unlike `UNSUPPORTED_NAKED_FUNCTIONS`, `UNDEFINED_NAKED_FUNCTION_ABI` will not be converted to an error in the future. rust-lang/rfcs#2774 rust-lang/rfcs#2972
2021-08-04Auto merge of #87568 - petrochenkov:localevel, r=cjgillotbors-103/+96
rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tables and passes using those tables - primarily privacy checking, stability checking and dead code checking. All these passes work with definitions rather than with arbitrary HIR nodes. r? `@cjgillot` cc `@lambinoo` (#87487)
2021-08-02Validate that naked functions are never inlinedNathaniel McCallum-1/+11
Reject all uses of the inline attribute on naked functions. rust-lang/rfcs#2774 rust-lang/rfcs#2972
2021-08-01Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisabors-2/+2
more clippy::complexity fixes (also a couple of clippy::perf fixes)
2021-07-31rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tablesVadim Petrochenkov-103/+96
and passes using them - primarily privacy checking, stability checking and dead code checking. WIP
2021-07-29Add feature gates for `for` and `?` in constsJonas Schievink-4/+5
2021-07-25clippy::useless_formatMatthias Krüger-2/+2
2021-07-25Only check macro attributes when checking the crate root.Camille GILLOT-2/+2
2021-07-25Introduce OwnerNode::Crate.Camille GILLOT-3/+3
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-1/+1
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`