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 6 pull requests #96476

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fc6af81
Make EncodeWide implement FusedIterator
AronParker Apr 25, 2022
eb55cdc
use `ParseSess` instead of `Session` in `into_diagnostic`
pvdrz Apr 25, 2022
519dd8e
migrate ambiguous plus diagnostic
pvdrz Apr 25, 2022
d6da5fb
update lockfile
pvdrz Apr 25, 2022
5874b09
fix formatting
pvdrz Apr 25, 2022
530f4dc
remove old code
pvdrz Apr 25, 2022
2e261a8
add `struct_warn` method
pvdrz Apr 25, 2022
8bd0a85
:arrow_up: rust-analyzer
lnicola Apr 26, 2022
35b42cb
avoid `format!`
pvdrz Apr 26, 2022
6c3e793
move `AmbigousPlus` outside
pvdrz Apr 26, 2022
1e35bab
separate messages by a newline
pvdrz Apr 26, 2022
843e8d1
not need `Option` for `dbg_scope`
SparrowLii Apr 26, 2022
f0bbc78
Avoid producing `NoDelim` values in `TokenCursorFrame`.
nnethercote Apr 26, 2022
6b367a0
Avoid producing `NoDelim` values in `MacArgs::delim()`.
nnethercote Apr 26, 2022
a8e862c
Avoid producing `NoDelim` values in `Frame`.
nnethercote Apr 26, 2022
9665da3
Avoid producing `NoDelim` values in `FrameData`.
nnethercote Apr 26, 2022
86f0117
Make explicit an unreachable `NoDelim` case in `rustfmt`.
nnethercote Apr 26, 2022
ae42f22
make `fn() -> _ {}` suggestion MachineApplicable
compiler-errors Apr 25, 2022
f9e7489
TAITs are suggestable
compiler-errors Apr 25, 2022
e7ae9eb
rename `sum_with_parens`
pvdrz Apr 27, 2022
07b0a57
Rollup merge of #96377 - compiler-errors:infer-rustfix, r=petrochenkov
Dylan-DPC Apr 27, 2022
e564d74
Rollup merge of #96397 - AronParker:issue-96368-fix, r=dtolnay
Dylan-DPC Apr 27, 2022
feca2c3
Rollup merge of #96405 - pvdrz:ambiguous-plus-diagnostic, r=davidtwco
Dylan-DPC Apr 27, 2022
78c1bb0
Rollup merge of #96419 - lnicola:rust-analyzer-2022-04-26, r=lnicola
Dylan-DPC Apr 27, 2022
0f79041
Rollup merge of #96421 - nnethercote:less-NoDelim, r=petrochenkov
Dylan-DPC Apr 27, 2022
86c98d2
Rollup merge of #96432 - SparrowLii:dbg_scope, r=davidtwco
Dylan-DPC Apr 27, 2022
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
move AmbigousPlus outside
  • Loading branch information
pvdrz committed Apr 26, 2022

Verified

This commit was signed with the committer’s verified signature.
nobu Nobuyoshi Nakada
commit 6c3e793fb3303878790a6e872e8fa8bc1e4ef4e9
19 changes: 10 additions & 9 deletions compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -242,6 +242,16 @@ impl MultiSugg {
err.multipart_suggestions(msg, suggestions.map(|s| s.patches), applicability);
}
}

#[derive(SessionDiagnostic)]
#[error(slug = "parser-maybe-report-ambiguous-plus")]
struct AmbiguousPlus {
pub sum_with_parens: String,
#[primary_span]
#[suggestion(code = "({sum_with_parens})")]
pub span: Span,
}

// SnapshotParser is used to create a snapshot of the parser
// without causing duplicate errors being emitted when the `Parser`
// is dropped.
@@ -1171,15 +1181,6 @@ impl<'a> Parser<'a> {
impl_dyn_multi: bool,
ty: &Ty,
) {
#[derive(SessionDiagnostic)]
#[error(slug = "parser-maybe-report-ambiguous-plus")]
struct AmbiguousPlus {
pub sum_with_parens: String,
#[primary_span]
#[suggestion(code = "({sum_with_parens})")]
pub span: Span,
}

if matches!(allow_plus, AllowPlus::No) && impl_dyn_multi {
self.sess.emit_err(AmbiguousPlus {
sum_with_parens: pprust::ty_to_string(&ty),