Skip to content

Commit a804c4b

Browse files
committed
Auto merge of #89545 - workingjubilee:rollup-ooxf3p2, r=workingjubilee
Rollup of 15 pull requests Successful merges: - #87993 (Stabilize try_reserve) - #88090 (Perform type inference in range pattern) - #88780 (Added abs_diff for integer types.) - #89270 (path.push() should work as expected on windows verbatim paths) - #89413 (Correctly handle supertraits for min_specialization) - #89456 (Update to the final LLVM 13.0.0 release) - #89466 (Fix bug with query modifier parsing) - #89473 (Fix extra `non_snake_case` warning for shorthand field bindings) - #89474 (rustdoc: Improve doctest pass's name and module's name) - #89478 (Fixed numerus of error message) - #89480 (Add test for issue 89118.) - #89487 (Try to recover from a `=>` -> `=` or `->` typo in a match arm) - #89494 (Deny `where` clauses on `auto` traits) - #89511 (:arrow_up: rust-analyzer) - #89536 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 003d8d3 + 2ae8ced commit a804c4b

File tree

81 files changed

+787
-297
lines changed

Some content is hidden

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

81 files changed

+787
-297
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
[submodule "src/llvm-project"]
3535
path = src/llvm-project
3636
url = https://github.com/rust-lang/llvm-project.git
37-
branch = rustc/13.0-2021-08-08
37+
branch = rustc/13.0-2021-09-30
3838
[submodule "src/doc/embedded-book"]
3939
path = src/doc/embedded-book
4040
url = https://github.com/rust-embedded/book.git

Cargo.lock

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ version = "0.1.0"
360360
dependencies = [
361361
"directories",
362362
"rustc-workspace-hack",
363-
"rustc_version",
363+
"rustc_version 0.3.3",
364364
"serde",
365365
"serde_json",
366366
"vergen",
@@ -1092,19 +1092,6 @@ dependencies = [
10921092
"termcolor",
10931093
]
10941094

1095-
[[package]]
1096-
name = "env_logger"
1097-
version = "0.8.1"
1098-
source = "registry+https://github.com/rust-lang/crates.io-index"
1099-
checksum = "54532e3223c5af90a6a757c90b5c5521564b07e5e7a958681bcd2afad421cdcd"
1100-
dependencies = [
1101-
"atty",
1102-
"humantime 2.0.1",
1103-
"log",
1104-
"regex",
1105-
"termcolor",
1106-
]
1107-
11081095
[[package]]
11091096
name = "env_logger"
11101097
version = "0.9.0"
@@ -2250,15 +2237,15 @@ version = "0.1.0"
22502237
dependencies = [
22512238
"colored",
22522239
"compiletest_rs",
2253-
"env_logger 0.8.1",
2240+
"env_logger 0.9.0",
22542241
"getrandom 0.2.0",
22552242
"hex 0.4.2",
22562243
"libc",
22572244
"log",
22582245
"measureme",
22592246
"rand 0.8.4",
22602247
"rustc-workspace-hack",
2261-
"rustc_version",
2248+
"rustc_version 0.4.0",
22622249
"shell-escape",
22632250
"smallvec",
22642251
]
@@ -4548,6 +4535,15 @@ dependencies = [
45484535
"semver 0.11.0",
45494536
]
45504537

4538+
[[package]]
4539+
name = "rustc_version"
4540+
version = "0.4.0"
4541+
source = "registry+https://github.com/rust-lang/crates.io-index"
4542+
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
4543+
dependencies = [
4544+
"semver 1.0.3",
4545+
]
4546+
45514547
[[package]]
45524548
name = "rustdoc"
45534549
version = "0.0.0"
@@ -4908,9 +4904,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
49084904

49094905
[[package]]
49104906
name = "smallvec"
4911-
version = "1.6.1"
4907+
version = "1.7.0"
49124908
source = "registry+https://github.com/rust-lang/crates.io-index"
4913-
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
4909+
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
49144910

49154911
[[package]]
49164912
name = "snap"

compiler/rustc_ast/src/token.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ impl TokenKind {
295295
match *self {
296296
Comma => Some(vec![Dot, Lt, Semi]),
297297
Semi => Some(vec![Colon, Comma]),
298+
FatArrow => Some(vec![Eq, RArrow]),
298299
_ => None,
299300
}
300301
}

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -683,31 +683,53 @@ impl<'a> AstValidator<'a> {
683683
}
684684
}
685685

