Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4272f1b
get rid of nontrivial_structural_match lint and custom_eq const qualif
RalfJung Jan 27, 2024
32e4862
show indirect_structural_match and pointer_structural_match in future…
RalfJung Jan 27, 2024
0808691
update the tracking issue for structural match violations
RalfJung Jan 27, 2024
efbfb04
merge the accepted-structural-match tests into one
RalfJung Jan 28, 2024
c367983
Suggest name value cfg when only value is used for check-cfg
chenyukang Jan 28, 2024
0213c87
limit the names_possiblilities to less than 3
chenyukang Jan 30, 2024
ca243e7
add testcase for more than 3 cfg names
chenyukang Jan 30, 2024
d34b0fa
Add test for method on unbounded type parameter receiver
estebank Jan 26, 2024
20b1c2a
Account for unbounded type param receiver in suggestions
estebank Jan 26, 2024
9ccc770
fix rebase
estebank Jan 30, 2024
5c41409
Account for non-overlapping unmet trait bounds in suggestion
estebank Jan 30, 2024
0f55e1b
Simplify `impl_zeroable_primitive` macro.
reitermarkus Jan 31, 2024
a5042de
Make `NonZero` constructors generic.
reitermarkus Jan 22, 2024
3cc601a
Switch OwnedStore handle count to AtomicU32
GnomedDev Jan 31, 2024
a2a3c61
Already poison the `type_of` result of the anon const used in the `ty…
oli-obk Feb 1, 2024
009f970
inline a function that is only used in clippy
oli-obk Feb 1, 2024
0c4d089
Taint borrowck results without running any borrowck if the MIR body w…
oli-obk Feb 1, 2024
0f3976b
Continue to borrowck even if there were previous errors
oli-obk Feb 1, 2024
6fb1566
Simplify codegen diagnostic handling.
nnethercote Feb 2, 2024
4c038bd
Remove `SharedEmitterMessage::AbortIfErrors`.
nnethercote Feb 2, 2024
f4dce1e
Make `Emitter::emit_diagnostic` consuming.
nnethercote Feb 2, 2024
9adcd19
Rollup merge of #120396 - estebank:method-on-unbounded-type-param, r=…
matthiaskrgr Feb 5, 2024
e01ee4c
Rollup merge of #120423 - RalfJung:indirect-structural-match, r=petro…
matthiaskrgr Feb 5, 2024
0acfc79
Rollup merge of #120435 - chenyukang:yukang-fix-120427-cfg-name, r=Ur…
matthiaskrgr Feb 5, 2024
d4f90d3
Rollup merge of #120507 - estebank:issue-108428, r=davidtwco
matthiaskrgr Feb 5, 2024
5e7fb36
Rollup merge of #120521 - reitermarkus:generic-nonzero-constructors, …
matthiaskrgr Feb 5, 2024
a66a9f6
Rollup merge of #120527 - GnomedDev:atomicu32-handle, r=petrochenkov
matthiaskrgr Feb 5, 2024
749af61
Rollup merge of #120550 - oli-obk:track_errors8, r=estebank
matthiaskrgr Feb 5, 2024
bc0d618
Rollup merge of #120575 - nnethercote:simplify-codegen-diag-handling,…
matthiaskrgr Feb 5, 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
Prev Previous commit
Next Next commit
Continue to borrowck even if there were previous errors
  • Loading branch information
oli-obk committed Feb 2, 2024
commit 0f3976bdbbbee0f9088015ce1e2557a456d696c5
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {

tcx.ensure().check_unused_traits(());

if let Some(reported) = tcx.dcx().has_errors() { Err(reported) } else { Ok(()) }
Ok(())
}

/// A quasi-deprecated helper used in rustdoc and clippy to get
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_mir_build/src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,12 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) -
))),
)
}
_ => {
span_bug!(span, "expected type of closure body to be a closure or coroutine");
ty::Error(_) => (vec![closure_ty, closure_ty], closure_ty, None),
kind => {
span_bug!(
span,
"expected type of closure body to be a closure or coroutine, got {kind:?}"
);
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion compiler/rustc_mir_build/src/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let drops = if destination.is_some() {
&mut self.scopes.breakable_scopes[break_index].break_drops
} else {
self.scopes.breakable_scopes[break_index].continue_drops.as_mut().unwrap()
let Some(drops) = self.scopes.breakable_scopes[break_index].continue_drops.as_mut()
else {
self.tcx.dcx().span_delayed_bug(
source_info.span,
"unlabelled `continue` within labelled block",
);
self.cfg.terminate(block, source_info, TerminatorKind::Unreachable);

return self.cfg.start_new_block().unit();
};
drops
};

let drop_idx = self.scopes.scopes[scope_index + 1..]
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_mir_transform/src/ffi_unwind_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
ty::FnDef(..) => body_ty.fn_sig(tcx).abi(),
ty::Closure(..) => Abi::RustCall,
ty::Coroutine(..) => Abi::Rust,
ty::Error(_) => return false,
_ => span_bug!(body.span, "unexpected body ty: {:?}", body_ty),
};
let body_can_unwind = layout::fn_can_unwind(tcx, Some(def_id), body_abi);
Expand Down
12 changes: 11 additions & 1 deletion compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2911,12 +2911,22 @@ impl<'a> Parser<'a> {
Ok(arm) => arms.push(arm),
Err(e) => {
// Recover by skipping to the end of the block.
e.emit();
let guar = e.emit();
self.recover_stmt();
let span = lo.to(self.token.span);
if self.token == token::CloseDelim(Delimiter::Brace) {
self.bump();
}
// Always push at least one arm to make the match non-empty
arms.push(Arm {
attrs: Default::default(),
pat: self.mk_pat(span, ast::PatKind::Err(guar)),
guard: None,
body: Some(self.mk_expr_err(span)),
span,
id: DUMMY_NODE_ID,
is_placeholder: false,
});
return Ok(self.mk_expr_with_attrs(
span,
ExprKind::Match(scrutinee, arms),
Expand Down
10 changes: 6 additions & 4 deletions compiler/rustc_passes/src/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ enum LiveNodeKind {
VarDefNode(Span, HirId),
ClosureNode,
ExitNode,
ErrNode,
}

fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_>) -> String {
Expand All @@ -133,6 +134,7 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_>) -> String {
VarDefNode(s, _) => format!("Var def node [{}]", sm.span_to_diagnostic_string(s)),
ClosureNode => "Closure node".to_owned(),
ExitNode => "Exit node".to_owned(),
ErrNode => "Error node".to_owned(),
}
}

Expand Down Expand Up @@ -962,10 +964,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {

// Now that we know the label we're going to,
// look it up in the continue loop nodes table
self.cont_ln
.get(&sc)
.cloned()
.unwrap_or_else(|| span_bug!(expr.span, "continue to unknown label"))
self.cont_ln.get(&sc).cloned().unwrap_or_else(|| {
self.ir.tcx.dcx().span_delayed_bug(expr.span, "continue to unknown label");
self.ir.add_live_node(ErrNode)
})
}

hir::ExprKind::Assign(ref l, ref r, _) => {
Expand Down
3 changes: 3 additions & 0 deletions tests/incremental/const-generics/issue-62536.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// revisions:cfail1

#![allow(unused_variables)]

struct S<T, const N: usize>([T; N]);

fn f<T, const N: usize>(x: T) -> S<T, {N}> { panic!() }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// revisions: cfail
#![feature(generic_const_exprs)]
#![allow(incomplete_features, unused_braces)]
#![allow(incomplete_features, unused_braces, unused_variables)]

trait Delegates<T> {}

Expand Down
1 change: 1 addition & 0 deletions tests/incremental/struct_change_field_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// [cfail2] compile-flags: -Z query-dep-graph -Z assert-incr-state=loaded

#![feature(rustc_attrs)]
#![allow(unused_variables)]

#[cfg(rpass1)]
pub struct X {
Expand Down
52 changes: 26 additions & 26 deletions tests/ui/asm/bad-template.aarch64.stderr
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:27:15
--> $DIR/bad-template.rs:30:15
|
LL | asm!("{}");
| ^^ from here
|
= note: no arguments were given

error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:29:15
--> $DIR/bad-template.rs:32:15
|
LL | asm!("{1}", in(reg) foo);
| ^^^ from here
|
= note: there is 1 argument

error: argument never used
--> $DIR/bad-template.rs:29:21
--> $DIR/bad-template.rs:32:21
|
LL | asm!("{1}", in(reg) foo);
| ^^^^^^^^^^^ argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`

