Skip to content

Commit b7912d3

Browse files
committed
Auto merge of #3187 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 44aceb5 + 34a8680 commit b7912d3

File tree

5,902 files changed

+7654
-6351
lines changed

Some content is hidden

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

5,902 files changed

+7654
-6351
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5767,9 +5767,9 @@ dependencies = [
57675767

57685768
[[package]]
57695769
name = "unicase"
5770-
version = "2.6.0"
5770+
version = "2.7.0"
57715771
source = "registry+https://github.com/rust-lang/crates.io-index"
5772-
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
5772+
checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89"
57735773
dependencies = [
57745774
"version_check",
57755775
]
@@ -6072,9 +6072,9 @@ dependencies = [
60726072

60736073
[[package]]
60746074
name = "windows-bindgen"
6075-
version = "0.51.1"
6075+
version = "0.52.0"
60766076
source = "registry+https://github.com/rust-lang/crates.io-index"
6077-
checksum = "bc1f16b778125675feee0d15d6dd9f6af0e3ac52b3233d63a10aa39230c1cd75"
6077+
checksum = "970efb0b6849eb8a87a898f586af7cc167567b070014c7434514c0bde0ca341c"
60786078
dependencies = [
60796079
"proc-macro2",
60806080
"rayon",
@@ -6084,9 +6084,9 @@ dependencies = [
60846084

60856085
[[package]]
60866086
name = "windows-metadata"
6087-
version = "0.51.1"
6087+
version = "0.52.0"
60886088
source = "registry+https://github.com/rust-lang/crates.io-index"
6089-
checksum = "753135d996f9da437c0b31dbde3032489a61708361929bcc07d4fba0b161000e"
6089+
checksum = "218fd59201e26acdbb894fa2b302d1de84bf3eec7d0eb894ac8e9c5a854ee4ef"
60906090

60916091
[[package]]
60926092
name = "windows-sys"

compiler/rustc_ast/src/ast.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ pub enum TraitBoundModifier {
301301
Maybe,
302302

303303
/// `~const Trait`
304-
MaybeConst,
304+
MaybeConst(Span),
305305

306306
/// `~const !Trait`
307307
//
@@ -317,8 +317,7 @@ pub enum TraitBoundModifier {
317317
impl TraitBoundModifier {
318318
pub fn to_constness(self) -> Const {
319319
match self {
320-
// FIXME(effects) span
321-
Self::MaybeConst => Const::Yes(DUMMY_SP),
320+
Self::MaybeConst(span) => Const::Yes(span),
322321
_ => Const::No,
323322
}
324323
}
@@ -3155,7 +3154,7 @@ mod size_asserts {
31553154
static_assert_size!(ForeignItem, 96);
31563155
static_assert_size!(ForeignItemKind, 24);
31573156
static_assert_size!(GenericArg, 24);
3158-
static_assert_size!(GenericBound, 56);
3157+
static_assert_size!(GenericBound, 64);
31593158
static_assert_size!(Generics, 40);
31603159
static_assert_size!(Impl, 136);
31613160
static_assert_size!(Item, 136);

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13691369
GenericBound::Trait(
13701370
ty,
13711371
modifier @ (TraitBoundModifier::None
1372-
| TraitBoundModifier::MaybeConst
1372+
| TraitBoundModifier::MaybeConst(_)
13731373
| TraitBoundModifier::Negative),
13741374
) => {
13751375
Some(this.lower_poly_trait_ref(ty, itctx, modifier.to_constness()))
@@ -2227,7 +2227,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22272227
fn lower_trait_bound_modifier(&mut self, f: TraitBoundModifier) -> hir::TraitBoundModifier {
22282228
match f {
22292229
TraitBoundModifier::None => hir::TraitBoundModifier::None,
2230-
TraitBoundModifier::MaybeConst => hir::TraitBoundModifier::MaybeConst,
2230+
TraitBoundModifier::MaybeConst(_) => hir::TraitBoundModifier::MaybeConst,
22312231

22322232
TraitBoundModifier::Negative => {
22332233
if self.tcx.features().negative_bounds {

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
12031203
(BoundKind::TraitObject, TraitBoundModifier::Maybe) => {
12041204
self.err_handler().emit_err(errors::OptionalTraitObject { span: poly.span });
12051205
}
1206-
(_, TraitBoundModifier::MaybeConst)
1206+
(_, &TraitBoundModifier::MaybeConst(span))
12071207
if let Some(reason) = &self.disallow_tilde_const =>
12081208
{
12091209
let reason = match reason {
@@ -1224,8 +1224,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
12241224
}
12251225
DisallowTildeConstContext::Item => errors::TildeConstReason::Item,
12261226
};
1227-
self.err_handler()
1228-
.emit_err(errors::TildeConstDisallowed { span: bound.span(), reason });
1227+
self.err_handler().emit_err(errors::TildeConstDisallowed { span, reason });
12291228
}
12301229
(_, TraitBoundModifier::MaybeConstMaybe) => {
12311230
self.err_handler().emit_err(errors::OptionalConstExclusive {

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ impl<'a> State<'a> {
15151515
TraitBoundModifier::Maybe => {
15161516
self.word("?");
15171517
}
1518-
TraitBoundModifier::MaybeConst => {
1518+
TraitBoundModifier::MaybeConst(_) => {
15191519
self.word_space("~const");
15201520
}
15211521
TraitBoundModifier::MaybeConstNegative => {

compiler/rustc_builtin_macros/src/deriving/default.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,17 @@ fn extract_default_variant<'a>(
127127
[first, rest @ ..] => {
128128
let suggs = default_variants
129129
.iter()
130-
.map(|variant| {
131-
let spans = default_variants
130+
.filter_map(|variant| {
131+
let keep = attr::find_by_name(&variant.attrs, kw::Default)?.span;
132+
let spans: Vec<Span> = default_variants
132133
.iter()
133-
.filter_map(|v| {
134-
if v.span == variant.span {
135-
None
136-
} else {
137-
Some(attr::find_by_name(&v.attrs, kw::Default)?.span)
138-
}
134+
.flat_map(|v| {
135+
attr::filter_by_name(&v.attrs, kw::Default)
136+
.filter_map(|attr| (attr.span != keep).then_some(attr.span))
139137
})
140138
.collect();
141-
errors::MultipleDefaultsSugg { spans, ident: variant.ident }
139+
(!spans.is_empty())
140+
.then_some(errors::MultipleDefaultsSugg { spans, ident: variant.ident })
142141
})
143142
.collect();
144143
cx.emit_err(errors::MultipleDefaults {

compiler/rustc_codegen_cranelift/build_system/tests.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
100100
TestCase::build_bin_and_run("aot.issue-72793", "example/issue-72793.rs", &[]),
101101
TestCase::build_bin("aot.issue-59326", "example/issue-59326.rs"),
102102
TestCase::build_bin_and_run("aot.neon", "example/neon.rs", &[]),
103+
TestCase::custom("aot.gen_block_iterate", &|runner| {
104+
runner.run_rustc([
105+
"example/gen_block_iterate.rs",
106+
"--edition",
107+
"2024",
108+
"-Zunstable-options",
109+
]);
110+
runner.run_out_command("gen_block_iterate", &[]);
111+
}),
103112
];
104113

105114
pub(crate) static RAND_REPO: GitRepo = GitRepo::github(

compiler/rustc_codegen_cranelift/config.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ aot.mod_bench
4343
aot.issue-72793
4444
aot.issue-59326
4545
aot.neon
46+
aot.gen_block_iterate
4647

4748
testsuite.extended_sysroot
4849
test.rust-random/rand
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copied from https://github.com/rust-lang/rust/blob/46455dc65069387f2dc46612f13fd45452ab301a/tests/ui/coroutine/gen_block_iterate.rs
2+
// revisions: next old
3+
//compile-flags: --edition 2024 -Zunstable-options
4+
//[next] compile-flags: -Ztrait-solver=next
5+
// run-pass
6+
#![feature(gen_blocks)]
7+
8+
fn foo() -> impl Iterator<Item = u32> {
9+
gen { yield 42; for x in 3..6 { yield x } }
10+
}
11+
12+
fn moved() -> impl Iterator<Item = u32> {
13+
let mut x = "foo".to_string();
14+
gen move {
15+
yield 42;
16+
if x == "foo" { return }
17+
x.clear();
18+
for x in 3..6 { yield x }
19+
}
20+
}
21+
22+
fn main() {
23+
let mut iter = foo();
24+
assert_eq!(iter.next(), Some(42));
25+
assert_eq!(iter.next(), Some(3));
26+
assert_eq!(iter.next(), Some(4));
27+
assert_eq!(iter.next(), Some(5));
28+
assert_eq!(iter.next(), None);
29+
// `gen` blocks are fused
30+
assert_eq!(iter.next(), None);
31+
32+
let mut iter = moved();
33+
assert_eq!(iter.next(), Some(42));
34+
assert_eq!(iter.next(), None);
35+
36+
}

compiler/rustc_codegen_cranelift/rustfmt.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
ignore = ["y.rs"]
1+
ignore = [
2+
"y.rs",
3+
"example/gen_block_iterate.rs", # uses edition 2024
4+
]
25

36
# Matches rustfmt.toml of rustc
47
version = "Two"

0 commit comments

Comments
 (0)