686+
fn emit_e0568(&self, span: Span, ident_span: Span) {
687+
struct_span_err!(
688+
self.session,
689+
span,
690+
E0568,
691+
"auto traits cannot have super traits or lifetime bounds"
692+
)
693+
.span_label(ident_span, "auto trait cannot have super traits or lifetime bounds")
694+
.span_suggestion(
695+
span,
696+
"remove the super traits or lifetime bounds",
697+
String::new(),
698+
Applicability::MachineApplicable,
699+
)
700+
.emit();
701+
}
702+
686703
fn deny_super_traits(&self, bounds: &GenericBounds, ident_span: Span) {
687-
if let [first @ last] | [first, .., last] = &bounds[..] {
688-
let span = first.span().to(last.span());
689-
struct_span_err!(self.session, span, E0568, "auto traits cannot have super traits")
690-
.span_label(ident_span, "auto trait cannot have super traits")
691-
.span_suggestion(
692-
span,
693-
"remove the super traits",
694-
String::new(),
695-
Applicability::MachineApplicable,
696-
)
697-
.emit();
704+
if let [.., last] = &bounds[..] {
705+
let span = ident_span.shrink_to_hi().to(last.span());
706+
self.emit_e0568(span, ident_span);
707+
}
708+
}
709+
710+
fn deny_where_clause(&self, where_clause: &WhereClause, ident_span: Span) {
711+
if !where_clause.predicates.is_empty() {
712+
self.emit_e0568(where_clause.span, ident_span);
698713
}
699714
}
700715

701716
fn deny_items(&self, trait_items: &[P<AssocItem>], ident_span: Span) {
702717
if !trait_items.is_empty() {
703718
let spans: Vec<_> = trait_items.iter().map(|i| i.ident.span).collect();
719+
let total_span = trait_items.first().unwrap().span.to(trait_items.last().unwrap().span);
704720
struct_span_err!(
705721
self.session,
706722
spans,
707723
E0380,
708-
"auto traits cannot have methods or associated items"
724+
"auto traits cannot have associated items"
725+
)
726+
.span_suggestion(
727+
total_span,
728+
"remove these associated items",
729+
String::new(),
730+
Applicability::MachineApplicable,
709731
)
710-
.span_label(ident_span, "auto trait cannot have items")
732+
.span_label(ident_span, "auto trait cannot have associated items")
711733
.emit();
712734
}
713735
}
@@ -1184,6 +1206,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
11841206
// Auto traits cannot have generics, super traits nor contain items.
11851207
self.deny_generic_params(generics, item.ident.span);
11861208
self.deny_super_traits(bounds, item.ident.span);
1209+
self.deny_where_clause(&generics.where_clause, item.ident.span);
11871210
self.deny_items(trait_items, item.ident.span);
11881211
}
11891212
self.no_questions_in_bounds(bounds, "supertraits", true);

compiler/rustc_data_structures/src/sso/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const SSO_ARRAY_SIZE: usize = 8;
3131
//
3232
// Missing HashMap API:
3333
// all hasher-related
34-
// try_reserve (unstable)
34+
// try_reserve
3535
// shrink_to (unstable)
3636
// drain_filter (unstable)
3737
// into_keys/into_values (unstable)

