Skip to content

Commit f98fdfc

Browse files
committed
Auto merge of #3765 - rust-lang:rustup-2024-07-26, r=RalfJung
Automatic Rustup
2 parents 35e70f3 + 4bd2757 commit f98fdfc

File tree

291 files changed

+2907
-2219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

291 files changed

+2907
-2219
lines changed

Cargo.lock

+9-9
Original file line numberDiff line numberDiff line change
@@ -986,14 +986,14 @@ dependencies = [
986986
]
987987

988988
[[package]]
989-
name = "derivative"
990-
version = "2.2.0"
989+
name = "derive-where"
990+
version = "1.2.7"
991991
source = "registry+https://github.com/rust-lang/crates.io-index"
992-
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
992+
checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25"
993993
dependencies = [
994994
"proc-macro2",
995995
"quote",
996-
"syn 1.0.109",
996+
"syn 2.0.67",
997997
]
998998

999999
[[package]]
@@ -3882,7 +3882,6 @@ dependencies = [
38823882
"termcolor",
38833883
"termize",
38843884
"tracing",
3885-
"unicode-width",
38863885
"windows",
38873886
]
38883887

@@ -4249,7 +4248,7 @@ name = "rustc_middle"
42494248
version = "0.0.0"
42504249
dependencies = [
42514250
"bitflags 2.5.0",
4252-
"derivative",
4251+
"derive-where",
42534252
"either",
42544253
"field-offset",
42554254
"gsgdt",
@@ -4379,7 +4378,7 @@ name = "rustc_next_trait_solver"
43794378
version = "0.0.0"
43804379
dependencies = [
43814380
"bitflags 2.5.0",
4382-
"derivative",
4381+
"derive-where",
43834382
"rustc_ast_ir",
43844383
"rustc_data_structures",
43854384
"rustc_index",
@@ -4629,7 +4628,7 @@ dependencies = [
46294628
name = "rustc_span"
46304629
version = "0.0.0"
46314630
dependencies = [
4632-
"derivative",
4631+
"derive-where",
46334632
"indexmap",
46344633
"itoa",
46354634
"md-5",
@@ -4769,7 +4768,7 @@ name = "rustc_type_ir"
47694768
version = "0.0.0"
47704769
dependencies = [
47714770
"bitflags 2.5.0",
4772-
"derivative",
4771+
"derive-where",
47734772
"indexmap",
47744773
"rustc_ast_ir",
47754774
"rustc_data_structures",
@@ -5206,6 +5205,7 @@ name = "stable_mir"
52065205
version = "0.1.0-preview"
52075206
dependencies = [
52085207
"scoped-tls",
5208+
"serde",
52095209
]
52105210

52115211
[[package]]

RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version 1.80 (2024-07-25)
1+
Version 1.80.0 (2024-07-25)
22
==========================
33

44
<a id="1.80-Language"></a>

compiler/rustc_ast/src/ast.rs

+38-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
3636
use rustc_span::source_map::{respan, Spanned};
3737
use rustc_span::symbol::{kw, sym, Ident, Symbol};
3838
use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
39+
use std::borrow::Cow;
3940
use std::cmp;
4041
use std::fmt;
4142
use std::mem;
@@ -2264,6 +2265,42 @@ bitflags::bitflags! {
22642265
}
22652266
}
22662267

2268+
impl InlineAsmOptions {
2269+
pub fn human_readable_names(&self) -> Vec<&'static str> {
2270+
let mut options = vec![];
2271+
2272+
if self.contains(InlineAsmOptions::PURE) {
2273+
options.push("pure");
2274+
}
2275+
if self.contains(InlineAsmOptions::NOMEM) {
2276+
options.push("nomem");
2277+
}
2278+
if self.contains(InlineAsmOptions::READONLY) {
2279+
options.push("readonly");
2280+
}
2281+
if self.contains(InlineAsmOptions::PRESERVES_FLAGS) {
2282+
options.push("preserves_flags");
2283+
}
2284+
if self.contains(InlineAsmOptions::NORETURN) {
2285+
options.push("noreturn");
2286+
}
2287+
if self.contains(InlineAsmOptions::NOSTACK) {
2288+
options.push("nostack");
2289+
}
2290+
if self.contains(InlineAsmOptions::ATT_SYNTAX) {
2291+
options.push("att_syntax");
2292+
}
2293+
if self.contains(InlineAsmOptions::RAW) {
2294+
options.push("raw");
2295+
}
2296+
if self.contains(InlineAsmOptions::MAY_UNWIND) {
2297+
options.push("may_unwind");
2298+
}
2299+
2300+
options
2301+
}
2302+
}
2303+
22672304
impl std::fmt::Debug for InlineAsmOptions {
22682305
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22692306
bitflags::parser::to_writer(self, f)
@@ -2272,7 +2309,7 @@ impl std::fmt::Debug for InlineAsmOptions {
22722309

22732310
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Hash, HashStable_Generic)]
22742311
pub enum InlineAsmTemplatePiece {
2275-
String(String),
2312+
String(Cow<'static, str>),
22762313
Placeholder { operand_idx: usize, modifier: Option<char>, span: Span },
22772314
}
22782315

compiler/rustc_ast_passes/messages.ftl

-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ ast_passes_impl_trait_path = `impl Trait` is not allowed in path parameters
155155
ast_passes_incompatible_features = `{$f1}` and `{$f2}` are incompatible, using them at the same time is not allowed
156156
.help = remove one of these features
157157
158-
ast_passes_incompatible_trait_bound_modifiers = `{$left}` and `{$right}` are mutually exclusive
159-
160158
ast_passes_inherent_cannot_be = inherent impls cannot be {$annotation}
161159
.because = {$annotation} because of this
162160
.type = inherent impl for this type

compiler/rustc_ast_passes/src/ast_validation.rs

-11
Original file line numberDiff line numberDiff line change
@@ -1366,17 +1366,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
13661366
{
13671367
self.dcx().emit_err(errors::TildeConstDisallowed { span, reason });
13681368
}
1369-
(
1370-
_,
1371-
BoundConstness::Always(_) | BoundConstness::Maybe(_),
1372-
BoundPolarity::Negative(_) | BoundPolarity::Maybe(_),
1373-
) => {
1374-
self.dcx().emit_err(errors::IncompatibleTraitBoundModifiers {
1375-
span: bound.span(),
1376-
left: modifiers.constness.as_str(),
1377-
right: modifiers.polarity.as_str(),
1378-
});
1379-
}
13801369
_ => {}
13811370
}
13821371

compiler/rustc_ast_passes/src/errors.rs

-9
Original file line numberDiff line numberDiff line change
@@ -656,15 +656,6 @@ pub enum TildeConstReason {
656656
Item,
657657
}
658658

659-
#[derive(Diagnostic)]
660-
#[diag(ast_passes_incompatible_trait_bound_modifiers)]
661-
pub struct IncompatibleTraitBoundModifiers {
662-
#[primary_span]
663-
pub span: Span,
664-
pub left: &'static str,
665-
pub right: &'static str,
666-
}
667-
668659
#[derive(Diagnostic)]
669660
#[diag(ast_passes_const_and_async)]
670661
pub struct ConstAndAsync {

compiler/rustc_ast_pretty/src/pprust/state.rs

+1-29
Original file line numberDiff line numberDiff line change
@@ -1505,35 +1505,7 @@ impl<'a> State<'a> {
15051505
AsmArg::Options(opts) => {
15061506
s.word("options");
15071507
s.popen();
1508-
let mut options = vec![];
1509-
if opts.contains(InlineAsmOptions::PURE) {
1510-
options.push("pure");
1511-
}
1512-
if opts.contains(InlineAsmOptions::NOMEM) {
1513-
options.push("nomem");
1514-
}
1515-
if opts.contains(InlineAsmOptions::READONLY) {
1516-
options.push("readonly");
1517-
}
1518-
if opts.contains(InlineAsmOptions::PRESERVES_FLAGS) {
1519-
options.push("preserves_flags");
1520-
}
1521-
if opts.contains(InlineAsmOptions::NORETURN) {
1522-
options.push("noreturn");
1523-
}
1524-
if opts.contains(InlineAsmOptions::NOSTACK) {
1525-
options.push("nostack");
1526-
}
1527-
if opts.contains(InlineAsmOptions::ATT_SYNTAX) {
1528-
options.push("att_syntax");
1529-
}
1530-
if opts.contains(InlineAsmOptions::RAW) {
1531-
options.push("raw");
1532-
}
1533-
if opts.contains(InlineAsmOptions::MAY_UNWIND) {
1534-
options.push("may_unwind");
1535-
}
1536-
s.commasep(Inconsistent, &options, |s, &opt| {
1508+
s.commasep(Inconsistent, &opts.human_readable_names(), |s, &opt| {
15371509
s.word(opt);
15381510
});
15391511
s.pclose();

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+26-8
Original file line numberDiff line numberDiff line change
@@ -4304,17 +4304,35 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
43044304
// search for relevant arguments.
43054305
let mut arguments = Vec::new();
43064306
for (index, argument) in sig.inputs().skip_binder().iter().enumerate() {
4307-
if let ty::Ref(argument_region, _, _) = argument.kind() {
4308-
if argument_region == return_region {
4309-
// Need to use the `rustc_middle::ty` types to compare against the
4310-
// `return_region`. Then use the `rustc_hir` type to get only
4311-
// the lifetime span.
4312-
if let hir::TyKind::Ref(lifetime, _) = &fn_decl.inputs[index].kind {
4307+
if let ty::Ref(argument_region, _, _) = argument.kind()
4308+
&& argument_region == return_region
4309+
{
4310+
// Need to use the `rustc_middle::ty` types to compare against the
4311+
// `return_region`. Then use the `rustc_hir` type to get only
4312+
// the lifetime span.
4313+
match &fn_decl.inputs[index].kind {
4314+
hir::TyKind::Ref(lifetime, _) => {
43134315
// With access to the lifetime, we can get
43144316
// the span of it.
43154317
arguments.push((*argument, lifetime.ident.span));
4316-
} else {
4317-
bug!("ty type is a ref but hir type is not");
4318+
}
4319+
// Resolve `self` whose self type is `&T`.
4320+
hir::TyKind::Path(hir::QPath::Resolved(None, path)) => {
4321+
if let Res::SelfTyAlias { alias_to, .. } = path.res
4322+
&& let Some(alias_to) = alias_to.as_local()
4323+
&& let hir::Impl { self_ty, .. } = self
4324+
.infcx
4325+
.tcx
4326+
.hir_node_by_def_id(alias_to)
4327+
.expect_item()
4328+
.expect_impl()
4329+
&& let hir::TyKind::Ref(lifetime, _) = self_ty.kind
4330+
{
4331+
arguments.push((*argument, lifetime.ident.span));
4332+
}
4333+
}
4334+
_ => {
4335+
// Don't ICE though. It might be a type alias.
43184336
}
43194337
}
43204338
}

compiler/rustc_builtin_macros/src/asm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ fn expand_preparsed_asm(
459459

460460
for (i, template_expr) in args.templates.into_iter().enumerate() {
461461
if i != 0 {
462-
template.push(ast::InlineAsmTemplatePiece::String("\n".to_string()));
462+
template.push(ast::InlineAsmTemplatePiece::String("\n".into()));
463463
}
464464

465465
let msg = "asm template must be a string literal";
@@ -527,7 +527,7 @@ fn expand_preparsed_asm(
527527

528528
// Don't treat raw asm as a format string.
529529
if args.options.contains(ast::InlineAsmOptions::RAW) {
530-
template.push(ast::InlineAsmTemplatePiece::String(template_str.to_string()));
530+
template.push(ast::InlineAsmTemplatePiece::String(template_str.to_string().into()));
531531
let template_num_lines = 1 + template_str.matches('\n').count();
532532
line_spans.extend(std::iter::repeat(template_sp).take(template_num_lines));
533533
continue;
@@ -577,7 +577,7 @@ fn expand_preparsed_asm(
577577
for piece in unverified_pieces {
578578
match piece {
579579
parse::Piece::String(s) => {
580-
template.push(ast::InlineAsmTemplatePiece::String(s.to_string()))
580+
template.push(ast::InlineAsmTemplatePiece::String(s.to_string().into()))
581581
}
582582
parse::Piece::NextArgument(arg) => {
583583
let span = arg_spans.next().unwrap_or(template_sp);

compiler/rustc_codegen_cranelift/src/inline_asm.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
4646
// Used by panic_abort on Windows, but uses a syntax which only happens to work with
4747
// asm!() by accident and breaks with the GNU assembler as well as global_asm!() for
4848
// the LLVM backend.
49-
if template.len() == 1
50-
&& template[0] == InlineAsmTemplatePiece::String("int $$0x29".to_string())
51-
{
49+
if template.len() == 1 && template[0] == InlineAsmTemplatePiece::String("int $$0x29".into()) {
5250
fx.bcx.ins().trap(TrapCode::User(1));
5351
return;
5452
}

0 commit comments

Comments
 (0)