summary refs log tree commit diff
path: root/compiler/rustc_hir/src
AgeCommit message (Collapse)AuthorLines
2021-07-21Rollup merge of #87273 - fee1-dead:impl-const-impl-bounds, r=oli-obkGuillaume Gomez-0/+21
Recognize bounds on impls as const bounds r? ```@oli-obk```
2021-07-19Recognize bounds on impls as const boundsDeadbeef-0/+21
2021-07-18Use == to compare OpaqueTyOrigin valuesSantiago Pastorino-1/+1
2021-07-18Remove OpaqueTyOrigin::Misc, use TyAlias insteadSantiago Pastorino-2/+0
2021-07-17Remove OpaqueTyOrigin::BindingSantiago Pastorino-2/+0
2021-07-15Remove refs from pat slicesCameron Steffen-8/+8
2021-07-11Auto merge of #85941 - cjgillot:qresolve, r=Aaron1011bors-2/+2
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-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-06Make resolutions a query.Camille GILLOT-2/+2
2021-07-06Auto merge of #86143 - bjorn3:revert_revert_merge_crate_disambiguator, ↵bors-11/+6
r=michaelwoerister Reland "Merge CrateDisambiguator into StableCrateId" Reverts https://github.com/rust-lang/rust/pull/85891 as this revert of #85804 made perf even worse. r? `@Mark-Simulacrum`
2021-07-06Revert "Revert "Fix test""bjorn3-8/+5
This reverts commit 6c5b6985fdce0921fe4ac0247fd026355953c1ea.
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-3/+1
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-06Store macro parent module in ExpnData.Camille GILLOT-15/+1
2021-06-29Remove lang items Send, UnwindSafe and RefUnwindSafeRoxane Fruytier-3/+0
2021-06-28Update to new bootstrap compilerMark Rousskov-1/+0
2021-06-23Rollup merge of #86223 - fee1-dead:better-E0121, r=petrochenkovDylan DPC-0/+21
Specify the kind of the item for E0121 Fixes #86005
2021-06-21Auto merge of #86383 - shamatar:slice_len_lowering, r=bjorn3bors-0/+2
Add MIR pass to lower call to `core::slice::len` into `Len` operand During some larger experiment with range analysis I've found that code like `let l = slice.len()` produces different MIR then one found in bound checks. This optimization pass replaces terminators that are calls to `core::slice::len` with just a MIR operand and Goto terminator. It uses some heuristics to remove the outer borrow that is made to call `core::slice::len`, but I assume it can be eliminated, just didn't find how. Would like to express my gratitude to `@oli-obk` who helped me a lot on Zullip
2021-06-22Specify the kind of the item for E0121Deadbeef-0/+21
2021-06-20Squashed implementation of the passAlex Vlasov-0/+2
2021-06-18Auto merge of #85421 - Smittyvb:rm_pushpop_unsafe, r=matthewjasperbors-2/+0
Remove some last remants of {push,pop}_unsafe! These macros have already been removed, but there was still some code handling these macros. That code is now removed.
2021-06-11Hash DefId in rustc_span.Camille GILLOT-7/+6
2021-06-08Do not require the DefPathTable to construct the on-disk cache.Camille GILLOT-9/+8
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-1/+3
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-07Revert "Fix test"bjorn3-5/+8
This reverts commit 3abdebe79d9a3a2256a36fe8f408dad6a466f89f.
2021-06-06Remove some last remants of {push,pop}_unsafe!Smitty-2/+0
These macros have already been removed, but there was still some code handling these macros. That code is now removed.
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-02Auto merge of #85892 - tmiasko:i, r=oli-obkbors-0/+2
Miscellaneous inlining improvements
2021-06-02Miscellaneous inlining improvementsTomasz Miąsko-0/+2
2021-06-01Remove StableVec.Camille GILLOT-2/+1
2021-06-01Only compute the trait_map once.Camille GILLOT-2/+6
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-8/+4
2021-05-31Remove unused feature gatesbjorn3-2/+0
2021-05-30Remove StableVec.Camille GILLOT-2/+2
2021-05-30Make resolutions a query.Camille GILLOT-2/+2
2021-05-30Only compute the trait_map once.Camille GILLOT-2/+6
2021-05-30Fix testbjorn3-8/+5
2021-05-30Merge CrateDisambiguator into StableCrateIdbjorn3-3/+1
2021-05-26Specialize implementationsJacob Pratt-0/+2
Implementations in stdlib are now optimized as they were before.
2021-05-24remove cfg(bootstrap)Pietro Albini-1/+0
2021-05-18Rollup merge of #83366 - jyn514:stabilize-key-value-attrs, r=petrochenkovJack Huey-1/+1
Stabilize extended_key_value_attributes Closes https://github.com/rust-lang/rust/issues/44732. Closes https://github.com/rust-lang/rust/issues/78835. Closes https://github.com/rust-lang/rust/issues/82768 (by making it irrelevant). # Stabilization report ## Summary This stabilizes using macro expansion in key-value attributes, like so: ```rust #[doc = include_str!("my_doc.md")] struct S; #[path = concat!(env!("OUT_DIR"), "/generated.rs")] mod m; ``` See Petrochenkov's excellent blog post [on internals](https://internals.rust-lang.org/t/macro-expansion-points-in-attributes/11455) for alternatives that were considered and rejected ("why accept no more and no less?") This has been available on nightly since 1.50 with no major issues. ## Notes ### Accepted syntax The parser accepts arbitrary Rust expressions in this position, but any expression other than a macro invocation will ultimately lead to an error because it is not expected by the built-in expression forms (e.g., `#[doc]`). Note that decorators and the like may be able to observe other expression forms. ### Expansion ordering Expansion of macro expressions in "inert" attributes occurs after decorators have executed, analogously to macro expressions appearing in the function body or other parts of decorator input. There is currently no way for decorators to accept macros in key-value position if macro expansion must be performed before the decorator executes (if the macro can simply be copied into the output for later expansion, that can work). ## Test cases - https://github.com/rust-lang/rust/blob/master/src/test/ui/attributes/key-value-expansion-on-mac.rs - https://github.com/rust-lang/rust/blob/master/src/test/rustdoc/external-doc.rs The feature has also been dogfooded extensively in the compiler and standard library: - https://github.com/rust-lang/rust/pull/83329 - https://github.com/rust-lang/rust/pull/83230 - https://github.com/rust-lang/rust/pull/82641 - https://github.com/rust-lang/rust/pull/80534 ## Implementation history - Initial proposal: https://github.com/rust-lang/rust/issues/55414#issuecomment-554005412 - Experiment to see how much code it would break: https://github.com/rust-lang/rust/pull/67121 - Preliminary work to restrict expansion that would conflict with this feature: https://github.com/rust-lang/rust/pull/77271 - Initial implementation: https://github.com/rust-lang/rust/pull/78837 - Fix for an ICE: https://github.com/rust-lang/rust/pull/80563 ## Unresolved Questions ~~https://github.com/rust-lang/rust/pull/83366#issuecomment-805180738 listed some concerns, but they have been resolved as of this final report.~~ ## Additional Information There are two workarounds that have a similar effect for `#[doc]` attributes on nightly. One is to emulate this behavior by using a limited version of this feature that was stabilized for historical reasons: ```rust macro_rules! forward_inner_docs { ($e:expr => $i:item) => { #[doc = $e] $i }; } forward_inner_docs!(include_str!("lib.rs") => struct S {}); ``` This also works for other attributes (like `#[path = concat!(...)]`). The other is to use `doc(include)`: ```rust #![feature(external_doc)] #[doc(include = "lib.rs")] struct S {} ``` The first works, but is non-trivial for people to discover, and difficult to read and maintain. The second is a strange special-case for a particular use of the macro. This generalizes it to work for any use case, not just including files. I plan to remove `doc(include)` when this is stabilized (https://github.com/rust-lang/rust/pull/82539). The `forward_inner_docs` workaround will still compile without warnings, but I expect it to be used less once it's no longer necessary.
2021-05-18Auto merge of #84767 - scottmcm:try_trait_actual, r=lcnrbors-4/+7
Implement the new desugaring from `try_trait_v2` ~~Currently blocked on https://github.com/rust-lang/rust/issues/84782, which has a PR in https://github.com/rust-lang/rust/pull/84811~~ Rebased atop that fix. `try_trait_v2` tracking issue: https://github.com/rust-lang/rust/issues/84277 Unfortunately this is already touching a ton of things, so if you have suggestions for good ways to split it up, I'd be happy to hear them. (The combination between the use in the library, the compiler changes, the corresponding diagnostic differences, even MIR tests mean that I don't really have a great plan for it other than trying to have decently-readable commits. r? `@ghost` ~~(This probably shouldn't go in during the last week before the fork anyway.)~~ Fork happened.
2021-05-18Stabilize extended_key_value_attributesJoshua Nelson-1/+1
# Stabilization report ## Summary This stabilizes using macro expansion in key-value attributes, like so: ```rust #[doc = include_str!("my_doc.md")] struct S; #[path = concat!(env!("OUT_DIR"), "/generated.rs")] mod m; ``` See the changes to the reference for details on what macros are allowed; see Petrochenkov's excellent blog post [on internals](https://internals.rust-lang.org/t/macro-expansion-points-in-attributes/11455) for alternatives that were considered and rejected ("why accept no more and no less?") This has been available on nightly since 1.50 with no major issues. ## Notes ### Accepted syntax The parser accepts arbitrary Rust expressions in this position, but any expression other than a macro invocation will ultimately lead to an error because it is not expected by the built-in expression forms (e.g., `#[doc]`). Note that decorators and the like may be able to observe other expression forms. ### Expansion ordering Expansion of macro expressions in "inert" attributes occurs after decorators have executed, analogously to macro expressions appearing in the function body or other parts of decorator input. There is currently no way for decorators to accept macros in key-value position if macro expansion must be performed before the decorator executes (if the macro can simply be copied into the output for later expansion, that can work). ## Test cases - https://github.com/rust-lang/rust/blob/master/src/test/ui/attributes/key-value-expansion-on-mac.rs - https://github.com/rust-lang/rust/blob/master/src/test/rustdoc/external-doc.rs The feature has also been dogfooded extensively in the compiler and standard library: - https://github.com/rust-lang/rust/pull/83329 - https://github.com/rust-lang/rust/pull/83230 - https://github.com/rust-lang/rust/pull/82641 - https://github.com/rust-lang/rust/pull/80534 ## Implementation history - Initial proposal: https://github.com/rust-lang/rust/issues/55414#issuecomment-554005412 - Experiment to see how much code it would break: https://github.com/rust-lang/rust/pull/67121 - Preliminary work to restrict expansion that would conflict with this feature: https://github.com/rust-lang/rust/pull/77271 - Initial implementation: https://github.com/rust-lang/rust/pull/78837 - Fix for an ICE: https://github.com/rust-lang/rust/pull/80563 ## Unresolved Questions ~~https://github.com/rust-lang/rust/pull/83366#issuecomment-805180738 listed some concerns, but they have been resolved as of this final report.~~ ## Additional Information There are two workarounds that have a similar effect for `#[doc]` attributes on nightly. One is to emulate this behavior by using a limited version of this feature that was stabilized for historical reasons: ```rust macro_rules! forward_inner_docs { ($e:expr => $i:item) => { #[doc = $e] $i }; } forward_inner_docs!(include_str!("lib.rs") => struct S {}); ``` This also works for other attributes (like `#[path = concat!(...)]`). The other is to use `doc(include)`: ```rust #![feature(external_doc)] #[doc(include = "lib.rs")] struct S {} ``` The first works, but is non-trivial for people to discover, and difficult to read and maintain. The second is a strange special-case for a particular use of the macro. This generalizes it to work for any use case, not just including files. I plan to remove `doc(include)` when this is stabilized. The `forward_inner_docs` workaround will still compile without warnings, but I expect it to be used less once it's no longer necessary.
2021-05-13Add support for const operands and options to global_asm!Amanieu d'Antras-29/+26
On x86, the default syntax is also switched to Intel to match asm!
2021-05-13Auto merge of #83759 - SkiFire13:fix-diag, r=estebankbors-25/+16
Handle more span edge cases in generics diagnostics This should fix invalid suggestions that didn't account for empty bracket pairs (`<>`) or type bindings.
2021-05-12Add more precise span informations to generic typesGiacomo Stevanato-25/+16
2021-05-06Actually implement the feature in the compilerScott McMurray-4/+7
Including all the bootstrapping tweaks in the library.
2021-05-06Add additional migrations to handle auto-traits and clone traitsRoxane-0/+3
Combine all 2229 migrations under one flag name
2021-05-04Add type to differentiate between fake and real DefId'sJustus K-5/+0
2021-04-25Auto merge of #84299 - lcnr:const-generics-defaults-name-res, r=varkorbors-1/+3
various const parameter defaults improvements Actually resolve names in const parameter defaults, fixing `struct Foo<const N: usize = { usize::MAX }>`. --- Split generic parameter ban rib for types and consts, allowing ```rust #![feature(const_generics_defaults)] struct Q; struct Foo<T = Q, const Q: usize = 3>(T); ``` --- Remove the type/const ordering restriction if `const_generics_defaults` is active, even if `const_generics` is not. allowing us to stabilize and test const param defaults separately. --- Check well formedness of const parameter defaults, eagerly emitting an error for `struct Foo<const N: usize = { 0 - 1 }>` --- Do not forbid const parameters in param defaults, allowing `struct Foo<const N: usize, T = [u8; N]>(T)` and `struct Foo<const N: usize, const M: usize = N>`. Note that this should not change anything which is stabilized, as on stable, type parameters must be in front of const parameters, which means that type parameter defaults are only allowed if no const parameters exist. We still forbid generic parameters inside of const param types. r? `@varkor` `@petrochenkov`
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?