summary refs log tree commit diff
path: root/src/test/ui/proc-macro
AgeCommit message (Collapse)AuthorLines
2019-12-03Emit coercion suggestions in more placesAaron Hill-0/+5
Fixes #66910 We have several different kinds of suggestions we can try to make when type coercion fails. However, we were previously only emitting these suggestions from `demand_coerce_diag`. This resulted in the compiler failing to emit applicable suggestions in several different cases, such as when the implicit return value of a function had the wrong type. This commit adds a new `emit_coerce_suggestions` method, which tries to emit a number of related suggestions. This method is called from both `demand_coerce_diag` and `CoerceMany::coerce_inner`, which covers a much wider range of cases than before. We now suggest using `.await` in more cases where it is applicable, among other improvements.
2019-12-02syntax: Use `ast::MacArgs` for attributesVadim Petrochenkov-2/+2
2019-11-21Point at type in `let` assignment on type errorsEsteban Küber-9/+27
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-60/+21
Specific labels when referring to "expected" and "found" types
2019-11-20Rollup merge of #66060 - traxys:test_65401, r=michaelwoeristerMazdak Farrokhzad-2/+2
Making ICEs and test them in incremental This adds: - A way to make the compiler ICE - A way to check for ICE in `cfail` tests with `should-ice` - A regression test for issue #65401 I am not sure the attribute added `should-ice` is the best for this job
2019-11-18fix rebaseEsteban Küber-12/+3
2019-11-19resolve: Give derive helpers highest priority during resolutionVadim Petrochenkov-39/+31
2019-11-18Surround types with backticks in type errorsEsteban Küber-14/+14
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-39/+9
2019-11-18review comments: tweak prefix stringsEsteban Küber-4/+4
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-21/+21
2019-11-17Rollup merge of #66271 - petrochenkov:abism, r=CentrilYuki Okushi-18/+52
syntax: Keep string literals in ABIs and `asm!` more precisely As a result we don't lose spans when `extern` functions or blocks are passed to proc macros, and also escape all string literals consistently. Continuation of https://github.com/rust-lang/rust/pull/60679, which did a similar thing with all literals besides those in ABIs and `asm!`. TODO: Add tests. Fixes https://github.com/rust-lang/rust/issues/60493 Fixes https://github.com/rust-lang/rust/issues/64561 r? @Centril
2019-11-17Add some more testsVadim Petrochenkov-1/+33
2019-11-16ast: Keep `extern` qualifiers in functions more preciselyVadim Petrochenkov-17/+19
2019-11-16Add some more testsVadim Petrochenkov-13/+78
2019-11-16expand: Stop marking derive helper attributes as knownVadim Petrochenkov-7/+41
Pass them through name resolution instead
2019-11-16resolve: Introduce a new scope for derive helpersVadim Petrochenkov-6/+24
2019-11-12Rollup merge of #66278 - LukasKalbertodt:fix-proc-macro-error, r=CentrilYuki Okushi-6/+6
Fix error message about exported symbols from proc-macro crates Someone forgot to update the error message after `#[proc_macro]` and `#[proc_macro_attribute]` were stabilized.
2019-11-11Fix error message about exported symbols from proc-macro cratesLukas Kalbertodt-6/+6
Someone forgot to update the error message after `#[proc_macro]` and `#[proc_macro_attribute]` were stabilized.
2019-11-10Auto merge of #66070 - petrochenkov:regattr, r=matthewjasperbors-7/+24
Support registering inert attributes and attribute tools using crate-level attributes And remove `#[feature(custom_attribute)]`. (`rustc_plugin::Registry::register_attribute` is not removed yet, I'll do it in a follow up PR.) ```rust #![register_attr(my_attr)] #![register_tool(my_tool)] #[my_attr] // OK #[my_tool::anything] // OK fn main() {} ``` --- Some tools (`rustfmt` and `clippy`) used in tool attributes are hardcoded in the compiler. We need some way to introduce them without hardcoding as well. This PR introduces a way to do it with a crate level attribute. The previous attempt to introduce them through command line (https://github.com/rust-lang/rust/pull/57921) met some resistance. This probably needs to go through an RFC before stabilization. However, I'd prefer to land *this* PR without an RFC to able to remove `#[feature(custom_attribute)]` and `Registry::register_attribute` while also providing a replacement. --- `register_attr` is a direct replacement for `#![feature(custom_attribute)]` (https://github.com/rust-lang/rust/issues/29642), except it doesn't rely on implicit fallback from unresolved attributes to custom attributes (which was always hacky and is the primary reason for the removal of `custom_attribute`) and requires registering the attribute explicitly. It's not clear whether it should go through stabilization or not. It's quite possible that all the uses should migrate to `#![register_tool]` (https://github.com/rust-lang/rust/issues/66079) instead. --- Details: - The naming is `register_attr`/`register_tool` rather than some `register_attributes` (plural, no abbreviation) for consistency with already existing attributes like `cfg_attr`, or `feature`, etc. --- Previous attempt: https://github.com/rust-lang/rust/pull/57921 cc https://github.com/rust-lang/rust/issues/44690 Tracking issues: #66079 (`register_tool`), #66080 (`register_attr`) Closes https://github.com/rust-lang/rust/issues/29642
2019-11-09Remove `#[feature(custom_attribute)]`Vadim Petrochenkov-7/+24
2019-11-09move attr meta grammar to parse::validate_atr + ast_validationMazdak Farrokhzad-12/+12
2019-11-07Rollup merge of #66087 - tmiasko:ui-mode, r=CentrilMazdak Farrokhzad-1/+1
Update some build-pass ui tests to use check-pass where applicable Helps with issue https://github.com/rust-lang/rust/issues/62277.
2019-11-05rewrote error messages for #[rustc_error]Quentin Boyer-2/+2
2019-11-04Use check-pass in ui tests where appropriateTomasz Miąsko-1/+1
2019-11-04expand: Feature gate out-of-line modules in proc macro inputVadim Petrochenkov-0/+132
2019-10-29Rollup merge of #65832 - tlively:emscripten-exception-handling, r=alexcrichtonTyler Mandry-1/+1
Re-enable Emscripten's exception handling support Passes LLVM codegen and Emscripten link-time flags for exception handling if and only if the panic strategy is `unwind`. Sets the default panic strategy for Emscripten targets to `unwind`. Re-enables tests that depend on unwinding support for Emscripten, including `should_panic` tests. r? @alexcrichton
2019-10-29Change E0741 into E0742Guillaume Gomez-2/+2
2019-10-29Update ui testsGuillaume Gomez-2/+3
2019-10-27Point at local similarly named element and tweak references to variantsEsteban Küber-27/+35
Point at the span for the definition of ADTs internal to the current crate. Look at the leading char of the ident to determine whether we're expecting a likely fn or any of a fn, a tuple struct or a tuple variant. Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-26Rollup merge of #65773 - estebank:sugg-whitespace, r=CentrilMazdak Farrokhzad-0/+1
Increase spacing for suggestions in diagnostics Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages. r? @Centril
2019-10-25Re-enable Emscripten's exception handling supportThomas Lively-1/+1
Passes LLVM codegen and Emscripten link-time flags for exception handling if and only if the panic strategy is `unwind`. Sets the default panic strategy for Emscripten targets to `unwind`. Re-enables tests that depend on unwinding support for Emscripten, including `should_panic` tests.
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+1
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-24Deprecated proc_macro doesn't trigger warning on build librarywangxiangqing-0/+2
Change-Id: Ib3a396e7334d209fe6c6ef425bbfc7b2ae471378
2019-10-22Deprecated proc_macro doesn't trigger warning on build librarywangxiangqing-5/+4
Change-Id: Ib3a396e7334d209fe6c6ef425bbfc7b2ae471378
2019-10-22Deprecated proc_macro doesn't trigger warning on build librarywangxiangqing-0/+15
Change-Id: Ib3a396e7334d209fe6c6ef425bbfc7b2ae471378
2019-10-16Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-1/+1
- Compatible with Emscripten 1.38.46-upstream or later upstream. - Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the old incorrect wasm32 C call ABI with the correct one, preserving the old one as wasm32_bindgen_compat for wasm-bindgen compatibility. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-15Test basic hygiene for `macro_rules` produced by transparent macrosVadim Petrochenkov-0/+74
2019-10-15Stabilize proc macros generating `macro_rules` itemsVadim Petrochenkov-105/+0
2019-10-10Auto merge of #65140 - petrochenkov:disapp, r=nikomatsakisbors-0/+37
resolve: Remove an incorrect assert Fixes https://github.com/rust-lang/rust/issues/64803.
2019-10-05Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, ↵Tyler Mandry-1/+1
r=alexcrichton" This reverts commit 7870050796e5904a0fc85ecbe6fa6dde1cfe0c91, reversing changes made to 2e7244807a7878f6eca3eb7d97ae9b413aa49014.
2019-10-05resolve: Remove an incorrect assertVadim Petrochenkov-0/+37
2019-10-04Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-1/+1
- Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the incorrect wasm32 C call ABI with the old asmjs version, which is correct for both wasm32 and JS. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Temporarily makes Emscripten targets use panic=abort by default because supporting unwinding will require an LLVM patch.
2019-10-03Rollup merge of #65018 - Aaron1011:fix/backtrace-stderr, r=nikomatsakisTyler Mandry-3/+6
Set RUST_BACKTRACE=0 in tests that include a backtrace in stderr This removes the implicit dependency on the environment variables set when running `./x.py test`
2019-10-03proc_macro: Add `Span::mixed_site` exposing `macro_rules` hygieneVadim Petrochenkov-35/+152
2019-10-02Set RUST_BACKTRACE=0 in tests that include a backtrace in stderrAaron Hill-3/+6
This removes the implicit dependency on the environment variables set when running `./x.py test`
2019-09-30Stabilize proc macros in type positionsVadim Petrochenkov-21/+18
2019-09-30Stabilize macros in `extern` blocksVadim Petrochenkov-51/+36
Add some tests for macros in extern blocks, remove duplicate tests
2019-09-15resolve: Remove `!` from "cannot find" diagnostics for macrosVadim Petrochenkov-8/+8
2019-09-15resolve: Tweak "cannot find" wording for attributesVadim Petrochenkov-10/+10