Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #113391

Merged
merged 27 commits into from
Jul 6, 2023
Merged
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
03e64f4
style-guide: Document newline rules for assignment operators
joshtriplett Jun 29, 2023
bf5eaa4
llvm ffi: Expose `CallInst->setTailCallKind`
WaffleLapkin May 9, 2023
f25463e
Fix the issue of wrong diagnosis for extern pub fn
chenyukang Jul 5, 2023
8efd9cc
resolve: Use `Interned` for `NameBinding`
petrochenkov Jul 4, 2023
4abdaeb
resolve: Use `Interned` for `Import`
petrochenkov Jul 4, 2023
c1f412f
resolve: Use `Interned` for `Module`
petrochenkov Jul 4, 2023
9f3fba8
resolve: Add comments explaining use of `Interned`
petrochenkov Jul 5, 2023
c6643b5
Revert the lexing of c_str_literals
fmease Jul 4, 2023
5b25f9d
Revert "fix ptr cast"
fmease Jul 4, 2023
9dbe67f
Revert "use c literals in library"
fmease Jul 4, 2023
3788b7a
Revert "use new c literals instead of cstr! macro"
fmease Jul 4, 2023
22fd6a6
Add regression test
fmease Jul 4, 2023
6c7017f
Fix submodule handling when the current branch is named after a tag
jyn514 Jul 5, 2023
40f2fbf
Add a regression test for #112895
JohnTitor Jun 29, 2023
5a6c618
Clarify that style guide does not cover nightly-only features
compiler-errors May 3, 2023
5957f02
style-guide: Add chapter for nightly formatting
joshtriplett Jun 22, 2023
cde67f6
style-guide: Clarify grammar for small patterns (not a semantic change)
joshtriplett Jul 5, 2023
79df44b
style-guide: Rename "smallntp" non-terminal to "small_no_tuple" for c…
joshtriplett Jul 5, 2023
6e9bdac
Rollup merge of #111119 - compiler-errors:style-nightly, r=joshtriplett
fee1-dead Jul 6, 2023
e461502
Rollup merge of #112791 - WaffleLapkin:wag_the_llvm, r=cuviper
fee1-dead Jul 6, 2023
baba904
Rollup merge of #113145 - joshtriplett:style-guide-document-assignmen…
fee1-dead Jul 6, 2023
a105aa2
Rollup merge of #113163 - JohnTitor:issue-112895, r=compiler-errors
fee1-dead Jul 6, 2023
0162726
Rollup merge of #113332 - petrochenkov:bindintern, r=cjgillot
fee1-dead Jul 6, 2023
1830b80
Rollup merge of #113334 - fmease:revert-lexing-c-str-lits, r=compiler…
fee1-dead Jul 6, 2023
2bc0ae3
Rollup merge of #113350 - chenyukang:yukang-fix-113342-parser, r=comp…
fee1-dead Jul 6, 2023
70e8f9d
Rollup merge of #113371 - jyn514:submodule-with-tags, r=albertlarsan68
fee1-dead Jul 6, 2023
c668eb0
Rollup merge of #113384 - joshtriplett:style-guide-grammar, r=compile…
fee1-dead Jul 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/rustc_parse/src/parser/item.rs
Original file line number Diff line number Diff line change
@@ -2182,7 +2182,11 @@ impl<'a> Parser<'a> {
// `extern ABI fn`
|| self.check_keyword_case(kw::Extern, case)
&& self.look_ahead(1, |t| t.can_begin_literal_maybe_minus())
&& self.look_ahead(2, |t| t.is_keyword_case(kw::Fn, case))
&& (self.look_ahead(2, |t| t.is_keyword_case(kw::Fn, case)) ||
// this branch is only for better diagnostic in later, `pub` is not allowed here
(self.may_recover()
&& self.look_ahead(2, |t| t.is_keyword(kw::Pub))
&& self.look_ahead(3, |t| t.is_keyword_case(kw::Fn, case))))
}

/// Parses all the "front matter" (or "qualifiers") for a `fn` declaration,
9 changes: 9 additions & 0 deletions tests/ui/parser/issue-113342.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[link(name = "my_c_library")]
extern "C" {
fn my_c_function(x: i32) -> bool;
}

#[no_mangle]
extern "C" pub fn id(x: i32) -> i32 { x } //~ ERROR expected `fn`, found keyword `pub`

fn main() {}
11 changes: 11 additions & 0 deletions tests/ui/parser/issue-113342.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: expected `fn`, found keyword `pub`
--> $DIR/issue-113342.rs:7:12
|
LL | extern "C" pub fn id(x: i32) -> i32 { x }
| -----------^^^
| | |
| | expected `fn`
| help: visibility `pub` must come before `extern "C"`: `pub extern "C"`

error: aborting due to previous error