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 20 pull requests #121164

Closed
wants to merge 78 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
fee4992
Make File::read_to_end less special
kornelski Jan 31, 2024
0a42a54
Make `io::BorrowedCursor::advance` safe
a1phyr Feb 7, 2024
24e2cf0
Make `NonZero::get` generic.
reitermarkus Feb 1, 2024
d51e703
As Windows 10 requires certain features like CMPXCHG16B and a few oth…
CKingX Feb 9, 2024
d6766e2
Update x86_64_pc_windows_msvc.rs
CKingX Feb 9, 2024
01fa720
Bump Unicode to version 15.1.0, regenerate tables
Marcondiro Feb 8, 2024
fcb06f7
Update x86_64_pc_windows_msvc.rs
CKingX Feb 9, 2024
abeac8f
Update x86_64_uwp_windows_gnu.rs
CKingX Feb 9, 2024
1c6dda7
Possibly removed merge policy
CKingX Feb 9, 2024
0eee945
Make `is_intrinsic` query return the intrinsic name
oli-obk Jan 30, 2024
92281c7
Implement intrinsics with fallback bodies
oli-obk Jan 30, 2024
79daf61
Make the signature of equate_intrinsic_type support items other than …
oli-obk Jan 31, 2024
fffcb4c
Fix comment in core/src/str/validations.rs
PizzasBear Feb 12, 2024
09fd556
Make check_intrinsic_type not require ForeignItems anymore
oli-obk Jan 31, 2024
0dac617
support adding const generic params to intrinsics
oli-obk Jan 31, 2024
531505f
Check signature of intrinsics with fallback bodies
oli-obk Jan 31, 2024
8549c0a
Add intrinsic body fallback to cranelift and use it
oli-obk Jan 31, 2024
55200e7
Do the entire ReturnDest computation within make_return_dest
oli-obk Jan 31, 2024
432635a
Create ret_dest as late as possible in all code paths
oli-obk Jan 31, 2024
9a07437
Teach llvm backend how to fall back to default bodies
oli-obk Jan 31, 2024
6b73fe2
Give const_deallocate a default body
oli-obk Jan 31, 2024
f35a2bd
Support safe intrinsics with fallback bodies
oli-obk Feb 2, 2024
164b9c3
Add more tests
oli-obk Feb 2, 2024
376c7b9
Added sahf feature to windows targets
CKingX Feb 13, 2024
b16ff5c
Add `rustc_confusables` annotations to some stdlib APIs
estebank Feb 7, 2024
739edce
On type error of method call arguments, look at confusables for sugge…
estebank Feb 7, 2024
c5e9be4
drive-by fmt cleanup
estebank Feb 9, 2024
919b429
Provide more and more accurate suggestions when calling the wrong method
estebank Feb 9, 2024
84683fd
Consider methods from traits when suggesting typos
estebank Feb 10, 2024
274d929
Make confusable suggestions `verbose`
estebank Feb 10, 2024
e4820c5
fix test
estebank Feb 13, 2024
f5cd3df
Better account for associated const found for fn call expr
estebank Feb 13, 2024
ac23b72
Tweak wording of "implemented trait isn't imported" suggestion
estebank Feb 13, 2024
b49aa7c
Add `flatmap`/`flat_map` -> `and_then` suggestions
estebank Feb 14, 2024
997351d
review comments: clean up
estebank Feb 14, 2024
04884bc
Deduplicate some logic and reword output
estebank Feb 14, 2024
6139f99
fix test
estebank Feb 14, 2024
9a950a5
review comment: remove unnused return value
estebank Feb 14, 2024
5233bc9
Add an `ErrorGuaranteed` to `ast::TyKind::Err`.
nnethercote Feb 14, 2024
746a58d
Use generic `NonZero` internally.
reitermarkus Jan 29, 2024
a90cc05
Replace `NonZero::<_>::new` with `NonZero::new`.
reitermarkus Feb 8, 2024
b80fc5d
errors: only eagerly translate subdiagnostics
davidtwco Feb 14, 2024
bd546fb
add extra indent spaces for rust-playground link
chenyukang Feb 14, 2024
b277772
Improve wording of static_mut_ref
obeis Feb 15, 2024
3b791a4
simplify codegen for trivially droppable types
Nov 23, 2023
fe9bc1b
reduce amount of math
Nov 23, 2023
b13c926
reduce branchiness
Nov 23, 2023
064f972
outline large copies
Nov 23, 2023
a77d6b9
add codegen test
Nov 23, 2023
da1c7f6
address review comments
Feb 11, 2024
cc7b4e0
Update aarch64 target feature docs to match LLVM
adamgemmell Jan 25, 2024
5d65b19
Avoid debug logging entire MIR body
tmiasko Feb 15, 2024
c763f83
Only point out non-diverging arms for match suggestions
compiler-errors Feb 15, 2024
acb201a
make better async fn kind errors
compiler-errors Feb 14, 2024
6018e21
Remove a suggestion that is redundant
compiler-errors Feb 15, 2024
fdc56b6
doc: add note before panicking examples for strict_overflow_ops
tspiteri Feb 15, 2024
675d092
doc: panicking division by zero examples for unsigned strict div ops
tspiteri Feb 15, 2024
954d565
Fix closure kind docs
compiler-errors Feb 15, 2024
6be0e7e
Rollup merge of #118264 - lukas-code:optimized-draining, r=the8472
oli-obk Feb 15, 2024
eacf4b7
Rollup merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnay
oli-obk Feb 15, 2024
7fda64d
Rollup merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin
oli-obk Feb 15, 2024
acd9bbb
Rollup merge of #120538 - kornelski:read-not-exact, r=m-ou-se
oli-obk Feb 15, 2024
1f1d765
Rollup merge of #120563 - reitermarkus:generic-nonzero-get, r=dtolnay
oli-obk Feb 15, 2024
c461e3b
Rollup merge of #120730 - estebank:confusable-api, r=oli-obk
oli-obk Feb 15, 2024
ee4e474
Rollup merge of #120741 - a1phyr:safe_buffer_advance, r=m-ou-se
oli-obk Feb 15, 2024
c0e421a
Rollup merge of #120777 - Marcondiro:unicode15-1, r=Manishearth
oli-obk Feb 15, 2024
f472e93
Rollup merge of #120820 - CKingX:cpu-base-minimum, r=petrochenkov
oli-obk Feb 15, 2024
e0b3180
Rollup merge of #120971 - PizzasBear:patch-1, r=Nilstrieb
oli-obk Feb 15, 2024
0baee2a
Rollup merge of #121034 - obeis:improve-static-mut-ref, r=RalfJung
oli-obk Feb 15, 2024
fcfe7c1
Rollup merge of #121085 - davidtwco:always-eager-diagnostics, r=nneth…
oli-obk Feb 15, 2024
9b2f5fe
Rollup merge of #121095 - chenyukang:yukang-fix-120998-rust-playgroun…
oli-obk Feb 15, 2024
09a0938
Rollup merge of #121109 - nnethercote:TyKind-Err-guar-2, r=oli-obk
oli-obk Feb 15, 2024
c754b58
Rollup merge of #121119 - compiler-errors:async-fn-kind-errs, r=oli-obk
oli-obk Feb 15, 2024
a2d4641
Rollup merge of #121141 - compiler-errors:closure-kind-docs, r=nnethe…
oli-obk Feb 15, 2024
0659419
Rollup merge of #121145 - adamgemmell:dev/adagem01/combined-target-fe…
oli-obk Feb 15, 2024
f8d1ee8
Rollup merge of #121146 - compiler-errors:ignore-diverging-arms, r=es…
oli-obk Feb 15, 2024
7902d33
Rollup merge of #121147 - tmiasko:no-debug-body, r=compiler-errors
oli-obk Feb 15, 2024
f4df330
Rollup merge of #121155 - tspiteri:strict-doc-overflow, r=Nilstrieb
oli-obk Feb 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2136,10 +2136,12 @@ pub enum TyKind {
ImplicitSelf,
/// A macro in the type position.
MacCall(P<MacCall>),
/// Placeholder for a kind that has failed to be defined.
Err,
/// Placeholder for a `va_list`.
CVarArgs,
/// Sometimes we need a dummy value when no error has occurred.
Dummy,
/// Placeholder for a kind that has failed to be defined.
Err(ErrorGuaranteed),
}

