about summary refs log tree commit diff
path: root/src/test/compile-fail/privacy
AgeCommit message (Collapse)AuthorLines
2018-08-14Moved compile-fail tests to ui tests.David Wood-613/+0
2018-06-23add `dyn` to display of dynamic (trait) type namesZack M. Davis-6/+6
The `dyn Trait` syntax was stabilized in 199ee327. Resolves #49277.
2018-06-04Changed a few tests, and changed the folder of a few of them.Crazycolorz5-61/+0
2018-04-27Don't feature gate bang macros on 'proc_macro_path_invoc'.Sergio Benitez-3/+0
2018-04-20rustc: Tweak custom attribute capabilitiesAlex Crichton-0/+3
This commit starts to lay some groundwork for the stabilization of custom attribute invocations and general procedural macros. It applies a number of changes discussed on [internals] as well as a [recent issue][issue], namely: * The path used to specify a custom attribute must be of length one and cannot be a global path. This'll help future-proof us against any ambiguities and give us more time to settle the precise syntax. In the meantime though a bare identifier can be used and imported to invoke a custom attribute macro. A new feature gate, `proc_macro_path_invoc`, was added to gate multi-segment paths and absolute paths. * The set of items which can be annotated by a custom procedural attribute has been restricted. Statements, expressions, and modules are disallowed behind two new feature gates: `proc_macro_expr` and `proc_macro_mod`. * The input to procedural macro attributes has been restricted and adjusted. Today an invocation like `#[foo(bar)]` will receive `(bar)` as the input token stream, but after this PR it will only receive `bar` (the delimiters were removed). Invocations like `#[foo]` are still allowed and will be invoked in the same way as `#[foo()]`. This is a **breaking change** for all nightly users as the syntax coming in to procedural macros will be tweaked slightly. * Procedural macros (`foo!()` style) can only be expanded to item-like items by default. A separate feature gate, `proc_macro_non_items`, is required to expand to items like expressions, statements, etc. Closes #50038 [internals]: https://internals.rust-lang.org/t/help-stabilize-a-subset-of-macros-2-0/7252 [issue]: https://github.com/rust-lang/rust/issues/50038
2018-01-15Reexport -> re-export in error messagesCarol (Nichols || Goulding)-2/+4
2017-12-21Properly check traits in type privacyVadim Petrochenkov-11/+9
2017-12-21Add tests for associated item privacyVadim Petrochenkov-0/+349
2017-10-28Auto merge of #45503 - thombles:tk/i44339-v5, r=petrochenkovbors-3/+1
Improve diagnostics when list of tokens has incorrect separators Make `parse_seq_to_before_tokens` more resilient to error conditions. Where possible it is better if it can consume up to the final bracket before returning. This change improves the diagnostics in a couple of situations: ``` struct S(pub () ()); // omitted separator use std::{foo. bar}; // used a similar but wrong separator ``` Fixes #44339 r? @petrochenkov
2017-10-25Update tests for less noisy error messagesThomas Karpiniec-3/+1
2017-10-22`crate` shorthand visibility modifierZack M. Davis-1/+11
With regrets, this breaks rustfmt and rls. This is in the matter of #45388.
2017-07-27Give span to angle bracketed generic argumentsVadim Petrochenkov-23/+0
2017-07-27Discern between `Path` and `Path<>` in ASTVadim Petrochenkov-1/+5
2017-05-30Turn sufficiently old compatibility lints into hard errorsVadim Petrochenkov-2/+0
2017-05-27Stabilize unions with `Copy` fields and no destructorVadim Petrochenkov-4/+0
2017-04-25privacy: Rename and cleanup PrivacyVisitorVadim Petrochenkov-2/+2
2017-03-22Add diagnostic for incorrect `pub (restriction)`Esteban Küber-9/+12
Given the following statement ```rust pub (a) fn afn() {} ``` Provide the following diagnostic: ```rust error: incorrect restriction in `pub` --> file.rs:15:1 | 15 | pub (a) fn afn() {} | ^^^^^^^ | = help: some valid visibility restrictions are: `pub(crate)`: visible only on the current crate `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path help: to make this visible only to module `a`, add `in` before the path: | pub (in a) fn afn() {} ``` Remove cruft from old `pub(path)` syntax.
2017-03-21Refactor parsing of trait object typesVadim Petrochenkov-6/+6
2017-03-17Make priv in pub hard error for crates using pub(restricted)Taylor Cramer-4/+0
2017-03-15Stabilize pub(restricted)Taylor Cramer-43/+4
2017-03-10Update syntax for `pub(restricted)`Vadim Petrochenkov-11/+6
2017-01-29Implement compatibility lint for legacy constructor visibilitiesVadim Petrochenkov-0/+28
2017-01-14Auto merge of #38914 - est31:tidy-gate-tests, r=nikomatsakisbors-0/+2
Make tidy check for lang gate tests Add gate tests to the checks that tidy performs. Excerpt from the commit message of the main commit: Require compile-fail tests for new lang features Its non trivial to test lang feature gates, and people forget to add such tests. So we extend the features lint of the tidy tool to ensure that all new lang features contain a new compile-fail test. Of course, one could drop this requirement and just grep all tests in run-pass for #![feature(abc)] and then run this test again, removing the mention, requiring that it fails. But this only tests for the existence of a compilation failure. Manual tests ensure that also the correct lines spawn the error, and also test the actual error message. For library features, it makes no sense to require such a test, as here code is used that is generic for all library features. The tidy lint extension now checks the compile-fail test suite for occurences of "gate-test-X" where X is a feature. Alternatively, it also accepts file names with the form "feature-gate-X.rs". If a lang feature is found that has no such check, we emit a tidy error. I've applied the markings to all tests I could find in the test suite. I left a small (20 elements) whitelist of features that right now have no gate test, or where I couldn't find one. Once this PR gets merged, I'd like to close issue #22820 and open a new one on suggestion of @nikomatsakis to track the removal of all elements from that whitelist (already have a draft). Writing such a small test can be a good opportunity for a first contribution, so I won't touch it (let others have the fun xD). cc @brson , @pnkfelix (they both discussed about this in the issue linked above).
2017-01-12Mark even more tests as gate testsest31-0/+2
Now, no feature outside of the whitelist is without a test marked as its gate test.
2017-01-12resolve: Do not use "resolve"/"resolution" in error messagesVadim Petrochenkov-1/+1
2016-12-26More systematic error reporting in path resolutionVadim Petrochenkov-3/+3
2016-09-03Address comments and add requested testsVadim Petrochenkov-0/+58
2016-08-26Stabilize type-macrosDaniele Baracchi-3/+3
Closes #27245
2016-05-28Move some other checks to AST sanity passVadim Petrochenkov-0/+2
2016-05-06s/aux/auxiliary, because windowsNiko Matsakis-0/+0
For legacy reasons (presumably), Windows does not permit files name aux.
2016-05-06move auxiliary builds to a test-relative `aux`Niko Matsakis-0/+23
Instead of finding aux-build files in `auxiliary`, we now search for an `aux` directory relative to the test. So if your test is `compile-fail/foo.rs`, we would look in `compile-fail/aux`. Similarly, we ignore the `aux` directory when searching for tets.
2016-04-27Add testsJeffrey Seyfried-0/+70
2016-04-24syntax: Check paths in visibilities for type parametersVadim Petrochenkov-0/+20
syntax: Merge PathParsingMode::NoTypesAllowed and PathParsingMode::ImportPrefix syntax: Rename PathParsingMode and its variants to better express their purpose syntax: Remove obsolete error message about 'self lifetime syntax: Remove ALLOW_MODULE_PATHS workaround syntax/resolve: Adjust some error messages resolve: Compare unhygienic (not renamed) names with keywords::Invalid, invalid identifiers may appear to be valid after renaming
2016-04-21fix broken test revealed by compiletestNiko Matsakis-1/+3
2016-04-16Add tests for `pub(restricted)`Jeffrey Seyfried-0/+182