8000 Rollup of 10 pull requests by Centril · Pull Request #64883 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 10 pull requests #64883

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

Merged
merged 26 commits into from
Sep 29, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
68d099a
Create new error code E0734 for stability attributes used outside of …
GuillaumeGomez Sep 25, 2019
0ec4513
Fix format macro expansions spans to be macro-generated
rinon Sep 25, 2019
0ebb044
Add long error explanation for E0734
GuillaumeGomez Sep 25, 2019
2e78683
Update ui tests
GuillaumeGomez Sep 25, 2019
ecfe92f
Don't check error_codes files for lints
GuillaumeGomez Sep 27, 2019
ac9aed5
getting more context for duplicate lang items (fixes #60561)
tomtau Sep 27, 2019
f922483
Print ParamTy span when accessing a field (#52082)
Baranowski Sep 26, 2019
d35f25c
Filter out stmts made for the redundant_semicolon lint when pretty-pr…
nathanwhit Sep 12, 2019
66c33c0
Add test for redundant_semicolon lint interaction with proc macro attrs
nathanwhit Sep 28, 2019
800bd3a
data_structures: Add deterministic FxHashMap and FxHashSet wrappers
inashivb Sep 3, 2019
fd505d7
Improve wording in documentation of MaybeUninit
nliberg Sep 27, 2019
f3744a1
Implement CRs
Baranowski Sep 28, 2019
9ad99c3
Refactor into ban_nonexisting_field method
Baranowski Sep 28, 2019
f6cecce
Upgrade async/await to "used" keywords.
ehuss Sep 28, 2019
c666bd5
Fix typo in intrinsics op safety
vertexclique Sep 28, 2019
8000
e77dfa2
Slice docs: fix typo
llogiq Sep 28, 2019
b18d861
Rollup merge of #64131 - shivan1b:deterministic-fxhashmap, r=Mark-Sim…
Centril Sep 28, 2019
55a3ead
Rollup merge of #64387 - nathanwhit:redundant-semi-fix, r=varkor
Centril Sep 28, 2019
05881d0
Rollup merge of #64678 - tomtau:fix/no-std-error, r=matthewjasper
Centril Sep 28, 2019
01075d8
Rollup merge of #64763 - GuillaumeGomez:long-err-explanation-E0734, r…
Centril Sep 28, 2019
d9168e4
Rollup merge of #64793 - immunant:format_spans, r=matthewjasper
Centril Sep 28, 2019
69a3009
Rollup merge of #64837 - nliberg:patch-2, r=Centril
Centril Sep 28, 2019
6145757
Rollup merge of #64852 - Baranowski:param_note_52082, r=estebank
Centril Sep 28, 2019
787829d
Rollup merge of #64875 - ehuss:async-await-reserved, r=estebank
Centril Sep 28, 2019
1c2dd14
Rollup merge of #64876 - vertexclique:vcq/fix-fn-name-intrinsic-op-un…
Centril Sep 28, 2019
4652671
Rollup merge of #64880 - llogiq:slice-docs, r=Centril
Centril Sep 28, 2019
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
Prev Previous commit
Next Next commit
Fix format macro expansions spans to be macro-generated
New Exprs generated as part of the format macro expansion should get the macro
expansion span which has an expansion context, not the span of the format string
which does not.
  • Loading branch information
rinon committed Sep 26, 2019
commit 0ec4513d5fe23fabe353e4773682ddb341c9d20f
12 changes: 6 additions & 6 deletions src/libsyntax_ext/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ impl<'a, 'b> Context<'a, 'b> {
// Now create a vector containing all the arguments
let args = locals.into_iter().chain(counts.into_iter());

let args_array = self.ecx.expr_vec(self.fmtsp, args.collect());
let args_array = self.ecx.expr_vec(self.macsp, args.collect());

// Constructs an AST equivalent to:
//
Expand Down Expand Up @@ -724,12 +724,12 @@ impl<'a, 'b> Context<'a, 'b> {
//
// But the nested match expression is proved to perform not as well
// as series of let's; the first approach does.
let pat = self.ecx.pat_tuple(self.fmtsp, pats);
let arm = self.ecx.arm(self.fmtsp, pat, args_array);
let head = self.ecx.expr(self.fmtsp, ast::ExprKind::Tup(heads));
let result = self.ecx.expr_match(self.fmtsp, head, vec![arm]);
let pat = self.ecx.pat_tuple(self.macsp, pats);
let arm = self.ecx.arm(self.macsp, pat, args_array);
let head = self.ecx.expr(self.macsp, ast::ExprKind::Tup(heads));
let result = self.ecx.expr_match(self.macsp, head, vec![arm]);

let args_slice = self.ecx.expr_addr_of(self.fmtsp, result);
let args_slice = self.ecx.expr_addr_of(self.macsp, result);

// Now create the fmt::Arguments struct with all our locals we created.
let (fn_name, fn_args) = if self.all_pieces_simple {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-27592.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ impl ::std::fmt::Write for Stream {
fn main() {
write(|| format_args!("{}", String::from("Hello world")));
//~^ ERROR cannot return value referencing temporary value
//~| ERROR cannot return value referencing temporary value
//~| ERROR cannot return reference to temporary value
}
7 changes: 2 additions & 5 deletions src/test/ui/issues/issue-27592.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ LL | write(|| format_args!("{}", String::from("Hello world")));
| | temporary value created here
| returns a value referencing data owned by the current function

error[E0515]: cannot return value referencing temporary value
error[E0515]: cannot return reference to temporary value
--> $DIR/issue-27592.rs:16:14
|
LL | write(|| format_args!("{}", String::from("Hello world")));
| ^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
| | temporary value created here
| returns a value referencing data owned by the current function
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returns a reference to data owned by the current function

error: aborting due to 2 previous errors

Expand Down
0