impl TyKind {
Expand Down
9 changes: 7 additions & 2 deletions compiler/rustc_ast/src/mut_visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,12 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
let Ty { id, kind, span, tokens } = ty.deref_mut();
vis.visit_id(id);
match kind {
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | TyKind::Never | TyKind::CVarArgs => {}
TyKind::Infer
| TyKind::ImplicitSelf
| TyKind::Err(_)
| TyKind::Dummy
| TyKind::Never
| TyKind::CVarArgs => {}
TyKind::Slice(ty) => vis.visit_ty(ty),
TyKind::Ptr(mt) => vis.visit_mt(mt),
TyKind::Ref(lt, mt) => {
Expand Down Expand Up @@ -1649,7 +1654,7 @@ impl DummyAstNode for Ty {
fn dummy() -> Self {
Ty {
id: DUMMY_NODE_ID,
kind: TyKind::Err,
kind: TyKind::Dummy,
span: Default::default(),
tokens: Default::default(),
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Impl);
}
TyKind::Typeof(expression) => visitor.visit_anon_const(expression),
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err => {}
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Dummy | TyKind::Err(_) => {}
TyKind::MacCall(mac) => visitor.visit_mac_call(mac),
TyKind::Never | TyKind::CVarArgs => {}
TyKind::AnonStruct(_, ref fields) | TyKind::AnonUnion(_, ref fields) => {
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
fn lower_ty_direct(&mut self, t: &Ty, itctx: ImplTraitContext) -> hir::Ty<'hir> {
let kind = match &t.kind {
TyKind::Infer => hir::TyKind::Infer,
TyKind::Err => hir::TyKind::Err(self.dcx().has_errors().unwrap()),
TyKind::Err(guar) => hir::TyKind::Err(*guar),
// Lower the anonymous structs or unions in a nested lowering context.
//
// ```
Expand Down Expand Up @@ -1504,6 +1504,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
);
hir::TyKind::Err(guar)
}
TyKind::Dummy => panic!("`TyKind::Dummy` should never be lowered"),
};

hir::Ty { kind, span: self.lower_span(t.span), hir_id: self.lower_node_id(t.id) }
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,8 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
&item.vis,
errors::VisibilityNotPermittedNote::TraitImpl,
);
if let TyKind::Err = self_ty.kind {
// njn: use Dummy here
if let TyKind::Err(_) = self_ty.kind {
this.dcx().emit_err(errors::ObsoleteAuto { span: item.span });
}
if let (&Unsafe::Yes(span), &ImplPolarity::Negative(sp)) = (unsafety, polarity)
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1048,11 +1048,16 @@ impl<'a> State<'a> {
ast::TyKind::Infer => {
self.word("_");
}
ast::TyKind::Err => {
ast::TyKind::Err(_) => {
self.popen();
self.word("/*ERROR*/");
self.pclose();
}
ast::TyKind::Dummy => {
self.popen();
self.word("/*DUMMY*/");
self.pclose();
}
ast::TyKind::ImplicitSelf => {
self.word("Self");
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_session::parse::feature_err;
use rustc_session::{RustcVersion, Session};
use rustc_span::hygiene::Transparency;
use rustc_span::{symbol::sym, symbol::Symbol, Span};
use std::num::NonZeroU32;
use std::num::NonZero;

use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause};

Expand Down Expand Up @@ -113,7 +113,7 @@ pub enum StabilityLevel {
/// Reason for the current stability level.
reason: UnstableReason,
/// Relevant `rust-lang/rust` issue.
issue: Option<NonZeroU32>,
issue: Option<NonZero<u32>>,
is_soft: bool,
/// If part of a feature is stabilized and a new feature is added for the remaining parts,
/// then the `implied_by` attribute is used to indicate which now-stable feature previously
Expand Down Expand Up @@ -442,7 +442,7 @@ fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabil
// is a name/value pair string literal.
issue_num = match issue.unwrap().as_str() {
"none" => None,
issue => match issue.parse::<NonZeroU32>() {
issue => match issue.parse::<NonZero<u32>>() {
Ok(num) => Some(num),
Err(err) => {
sess.dcx().emit_err(
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_attr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![allow(internal_features)]
#![feature(rustdoc_internals)]
#![doc(rust_logo)]
#![feature(generic_nonzero)]
#![feature(let_chains)]

#[macro_use]
Expand Down
89 changes: 54 additions & 35 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
seen_spans.insert(move_span);
}

use_spans.var_path_only_subdiag(&mut err, desired_action);
use_spans.var_path_only_subdiag(self.dcx(), &mut err, desired_action);

if !is_loop_move {
err.span_label(
Expand Down Expand Up @@ -291,18 +291,24 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
if needs_note {
if let Some(local) = place.as_local() {
let span = self.body.local_decls[local].source_info.span;
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
is_partial_move,
ty,
place: &note_msg,
span,
});
err.subdiagnostic(
self.dcx(),
crate::session_diagnostics::TypeNoCopy::Label {
is_partial_move,
ty,
place: &note_msg,
span,
},
);
} else {
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Note {
is_partial_move,
ty,
place: &note_msg,
});
err.subdiagnostic(
self.dcx(),
crate::session_diagnostics::TypeNoCopy::Note {
is_partial_move,
ty,
place: &note_msg,
},
);
};
}

Expand Down Expand Up @@ -557,7 +563,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
E0381,
"{used} binding {desc}{isnt_initialized}"
);
use_spans.var_path_only_subdiag(&mut err, desired_action);
use_spans.var_path_only_subdiag(self.dcx(), &mut err, desired_action);

if let InitializationRequiringAction::PartialAssignment
| InitializationRequiringAction::Assignment = desired_action
Expand Down Expand Up @@ -848,9 +854,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
&value_msg,
);

borrow_spans.var_path_only_subdiag(&mut err, crate::InitializationRequiringAction::Borrow);
borrow_spans.var_path_only_subdiag(
self.dcx(),
&mut err,
crate::InitializationRequiringAction::Borrow,
);

move_spans.var_subdiag(None, &mut err, None, |kind, var_span| {
move_spans.var_subdiag(self.dcx(), &mut err, None, |kind, var_span| {
use crate::session_diagnostics::CaptureVarCause::*;
match kind {
hir::ClosureKind::Coroutine(_) => MoveUseInCoroutine { var_span },
Expand Down Expand Up @@ -895,7 +905,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
borrow_span,
&self.describe_any_place(borrow.borrowed_place.as_ref()),
);
borrow_spans.var_subdiag(None, &mut err, Some(borrow.kind), |kind, var_span| {
borrow_spans.var_subdiag(self.dcx(), &mut err, Some(borrow.kind), |kind, var_span| {
use crate::session_diagnostics::CaptureVarCause::*;
let place = &borrow.borrowed_place;
let desc_place = self.describe_any_place(place.as_ref());
Expand Down Expand Up @@ -1043,7 +1053,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
"mutably borrow",
);
borrow_spans.var_subdiag(
None,
self.dcx(),
&mut err,
Some(BorrowKind::Mut { kind: MutBorrowKind::ClosureCapture }),
|kind, var_span| {
Expand Down Expand Up @@ -1131,22 +1141,31 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
};

if issued_spans == borrow_spans {
borrow_spans.var_subdiag(None, &mut err, Some(gen_borrow_kind), |kind, var_span| {
use crate::session_diagnostics::CaptureVarCause::*;
match kind {
hir::ClosureKind::Coroutine(_) => BorrowUsePlaceCoroutine {
place: desc_place,
var_span,
is_single_var: false,
},
hir::ClosureKind::Closure | hir::ClosureKind::CoroutineClosure(_) => {
BorrowUsePlaceClosure { place: desc_place, var_span, is_single_var: false }
borrow_spans.var_subdiag(
self.dcx(),
&mut err,
Some(gen_borrow_kind),
|kind, var_span| {
use crate::session_diagnostics::CaptureVarCause::*;
match kind {
hir::ClosureKind::Coroutine(_) => BorrowUsePlaceCoroutine {
place: desc_place,
var_span,
is_single_var: false,
},
hir::ClosureKind::Closure | hir::ClosureKind::CoroutineClosure(_) => {
BorrowUsePlaceClosure {
place: desc_place,
var_span,
is_single_var: false,
}
}
}
}
});
},
);
} else {
issued_spans.var_subdiag(
Some(self.dcx()),
self.dcx(),
&mut err,
Some(issued_borrow.kind),
|kind, var_span| {
Expand All @@ -1165,7 +1184,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
);

borrow_spans.var_subdiag(
Some(self.dcx()),
self.dcx(),
&mut err,
Some(gen_borrow_kind),
|kind, var_span| {
Expand Down Expand Up @@ -2217,7 +2236,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
err.span_label(borrow_span, "borrowed value does not live long enough");
err.span_label(drop_span, format!("`{name}` dropped here while still borrowed"));

borrow_spans.args_subdiag(&mut err, |args_span| {
borrow_spans.args_subdiag(self.dcx(), &mut err, |args_span| {
crate::session_diagnostics::CaptureArgLabel::Capture {
is_within: borrow_spans.for_coroutine(),
args_span,
Expand Down Expand Up @@ -2476,7 +2495,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
None,
);

borrow_spans.args_subdiag(&mut err, |args_span| {
borrow_spans.args_subdiag(self.dcx(), &mut err, |args_span| {
crate::session_diagnostics::CaptureArgLabel::Capture {
is_within: borrow_spans.for_coroutine(),
args_span,
Expand Down Expand Up @@ -2935,7 +2954,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
"assign",
);

loan_spans.var_subdiag(None, &mut err, Some(loan.kind), |kind, var_span| {
loan_spans.var_subdiag(self.dcx(), &mut err, Some(loan.kind), |kind, var_span| {
use crate::session_diagnostics::CaptureVarCause::*;
match kind {
hir::ClosureKind::Coroutine(_) => BorrowUseInCoroutine { var_span },
Expand All @@ -2953,7 +2972,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {

let mut err = self.cannot_assign_to_borrowed(span, loan_span, &descr_place);

loan_spans.var_subdiag(None, &mut err, Some(loan.kind), |kind, var_span| {
loan_spans.var_subdiag(self.dcx(), &mut err, Some(loan.kind), |kind, var_span| {
use crate::session_diagnostics::CaptureVarCause::*;
match kind {
hir::ClosureKind::Coroutine(_) => BorrowUseInCoroutine { var_span },
Expand Down
Loading
Loading