error: there is no argument named `a`
--> $DIR/bad-template.rs:32:16
--> $DIR/bad-template.rs:35:16
|
LL | asm!("{a}");
| ^

error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:34:15
--> $DIR/bad-template.rs:37:15
|
LL | asm!("{}", a = in(reg) foo);
| ^^ --------------- named argument
Expand All @@ -38,37 +38,37 @@ LL | asm!("{}", a = in(reg) foo);
|
= note: no positional arguments were given
note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:34:20
--> $DIR/bad-template.rs:37:20
|
LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^

error: named argument never used
--> $DIR/bad-template.rs:34:20
--> $DIR/bad-template.rs:37:20
|
LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`

error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:37:15
--> $DIR/bad-template.rs:40:15
|
LL | asm!("{1}", a = in(reg) foo);
| ^^^ from here
|
= note: no positional arguments were given

error: named argument never used
--> $DIR/bad-template.rs:37:21
--> $DIR/bad-template.rs:40:21
|
LL | asm!("{1}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`

error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:44:15
--> $DIR/bad-template.rs:47:15
|
LL | asm!("{}", in("x0") foo);
| ^^ ------------ explicit register argument
Expand All @@ -77,24 +77,24 @@ LL | asm!("{}", in("x0") foo);
|
= note: no positional arguments were given
note: explicit register arguments cannot be used in the asm template
--> $DIR/bad-template.rs:44:20
--> $DIR/bad-template.rs:47:20
|
LL | asm!("{}", in("x0") foo);
| ^^^^^^^^^^^^
help: use the register name directly in the assembly code
--> $DIR/bad-template.rs:44:20
--> $DIR/bad-template.rs:47:20
|
LL | asm!("{}", in("x0") foo);
| ^^^^^^^^^^^^

