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 #120560

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1eaeaaf
Add FileCheck for array_index.rs, boolean_identities.rs and cast.rs
sfzhu93 Jan 8, 2024
e05c779
Add FileCheck for checked.rs and default_boxed_slice.rs.
sfzhu93 Jan 8, 2024
33e5d85
Add FileCheck for enum.rs
sfzhu93 Jan 8, 2024
24aefa0
Add FileCheck for if.rs, inherit_overflow.rs, issue_81605.rs
sfzhu93 Jan 9, 2024
9452d7e
Add FileCheck to 3 tests: large_array_index, mult_by_zero, and offset_of
sfzhu93 Jan 9, 2024
e9152e2
Add FileCheck to 3 tests: ref_without_sb, repeat, repr_transparent
sfzhu93 Jan 9, 2024
3ab1d5d
Add FileCheck to 3 tests: self_assign_add, self_assign, and sibling_ptr
sfzhu93 Jan 9, 2024
d765e3a
Add FileCheck to slice_len.rs
sfzhu93 Jan 9, 2024
732f6a1
Add FileCheck to struct.rs
sfzhu93 Jan 9, 2024
1adda9a
Add FileCheck to terminator.rs and tuple.rs
sfzhu93 Jan 9, 2024
7135168
Add FileCheck for enum.rs
sfzhu93 Jan 8, 2024
d63f10b
resolve code reviews
sfzhu93 Jan 12, 2024
1c886d7
resolve code reviews
sfzhu93 Jan 12, 2024
cd77d59
update enum.rs for code review
sfzhu93 Jan 13, 2024
5747ece
add FIXME for default_boxed_slice.rs
sfzhu93 Jan 15, 2024
edba949
update misuse of check-label
sfzhu93 Jan 20, 2024
7ad307d
finish a pattern in `enum.rs`
sfzhu93 Jan 20, 2024
65b1083
update enum.rs
sfzhu93 Jan 23, 2024
699b59c
update terminator.rs
sfzhu93 Jan 29, 2024
44d8ecb
Only suggest removal of `as_*` and `to_` conversion methods on E0308
estebank Jan 29, 2024
f9e2a6b
Make `Diagnostic::is_error` return false for `Level::FailureNote`.
nnethercote Jan 30, 2024
8b25343
Tighten the assertion in `downgrade_to_delayed_bug`.
nnethercote Jan 31, 2024
6a48407
Remove unnecessary setting of `suppressed_expected_diag`.
nnethercote Jan 31, 2024
b38c36b
Refactor `emit_diagnostic`.
nnethercote Jan 31, 2024
23510b2
Split `Level::DelayedBug` in two.
nnethercote Jan 31, 2024
c4c22b0
On E0277 be clearer about implicit `Sized` bounds on type params and …
estebank Jan 24, 2024
95d9009
Change incr comp test when adding explicit `Sized` bound
estebank Jan 25, 2024
8b0ab54
review comment: change wording
estebank Jan 30, 2024
4feec41
`#![feature(inline_const_pat)]` is no longer incomplete
matthewjasper Feb 1, 2024
0148da3
put pnkfelix (me) back on the review queue.
pnkfelix Feb 1, 2024
02320b5
Improve the diagnostics for unused generic parameters
fmease Feb 1, 2024
bedd81e
add test for try-block-in-match-arm
Fishrock123 Feb 1, 2024
2c0030f
Correctly check `never_type` feature gating
GuillaumeGomez Feb 1, 2024
0f21e45
Update `never_type` feature gate ui test
GuillaumeGomez Feb 1, 2024
087c0be
Rollup merge of #119759 - sfzhu93:master, r=cjgillot
matthiaskrgr Feb 1, 2024
3f08692
Rollup merge of #120323 - estebank:issue-120178, r=fmease
matthiaskrgr Feb 1, 2024
80b6750
Rollup merge of #120473 - estebank:issue-114329, r=TaKO8Ki
matthiaskrgr Feb 1, 2024
ba5e754
Rollup merge of #120520 - nnethercote:rename-good-path, r=oli-obk
matthiaskrgr Feb 1, 2024
ce6bd84
Rollup merge of #120540 - Fishrock123:test-try-block-in-match-arm, r=…
matthiaskrgr Feb 1, 2024
0b3b8bf
Rollup merge of #120547 - matthewjasper:complete-inline-const-pat, r=…
matthiaskrgr Feb 1, 2024
b5f52e3
Rollup merge of #120552 - GuillaumeGomez:never-type-feature-gate, r=c…
matthiaskrgr Feb 1, 2024
c5b197e
Rollup merge of #120555 - pnkfelix:put-pnkfelix-back-on-review-queue,…
matthiaskrgr Feb 1, 2024
f63820a
Rollup merge of #120556 - fmease:improve-unused-generic-param-diags, …
matthiaskrgr Feb 1, 2024
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
13 changes: 13 additions & 0 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,19 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}
}