compiler/rustc_data_structures/src/sso/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use super::map::SsoHashMap;
1313
//
1414
// Missing HashSet API:
1515
// all hasher-related
16-
// try_reserve (unstable)
16+
// try_reserve
1717
// shrink_to (unstable)
1818
// drain_filter (unstable)
1919
// replace

compiler/rustc_lint/src/nonstandard_style.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,12 +437,13 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
437437
if let hir::Node::Pat(parent_pat) = cx.tcx.hir().get(cx.tcx.hir().get_parent_node(hid))
438438
{
439439
if let PatKind::Struct(_, field_pats, _) = &parent_pat.kind {
440-
for field in field_pats.iter() {
441-
if field.ident != ident {
442-
// Only check if a new name has been introduced, to avoid warning
443-
// on both the struct definition and this pattern.
444-
self.check_snake_case(cx, "variable", &ident);
445-
}
440+
if field_pats
441+
.iter()
442+
.any(|field| !field.is_shorthand && field.pat.hir_id == p.hir_id)
443+
{
444+
// Only check if a new name has been introduced, to avoid warning
445+
// on both the struct definition and this pattern.
446+
self.check_snake_case(cx, "variable", &ident);
446447
}
447448
return;
448449
}

compiler/rustc_macros/src/query.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,28 +455,28 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
455455

456456
// Pass on the fatal_cycle modifier
457457
if let Some(fatal_cycle) = &modifiers.fatal_cycle {
458-
attributes.push(quote! { #fatal_cycle });
458+
attributes.push(quote! { (#fatal_cycle) });
459459
};
460460
// Pass on the storage modifier
461461
if let Some(ref ty) = modifiers.storage {
462462
let span = ty.span();
463-
attributes.push(quote_spanned! {span=> storage(#ty) });
463+
attributes.push(quote_spanned! {span=> (storage #ty) });
464464
};
465465
// Pass on the cycle_delay_bug modifier
466466
if let Some(cycle_delay_bug) = &modifiers.cycle_delay_bug {
467-
attributes.push(quote! { #cycle_delay_bug });
467+
attributes.push(quote! { (#cycle_delay_bug) });
468468
};
469469
// Pass on the no_hash modifier
470470
if let Some(no_hash) = &modifiers.no_hash {
471-
attributes.push(quote! { #no_hash });
471+
attributes.push(quote! { (#no_hash) });
472472
};
473473
// Pass on the anon modifier
474474
if let Some(anon) = &modifiers.anon {
475-
attributes.push(quote! { #anon });
475+
attributes.push(quote! { (#anon) });
476476
};
477477
// Pass on the eval_always modifier
478478
if let Some(eval_always) = &modifiers.eval_always {
479-
attributes.push(quote! { #eval_always });
479+
attributes.push(quote! { (#eval_always) });
480480
};
481481

482482
// This uses the span of the query definition for the commas,

compiler/rustc_middle/src/dep_graph/dep_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ macro_rules! is_eval_always_attr {
140140
}
141141

142142
macro_rules! contains_anon_attr {
143-
($($attr:ident $(($($attr_args:tt)*))* ),*) => ({$(is_anon_attr!($attr) | )* false});
143+
($(($attr:ident $($attr_args:tt)* )),*) => ({$(is_anon_attr!($attr) | )* false});
144144
}
145145

146146
macro_rules! contains_eval_always_attr {
147-
($($attr:ident $(($($attr_args:tt)*))* ),*) => ({$(is_eval_always_attr!($attr) | )* false});
147+
($(($attr:ident $($attr_args:tt)* )),*) => ({$(is_eval_always_attr!($attr) | )* false});
148148
}
149149

150150
#[allow(non_upper_case_globals)]

compiler/rustc_middle/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#![feature(thread_local_const_init)]
5353
#![feature(trusted_step)]
5454
#![feature(try_blocks)]
55-
#![feature(try_reserve)]
5655
#![feature(try_reserve_kind)]
5756
#![feature(nonzero_ops)]
5857
#![recursion_limit = "512"]

0 commit comments

Comments
 (0)