error: asm template modifier must be a single character
--> $DIR/bad-template.rs:46:17
--> $DIR/bad-template.rs:49:17
|
LL | asm!("{:foo}", in(reg) foo);
| ^^^

error: multiple unused asm arguments
--> $DIR/bad-template.rs:49:18
--> $DIR/bad-template.rs:52:18
|
LL | asm!("", in(reg) 0, in(reg) 1);
| ^^^^^^^^^ ^^^^^^^^^ argument never used
Expand All @@ -104,37 +104,37 @@ LL | asm!("", in(reg) 0, in(reg) 1);
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`

error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:55:14
--> $DIR/bad-template.rs:58:14
|
LL | global_asm!("{}");
| ^^ from here
|
= note: no arguments were given

error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:57:14
--> $DIR/bad-template.rs:60:14
|
LL | global_asm!("{1}", const FOO);
| ^^^ from here
|
= note: there is 1 argument

error: argument never used
--> $DIR/bad-template.rs:57:20
--> $DIR/bad-template.rs:60:20
|
LL | global_asm!("{1}", const FOO);
| ^^^^^^^^^ argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`

error: there is no argument named `a`
--> $DIR/bad-template.rs:60:15
--> $DIR/bad-template.rs:63:15
|
LL | global_asm!("{a}");
| ^

error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:62:14
--> $DIR/bad-template.rs:65:14
|
LL | global_asm!("{}", a = const FOO);
| ^^ ------------- named argument
Expand All @@ -143,43 +143,43 @@ LL | global_asm!("{}", a = const FOO);
|
= note: no positional arguments were given
note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:62:19
--> $DIR/bad-template.rs:65:19
|
LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^

error: named argument never used
--> $DIR/bad-template.rs:62:19
--> $DIR/bad-template.rs:65:19
|
LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`

error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:65:14
--> $DIR/bad-template.rs:68:14
|
LL | global_asm!("{1}", a = const FOO);
| ^^^ from here
|
= note: no positional arguments were given

error: named argument never used
--> $DIR/bad-template.rs:65:20
--> $DIR/bad-template.rs:68:20
|
LL | global_asm!("{1}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`

error: asm template modifier must be a single character
--> $DIR/bad-template.rs:68:16
--> $DIR/bad-template.rs:71:16
|
LL | global_asm!("{:foo}", const FOO);
| ^^^

error: multiple unused asm arguments
--> $DIR/bad-template.rs:70:17
--> $DIR/bad-template.rs:73:17
|
LL | global_asm!("", const FOO, const FOO);
| ^^^^^^^^^ ^^^^^^^^^ argument never used
Expand All @@ -189,7 +189,7 @@ LL | global_asm!("", const FOO, const FOO);
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`

warning: formatting may not be suitable for sub-register argument
--> $DIR/bad-template.rs:46:15
--> $DIR/bad-template.rs:49:15
|
LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/asm/bad-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ macro_rules! global_asm {
#[lang = "sized"]
trait Sized {}

#[lang = "copy"]
trait Copy {}

fn main() {
let mut foo = 0;
unsafe {
Expand Down
Loading