summary refs log tree commit diff
path: root/compiler/rustc_passes/src
AgeCommit message (Collapse)AuthorLines
2020-11-10Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-SimulacrumJonas Schievink-1/+1
rustc_target: Further cleanup use of target options Follow up to https://github.com/rust-lang/rust/pull/77729. Implements items 2 and 4 from the list in https://github.com/rust-lang/rust/pull/77729#issue-500228243. The first commit collapses uses of `target.options.foo` into `target.foo`. The second commit renames some target options to avoid tautology: `target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount` r? `@Mark-Simulacrum`
2020-11-09Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwcoDylan DPC-1/+2
rustc_ast: Do not panic by default when visiting macro calls Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them. The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in https://github.com/rust-lang/rust/pull/69589.
2020-11-08Collapse all uses of `target.options.foo` into `target.foo`Vadim Petrochenkov-1/+1
with an eye on merging `TargetOptions` into `Target`. `TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
2020-11-03rustc_ast: `visit_mac` -> `visit_mac_call`Vadim Petrochenkov-1/+1
2020-11-03Rollup merge of #78626 - fusion-engineering-forks:deprecated-trait-impl, ↵Mara Bos-11/+22
r=estebank Improve errors about #[deprecated] attribute This change: 1. Turns `#[deprecated]` on a trait impl block into an error, which fixes #78625; 2. Changes these and other errors about `#[deprecated]` to use the span of the attribute instead of the item; and 3. Turns this error into a lint, to make sure it can be capped with `--cap-lints` and doesn't break any existing dependencies. Can be reviewed per commit. --- Example: ```rust struct X; #[deprecated = "a"] impl Default for X { #[deprecated = "b"] fn default() -> Self { X } } ``` Before: ``` error: This deprecation annotation is useless --> src/main.rs:6:5 | 6 | / fn default() -> Self { 7 | | X 8 | | } | |_____^ ``` After: ``` error: this `#[deprecated]' annotation has no effect --> src/main.rs:3:1 | 3 | #[deprecated = "a"] | ^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute | = note: `#[deny(useless_deprecated)]` on by default error: this `#[deprecated]' annotation has no effect --> src/main.rs:5:5 | 5 | #[deprecated = "b"] | ^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute ```
2020-11-03rustc_ast: Do not panic by default when visiting macro callsVadim Petrochenkov-0/+1
2020-11-02Improve deprecation attribute diagnostic messages.Mara Bos-3/+3
(From the PR feedback.) Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
2020-11-01Turn 'useless #[deprecated]' error into a lint.Mara Bos-11/+11
2020-11-01Use the right span for errors about #[deprecated] attributes.Mara Bos-9/+17
2020-11-01Deny #[deprecated] on trait impl blocks.Mara Bos-1/+4
They have no effect there, but were silently accepted.
2020-10-27Cache foreign_modules queryRyan Levick-1/+1
2020-10-25Rollup merge of #78208 - liketechnik:issue-69399, r=oli-obkYuki Okushi-3/+56
replace `#[allow_internal_unstable]` with `#[rustc_allow_const_fn_unstable]` for `const fn`s `#[allow_internal_unstable]` is currently used to side-step feature gate and stability checks. While it was originally only meant to be used only on macros, its use was expanded to `const fn`s. This pr adds stricter checks for the usage of `#[allow_internal_unstable]` (only on macros) and introduces the `#[rustc_allow_const_fn_unstable]` attribute for usage on `const fn`s. This pr does not change any of the functionality associated with the use of `#[allow_internal_unstable]` on macros or the usage of `#[rustc_allow_const_fn_unstable]` (instead of `#[allow_internal_unstable]`) on `const fn`s (see https://github.com/rust-lang/rust/issues/69399#issuecomment-712911540). Note: The check for `#[rustc_allow_const_fn_unstable]` currently only validates that the attribute is used on a function, because I don't know how I would check if the function is a `const fn` at the place of the check. I therefore openend this as a 'draft pull request'. Closes rust-lang/rust#69399 r? @oli-obk
2020-10-25Auto merge of #77546 - lcnr:impl-trait-closure, r=eddybbors-0/+13
fix def collector for impl trait fixes #77329 We now consistently make `impl Trait` a hir owner, requiring some special casing for synthetic generic params. r? `@eddyb`
2020-10-23Auto merge of #77015 - davidtwco:check-attr-variant-closure-expr, r=lcnrbors-58/+33
passes: `check_attr` on more targets This PR modifies `check_attr` so that: - Enum variants are now checked (some attributes would not have been prohibited on variants previously). - `check_expr_attributes` and `check_stmt_attributes` are removed as `check_attributes` can perform the same checks. This means that codegen attribute errors aren't shown if there are other errors first (e.g. from other attributes, as shown in `src/test/ui/macros/issue-68060.rs` changes below).
2020-10-23fix validation for rustc_allow_const_fn_unstable targetsFlorian Warzecha-3/+5
The validation was introduced in 3a63bf02998f7b5e040a4b87e049d03ddd144f74 without strict validation of functions, e. g. all function types were allowed. Now the validation only allows `const fn`s.
2020-10-22Rollup merge of #77976 - oliviacrain:issue-77915-fix, r=matthewjasperYuki Okushi-1/+1
Mark inout asm! operands as used in liveness pass Variables used in `inout` operands in inline assembly (that is, they're used as both input and output to some arbitrary assembly instruction) are being marked as read and written, but are not marked as being used in the RWU table during the liveness pass. This can result in such expressions triggering an unused variable lint warning. This is incorrect behavior- reads without uses are currently only used for compound assignments. We conservatively assume that an `inout` operand is being read and used in the context of the assembly instruction. Closes #77915
2020-10-22validate rustc_allow_const_fn_unstable targetsFlorian Warzecha-0/+22
Adds a check to make sure `#[rustc_allow_const_fn_unstable]` can be applied only to functions.
2020-10-21validate allow_internal_unstable targetFlorian Warzecha-0/+29
Adds a check to make sure `#[allow_internal_unstable]` can be applied only to macro definitions.
2020-10-21switch allow_internal_unstable const fns to rustc_allow_const_fn_unstableFlorian Warzecha-3/+3
2020-10-18Mark InOut operands as used in RWU table with write_placeOlivia Crain-2/+2
2020-10-18Auto merge of #78066 - bugadani:wat, r=jonas-schievinkbors-3/+3
Clean up small, surprising bits of code This PR clean up a small number of unrelated, small things I found while browsing the code base.
2020-10-18Remove weird slice conversionDániel Buga-1/+1
2020-10-18Clean up surprising borrowDániel Buga-2/+2
2020-10-17Treat InOut variables like other input variablesOlivia Crain-2/+2
2020-10-17Mark inout asm! operands as used in liveness passOlivia Crain-1/+1
2020-10-17Auto merge of #77124 - spastorino:const-exprs-rfc-2920, r=oli-obkbors-0/+3
Implement const expressions and patterns (RFC 2920) cc `@ecstatic-morse` `@lcnr` `@oli-obk` `@petrochenkov`
2020-10-16Lower inline const down to MIRSantiago Pastorino-0/+3
2020-10-16stabilize union with 'ManuallyDrop' fields and 'impl Drop for Union'Ralf Jung-23/+29
2020-10-15Replace target.target with target and target.ptr_width with target.pointer_widthest31-3/+3
Preparation for a subsequent change that replaces rustc_target::config::Config with its wrapped Target. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \; find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \; find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \; ./x.py fmt
2020-10-07implement nitsBastian Kauschke-1/+2
2020-10-07bodgeBastian Kauschke-0/+12
2020-10-06Enforce whitespace ascii character check for doc aliasGuillaume Gomez-0/+10
2020-10-05Allow ascii whitespace char for doc aliasesGuillaume Gomez-2/+3
2020-10-05Rollup merge of #76329 - GuillaumeGomez:doc-alias-crate-level, r=matthewjasperDylan DPC-21/+79
Add check for doc alias attribute at crate level Fixes #76298, #64734, #69365. r? @ollie27
2020-10-04Enforce crate level attributes checksGuillaume Gomez-21/+57
2020-10-04Auto merge of #76448 - haraldh:default_alloc_error_handler_reduced, r=Amanieubors-1/+4
Implement Make `handle_alloc_error` default to panic (for no_std + liballoc) Related: https://github.com/rust-lang/rust/issues/66741 Guarded with `#![feature(default_alloc_error_handler)]` a default `alloc_error_handler` is called, if a custom allocator is used and no other custom `#[alloc_error_handler]` is defined.
2020-10-03Run attributes check at crate levelGuillaume Gomez-4/+10
2020-10-03Prevent #[doc(alias = "...")] at crate levelGuillaume Gomez-1/+17
2020-10-02Rollup merge of #76811 - GuillaumeGomez:doc-alias-name-restriction, ↵Jonas Schievink-7/+27
r=oli-obk,ollie27 Doc alias name restriction Fixes #76705.
2020-10-02Forbid some characters to be used as doc aliasGuillaume Gomez-7/+27
2020-10-02Implement Make `handle_alloc_error` default to panic (for no_std + liballoc)Harald Hoyer-1/+4
Related: https://github.com/rust-lang/rust/issues/66741 Guarded with `#![feature(default_alloc_error_handler)]` a default `alloc_error_handler` is called, if a custom allocator is used and no other custom `#[alloc_error_handler]` is defined. The panic message does not contain the size anymore, because it would pull in the fmt machinery, which would blow up the code size significantly.
2020-10-01Rollup merge of #77343 - varkor:rustc_args_required_const-validation, r=lcnrDylan DPC-9/+101
Validate `rustc_args_required_const` Fixes https://github.com/rust-lang/rust/issues/74608.
2020-09-30Rollup merge of #77296 - tmiasko:liveness-option, r=ecstatic-morseJonas Schievink-40/+36
liveness: Use Option::None to represent absent live nodes No functional changes intended.
2020-09-30Validate `rustc_args_required_const`varkor-9/+101
2020-09-30liveness: Use Option::None to represent absent live nodesTomasz Miąsko-40/+36
No functional changes intended.
2020-09-29Liveness analysis for everybodyTomasz Miąsko-34/+28
Perform liveness analysis for every body instead of limiting it to fns.
2020-09-28passes: `check_attr` on more targetsDavid Wood-58/+33
This commit modifies `check_attr` so that: - Enum variants are now checked (some attributes would not have been prohibited on variants previously). - `check_expr_attributes` and `check_stmt_attributes` are removed as `check_attributes` can perform the same checks. Signed-off-by: David Wood <david@davidtw.co>
2020-09-27liveness: Inline visitor implementation for IrMapsTomasz Miąsko-199/+175
2020-09-27liveness: Store upvars_mentioned inside Liveness structTomasz Miąsko-4/+6
2020-09-27liveness: Use visit_param to add variables corresponding to paramsTomasz Miąsko-15/+19