kennytm
e897fe711e
Rollup merge of #55301 - estebank:macro-allowed, r=petrochenkov
...
List allowed tokens after macro fragments
Fix #34069 .
2018-10-26 23:06:33 +08:00
kennytm
eb74711b54
Rollup merge of #55298 - estebank:macro-def, r=pnkfelix
...
Point at macro definition when no rules expect token
Fix #35150 .
2018-10-26 23:06:30 +08:00
kennytm
c6cd57dd86
Rollup merge of #55292 - estebank:macro-eof, r=pnkfelix
...
Macro diagnostics tweaks
Fix #30128 , fix #10951 by adding an appropriate span to the diagnostic.
Fix #26288 by suggesting adding semicolon to macro call.
2018-10-26 23:06:28 +08:00
Esteban Küber
2cfd790177
List allowed tokens after macro fragments
2018-10-25 11:08:58 -07:00
Esteban Küber
f8818cbf8f
Fix incorrect semicolon suggestion
2018-10-24 12:52:24 -07:00
Esteban Küber
1ab45ec7e3
Point to macro def span instead of whole body
2018-10-24 11:34:23 -07:00
Esteban Küber
8227a938a4
Point at macro definition when no rules expect token
2018-10-23 21:44:46 -07:00
Vadim Petrochenkov
0f625ac48d
Add extern crate
items to extern prelude
2018-10-24 00:14:50 +03:00
Esteban Küber
ad144ac3c1
Modify invalid macro in expression context diagnostic
2018-10-23 10:07:34 -07:00
Esteban Küber
8544db0faa
Add macro call span when lacking any other span in diagnostic
2018-10-23 10:07:11 -07:00
Eric Huss
09f42dd902
Add missing lifetime fragment specifier to error message.
...
A very minor issue, `lifetime` was missing from the error list.
I left `literal` in the list, even though it is unstable. It looks like it may stabilize soon anyways.
2018-10-12 17:51:48 -07:00
holmgr
05bb22d9e8
Remove incorrect span for second label inner macro invocation
2018-10-10 19:39:16 +02:00
bors
5a6f122126
Auto merge of #54813 - petrochenkov:uilocale, r=alexcrichton
...
Fix two UI tests with locale-dependent output
Closes https://github.com/rust-lang/rust/issues/54719
2018-10-07 11:10:39 +00:00
Austin Bonander
9da428dad8
make Parser::parse_foreign_item()
return a foreign item or error
...
closes #54441
2018-10-05 02:47:57 -07:00
Vadim Petrochenkov
a7cce470b6
Fix two UI tests with locale-dependent output
2018-10-05 11:37:48 +04:00
Vadim Petrochenkov
078fc52cbc
resolve: Prefer macro_rules
definitions to in-module macro definitions in some cases
2018-10-03 16:12:39 +04:00
Eduard-Mihai Burtescu
fa2c246384
Stabilize crate_in_paths, extern_absolute_paths and extern_prelude on all editions.
2018-09-22 09:26:40 +03:00
bors
32dc5a0783
Auto merge of #54157 - euclio:structured-suggestion, r=estebank
...
use structured suggestion for "missing mut" label
Fixes #54133 for both NLL and non-NLL.
r? @estebank
I'm not super happy with the existing wording here, since it's now a suggestion. I wonder if the message would work better as something like "help: make binding mutable: `mut foo`"?
Also, are the `HELP` and `SUGGESTION` comments necessary?
2018-09-16 09:47:05 +00:00
Vadim Petrochenkov
beb3b5d22c
resolve: Introduce two sub-namespaces in macro namespace
2018-09-13 14:48:50 +03:00
Andy Russell
d871b8ad4a
use structured suggestion for "missing mut" label
...
Fixes #54133 .
2018-09-12 17:16:18 -04:00
Vadim Petrochenkov
2dce3779bb
resolve: More precise spans for ambiguous resolution errors
...
Add labels to ambiguous resolution errors
2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
9beb5c3ef3
Add checks for expected macro output in restricted shadowing tests
2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
e00993a1ab
Add test cases for possible restricted shadowing configurations
...
Whitelist `#[rustc_transparent_macro]` so it's not interpreted as a potential attribute macro
2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
c057d579ab
resolve: Relax shadowing restriction on macro-expanded macros
...
... for both legacy and modern macros.
Fix previously introduced regressions, add tests.
2018-09-08 14:15:11 +03:00
Vadim Petrochenkov
f34ac26114
resolve: Model shadowing restriction for macro_rules after modern macros
...
This is a regression for legacy macros that will be fixed in the next commit
2018-09-08 14:15:10 +03:00
Vadim Petrochenkov
83a51deef5
resolve: Model resolve_legacy_scope
after resolve_lexical_macro_path_segment
2018-09-08 14:15:10 +03:00
Vadim Petrochenkov
c56adf6413
cleanup: Add main functions to some UI tests
2018-08-31 18:56:15 +03:00
Vadim Petrochenkov
23e9a1def5
resolve: Consolidate error reporting for resolved macros in fn resolve_macro_to_def
2018-08-20 23:12:36 +03:00
bors
c8c587fe4e
Auto merge of #50911 - petrochenkov:macuse, r=alexcrichton
...
Stabilize `use_extern_macros`
Closes https://github.com/rust-lang/rust/issues/35896
2018-08-17 19:10:34 +00:00
Corey Farwell
5c7b837c4e
Rollup merge of #53413 - eddyb:featured-in-the-latest-edition, r=varkor
...
Warn that `#![feature(rust_2018_preview)]` is implied when the edition is set to Rust 2018.
cc @varkor @petrochenkov @joshtriplett
2018-08-17 08:23:44 -07:00
Vadim Petrochenkov
a0958048b6
Stabilize use_extern_macros
2018-08-17 13:14:26 +03:00
kennytm
1cb13b296d
Rollup merge of #53412 - eddyb:stage-who, r=alexcrichton
...
syntax_ext: remove leftover span_err_if_not_stage0 macro.
I believe this is the right fix for #53380 , although I'm not sure what happened.
My guess is this copy of the macro was accidentally missed when others were removed?
cc @matthewjasper @varkor (please do not put this in a rollup, in case it fails)
2018-08-17 00:13:29 +08:00
bors
5050349749
Auto merge of #53256 - ollie27:writeln, r=KodrAus
...
Don't accept non-string literals for the format string in writeln
This is to improve diagnostics.
`println` and `eprintln` were already fixed by #52394 .
Fixes #30143
2018-08-16 13:29:40 +00:00
Eduard-Mihai Burtescu
32e17b5921
tests: prefer edition: directives to compile-flags:--edition.
2018-08-16 10:36:11 +03:00
bors
fc323ba160
Auto merge of #53293 - petrochenkov:gramattr2, r=alexcrichton
...
syntax: Enforce attribute grammar in the parser
Also fix feature-gating for `unrestricted_attribute_tokens` that was introduced in https://github.com/rust-lang/rust/pull/53270 , but was actually broken.
cc https://github.com/rust-lang/rust/pull/50911
2018-08-16 04:16:12 +00:00
Eduard-Mihai Burtescu
494889ede1
Revert "Ignore test that fails on stage1"
...
This reverts commit 0e43e6fef251732f5268738eee9c258668ec7942.
2018-08-16 02:11:44 +03:00
Matthew Jasper
0e43e6fef2
Ignore test that fails on stage1
2018-08-14 22:42:16 +01:00
Vadim Petrochenkov
097c40cf6e
syntax: Enforce attribute grammar in the parser
2018-08-15 00:05:55 +03:00
David Wood
cd12c82210
Fixed 'no such file or directory' mismatch between Windows and Linux.
2018-08-14 11:12:11 +02:00
David Wood
3fc7ab2373
Merged migrated compile-fail tests and ui tests. Fixes #46841 .
2018-08-14 11:12:09 +02:00
Oliver Middleton
7b0bafe749
Don't accept none str literals for the format string in writeln
2018-08-10 19:01:54 +01:00
Esteban Küber
f4039affa3
Suggest comma when missing in macro call
...
When missing a comma in a macro call, suggest it, regardless of
position. When a macro call doesn't match any of the patterns, check
if the call's token stream could be missing a comma between two idents,
and if so, create a new token stream containing the comma and try to
match against the macro patterns. If successful, emit the suggestion.
2018-08-07 22:31:57 -07:00
Esteban Küber
cce4ea5149
Point at correct span when missing comma in println
2018-08-06 20:54:51 -07:00
Esteban Küber
4862eee8b7
Suggest comma when writing println!("{}" a);
2018-08-06 20:26:21 -07:00
Mark Rousskov
683a3db01f
Switch to bootstrapping from 1.29 beta
2018-08-01 11:59:08 -06:00
Esteban Küber
75ff0ddb43
Use suggestions for shell format arguments
2018-07-31 14:16:36 -07:00
Mark Rousskov
2aec4e882c
Rollup merge of #52649 - estebank:fmt-span, r=oli-obk
...
Point spans to inner elements of format strings
- Point at missing positional specifiers in string literal
```
error: invalid reference to positional arguments 3, 4 and 5 (there are 3 arguments)
--> $DIR/ifmt-bad-arg.rs:34:38
|
LL | format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2);
| ^^ ^^ ^^
|
= note: positional arguments are zero-based
```
- Point at named formatting specifier in string literal
```
error: there is no argument named `foo`
--> $DIR/ifmt-bad-arg.rs:37:17
|
LL | format!("{} {foo} {} {bar} {}", 1, 2, 3);
| ^^^^^
```
- Update label for formatting string in "multiple unused formatting arguments" to be more correct
```
error: multiple unused formatting arguments
--> $DIR/ifmt-bad-arg.rs:42:17
|
LL | format!("", 1, 2); //~ ERROR: multiple unused formatting arguments
| -- ^ ^
| |
| multiple missing formatting specifiers
```
- When using `printf` string formatting, provide a structured suggestion instead of a note
```
error: multiple unused formatting arguments
--> $DIR/format-foreign.rs:12:30
|
LL | println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments
| -------------- ^^^^^^^^ ^^^^^^^ ^
| |
| multiple missing formatting specifiers
|
= note: printf formatting not supported; see the documentation for `std::fmt`
help: format specifiers in Rust are written using `{}`
|
LL | println!("{:.2$} {}!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments
| ^^^^^^ ^^
```
2018-07-26 09:18:30 -06:00
Esteban Küber
9a893cc2b8
Add span label for format str missing specifier
2018-07-24 20:46:22 -07:00
Esteban Küber
4d8aa5989c
Use suggestions for printf
format
2018-07-24 16:01:38 -07:00
Esteban Küber
f9e37625e6
Reword missing formatting arguments label
2018-07-24 09:51:04 -07:00