fn visit_generic_args(&mut self, args: &'a ast::GenericArgs) {
// This check needs to happen here because the never type can be returned from a function,
// but cannot be used in any other context. If this check was in `visit_fn_ret_ty`, it
// include both functions and generics like `impl Fn() -> !`.
if let ast::GenericArgs::Parenthesized(generic_args) = args
&& let ast::FnRetTy::Ty(ref ty) = generic_args.output
&& matches!(ty.kind, ast::TyKind::Never)
{
gate!(&self, never_type, ty.span, "the `!` type is experimental");
}
visit::walk_generic_args(self, args);
}

fn visit_expr(&mut self, e: &'a ast::Expr) {
match e.kind {
ast::ExprKind::TryBlock(_) => {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_error_codes/src/error_codes/E0091.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
An unnecessary type or const parameter was given in a type alias.
An unnecessary type parameter was given in a type alias.

Erroneous code example:

```compile_fail,E0091
type Foo<T> = u32; // error: type parameter `T` is unused
type Foo<T> = u32; // error: type parameter `T` is never used
// or:
type Foo<A,B> = Box<A>; // error: type parameter `B` is unused
type Foo<A, B> = Box<A>; // error: type parameter `B` is never used
```

Please check you didn't write too many parameters. Example:
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl From<Cow<'static, str>> for DiagnosticMessage {
}
}

/// A workaround for "good path" ICEs when formatting types in disabled lints.
/// A workaround for good_path_delayed_bug ICEs when formatting types in disabled lints.
///
/// Delays formatting until `.into(): DiagnosticMessage` is used.
pub struct DelayDm<F>(pub F);
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ fn source_string(file: Lrc<SourceFile>, line: &Line) -> String {
/// Maps `Diagnostic::Level` to `snippet::AnnotationType`
fn annotation_type_for_level(level: Level) -> AnnotationType {
match level {
Level::Bug | Level::DelayedBug(_) | Level::Fatal | Level::Error => AnnotationType::Error,
Level::Bug
| Level::Fatal
| Level::Error
| Level::DelayedBug
| Level::GoodPathDelayedBug => AnnotationType::Error,
Level::ForceWarning(_) | Level::Warning => AnnotationType::Warning,
Level::Note | Level::OnceNote => AnnotationType::Note,
Level::Help | Level::OnceHelp => AnnotationType::Help,
Expand Down
20 changes: 8 additions & 12 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::snippet::Style;
use crate::{
CodeSuggestion, DelayedBugKind, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee,
ErrCode, Level, MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart,
SuggestionStyle,
CodeSuggestion, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, ErrCode, Level,
MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart, SuggestionStyle,
};
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
use rustc_error_messages::fluent_value_from_str_list_sep_by_and;
Expand Down Expand Up @@ -233,19 +232,16 @@ impl Diagnostic {

pub fn is_error(&self) -> bool {
match self.level {
Level::Bug
| Level::DelayedBug(DelayedBugKind::Normal)
| Level::Fatal
| Level::Error
| Level::FailureNote => true,
Level::Bug | Level::Fatal | Level::Error | Level::DelayedBug => true,

Level::ForceWarning(_)
Level::GoodPathDelayedBug
| Level::ForceWarning(_)
| Level::Warning
| Level::DelayedBug(DelayedBugKind::GoodPath)
| Level::Note
| Level::OnceNote
| Level::Help
| Level::OnceHelp
| Level::FailureNote
| Level::Allow
| Level::Expect(_) => false,
}
Expand Down Expand Up @@ -304,11 +300,11 @@ impl Diagnostic {
#[track_caller]
pub fn downgrade_to_delayed_bug(&mut self) {
assert!(
self.is_error(),
matches!(self.level, Level::Error | Level::DelayedBug),
"downgrade_to_delayed_bug: cannot downgrade {:?} to DelayedBug: not an error",
self.level
);
self.level = Level::DelayedBug(DelayedBugKind::Normal);
self.level = Level::DelayedBug;
}

/// Appends a labeled span to the diagnostic.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,7 @@ impl HumanEmitter {
}
if !self.short_message {
for child in children {
assert!(child.level.can_be_top_or_sub().1);
let span = &child.span;
if let Err(err) = self.emit_messages_default_inner(
span,
Expand Down
Loading
Loading