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 15 pull requests #89545

Merged
merged 37 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4f5563d
Added abs_diff for integer types.
orlp Sep 9, 2021
77e7f8a
Added psadbw support for u8::abs_diff.
orlp Sep 9, 2021
d8dae4f
Perform type inference in range pattern
nbdd0121 Aug 16, 2021
ca1616c
Add ui test for issue 88074
nbdd0121 Aug 16, 2021
52a0403
Add a range pattern inference failing test
nbdd0121 Aug 16, 2021
c8f86ca
Elaborate predicates in min_specialization checks
matthewjasper Sep 30, 2021
051d5b0
Fix standard library for min_specialization changes
matthewjasper Sep 30, 2021
fa4072f
path.push() should work as expected on windows verbatim paths
seanyoung Sep 26, 2021
03cf07f
Update to the final LLVM 13.0.0 release
cuviper Oct 2, 2021
e2d3e09
Prevent macro ambiguity errors
bjorn3 May 30, 2021
abbead7
rustdoc: Improve doctest pass's name and module's name
camelid Oct 2, 2021
3da9dea
Add test for issue 89118.
hameerabbasi Oct 3, 2021
dc40430
Move test to correct path.
hameerabbasi Oct 3, 2021
d6a7e74
Combined 4 commits into 1
zvavybir Oct 2, 2021
cf19131
Try to recover from a `=>` -> `=` or `->` typo in a match arm
FabianWolff Oct 3, 2021
9626f2b
Fix extra `non_snake_case` warning for shorthand field bindings
FabianWolff Oct 2, 2021
6dd6e7c
Added tracking issue numbers for int_abs_diff.
orlp Oct 3, 2021
e34fd54
Deny `where` clauses on `auto` traits
FabianWolff Oct 3, 2021
55a3c86
:arrow_up: rust-analyzer
lnicola Oct 4, 2021
00152d8
Stabilize try_reserve
kornelski Aug 29, 2021
079c075
Use `TokenKind::similar_tokens()`
FabianWolff Oct 4, 2021
e5d0178
update Miri
RalfJung Oct 4, 2021
99e6e3f
Rollup merge of #87993 - kornelski:try_reserve_stable, r=joshtriplett
workingjubilee Oct 5, 2021
4f6afee
Rollup merge of #88090 - nbdd0121:inference, r=nikomatsakis
workingjubilee Oct 5, 2021
234fa90
Rollup merge of #88780 - orlp:int-abs-diff, r=m-ou-se
workingjubilee Oct 5, 2021
7aa9ce5
Rollup merge of #89270 - seanyoung:join_fold, r=m-ou-se
workingjubilee Oct 5, 2021
05b4cd6
Rollup merge of #89413 - matthewjasper:spec-marker-fix, r=nikomatsakis
workingjubilee Oct 5, 2021
a19537d
Rollup merge of #89456 - cuviper:llvm-13, r=nikic
workingjubilee Oct 5, 2021
36f173f
Rollup merge of #89466 - Mark-Simulacrum:query-macros, r=oli-obk
workingjubilee Oct 5, 2021
c2bfe45
Rollup merge of #89473 - FabianWolff:issue-89469, r=joshtriplett
workingjubilee Oct 5, 2021
02b52ca
Rollup merge of #89474 - camelid:better-pass-name, r=jyn514
workingjubilee Oct 5, 2021
ec41455
Rollup merge of #89478 - zvavybir:master, r=jyn514
workingjubilee Oct 5, 2021
25cc28e
Rollup merge of #89480 - hameerabbasi:issue-89118-test, r=jackh726
workingjubilee Oct 5, 2021
90e96f9
Rollup merge of #89487 - FabianWolff:issue-89396, r=petrochenkov
workingjubilee Oct 5, 2021
c9158db
Rollup merge of #89494 - FabianWolff:issue-84075, r=davidtwco
workingjubilee Oct 5, 2021
92dbb69
Rollup merge of #89511 - lnicola:rust-analyzer-2021-10-04, r=lnicola
workingjubilee Oct 5, 2021
2ae8ced
Rollup merge of #89536 - RalfJung:miri, r=RalfJung
workingjubilee Oct 5, 2021
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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/13.0-2021-08-08
branch = rustc/13.0-2021-09-30
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book
url = https://github.com/rust-embedded/book.git
Expand Down
32 changes: 14 additions & 18 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ version = "0.1.0"
dependencies = [
"directories",
"rustc-workspace-hack",
"rustc_version",
"rustc_version 0.3.3",
"serde",
"serde_json",
"vergen",
Expand Down Expand Up @@ -1092,19 +1092,6 @@ dependencies = [
"termcolor",
]

[[package]]
name = "env_logger"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54532e3223c5af90a6a757c90b5c5521564b07e5e7a958681bcd2afad421cdcd"
dependencies = [
"atty",
"humantime 2.0.1",
"log",
"regex",
"termcolor",
]

[[package]]
name = "env_logger"
version = "0.9.0"
Expand Down Expand Up @@ -2250,15 +2237,15 @@ version = "0.1.0"
dependencies = [
"colored",
"compiletest_rs",
"env_logger 0.8.1",
"env_logger 0.9.0",
"getrandom 0.2.0",
"hex 0.4.2",
"libc",
"log",
"measureme",
"rand 0.8.4",
"rustc-workspace-hack",
"rustc_version",
"rustc_version 0.4.0",
"shell-escape",
"smallvec",
]
Expand Down Expand Up @@ -4548,6 +4535,15 @@ dependencies = [
"semver 0.11.0",
]

[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver 1.0.3",
]

[[package]]
name = "rustdoc"
version = "0.0.0"
Expand Down Expand Up @@ -4908,9 +4904,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"

[[package]]
name = "smallvec"
version = "1.6.1"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"

[[package]]
name = "snap"
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ impl TokenKind {
match *self {
Comma => Some(vec![Dot, Lt, Semi]),
Semi => Some(vec![Colon, Comma]),
FatArrow => Some(vec![Eq, RArrow]),
_ => None,
}
}
Expand Down
49 changes: 36 additions & 13 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,31 +683,53 @@ impl<'a> AstValidator<'a> {
}
}

fn emit_e0568(&self, span: Span, ident_span: Span) {
struct_span_err!(
self.session,
span,
E0568,
"auto traits cannot have super traits or lifetime bounds"
)
.span_label(ident_span, "auto trait cannot have super traits or lifetime bounds")
.span_suggestion(
span,
"remove the super traits or lifetime bounds",
String::new(),
Applicability::MachineApplicable,
)
.emit();
}

fn deny_super_traits(&self, bounds: &GenericBounds, ident_span: Span) {
if let [first @ last] | [first, .., last] = &bounds[..] {
let span = first.span().to(last.span());
struct_span_err!(self.session, span, E0568, "auto traits cannot have super traits")
.span_label(ident_span, "auto trait cannot have super traits")
.span_suggestion(
span,
"remove the super traits",
String::new(),
Applicability::MachineApplicable,
)
.emit();
if let [.., last] = &bounds[..] {
let span = ident_span.shrink_to_hi().to(last.span());
self.emit_e0568(span, ident_span);
}
}

fn deny_where_clause(&self, where_clause: &WhereClause, ident_span: Span) {
if !where_clause.predicates.is_empty() {
self.emit_e0568(where_clause.span, ident_span);
}
}

fn deny_items(&self, trait_items: &[P<AssocItem>], ident_span: Span) {
if !trait_items.is_empty() {
let spans: Vec<_> = trait_items.iter().map(|i| i.ident.span).collect();
let total_span = trait_items.first().unwrap().span.to(trait_items.last().unwrap().span);
struct_span_err!(
self.session,
spans,
E0380,
"auto traits cannot have methods or associated items"
"auto traits cannot have associated items"
)
.span_suggestion(
total_span,
"remove these associated items",
String::new(),
Applicability::MachineApplicable,
)
.span_label(ident_span, "auto trait cannot have items")
.span_label(ident_span, "auto trait cannot have associated items")
.emit();
}
}
Expand Down Expand Up @@ -1184,6 +1206,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
// Auto traits cannot have generics, super traits nor contain items.
self.deny_generic_params(generics, item.ident.span);
self.deny_super_traits(bounds, item.ident.span);
self.deny_where_clause(&generics.where_clause, item.ident.span);
self.deny_items(trait_items, item.ident.span);
}
self.no_questions_in_bounds(bounds, "supertraits", true);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/sso/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SSO_ARRAY_SIZE: usize = 8;
//
// Missing HashMap API:
// all hasher-related
// try_reserve (unstable)
// try_reserve
// shrink_to (unstable)
// drain_filter (unstable)
// into_keys/into_values (unstable)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/sso/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use super::map::SsoHashMap;
//
// Missing HashSet API:
// all hasher-related
// try_reserve (unstable)
// try_reserve
// shrink_to (unstable)
// drain_filter (unstable)
// replace
Expand Down
13 changes: 7 additions & 6 deletions compiler/rustc_lint/src/nonstandard_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,13 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
if let hir::Node::Pat(parent_pat) = cx.tcx.hir().get(cx.tcx.hir().get_parent_node(hid))
{
if let PatKind::Struct(_, field_pats, _) = &parent_pat.kind {
for field in field_pats.iter() {
if field.ident != ident {
// Only check if a new name has been introduced, to avoid warning
// on both the struct definition and this pattern.
self.check_snake_case(cx, "variable", &ident);
}
if field_pats
.iter()
.any(|field| !field.is_shorthand && field.pat.hir_id == p.hir_id)
{
// Only check if a new name has been introduced, to avoid warning
// on both the struct definition and this pattern.
self.check_snake_case(cx, "variable", &ident);
}
return;
}
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_macros/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,28 +455,28 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {

// Pass on the fatal_cycle modifier
if let Some(fatal_cycle) = &modifiers.fatal_cycle {
attributes.push(quote! { #fatal_cycle });
attributes.push(quote! { (#fatal_cycle) });
};
// Pass on the storage modifier
if let Some(ref ty) = modifiers.storage {
let span = ty.span();
attributes.push(quote_spanned! {span=> storage(#ty) });
attributes.push(quote_spanned! {span=> (storage #ty) });
};
// Pass on the cycle_delay_bug modifier
if let Some(cycle_delay_bug) = &modifiers.cycle_delay_bug {
attributes.push(quote! { #cycle_delay_bug });
attributes.push(quote! { (#cycle_delay_bug) });
};
// Pass on the no_hash modifier
if let Some(no_hash) = &modifiers.no_hash {
attributes.push(quote! { #no_hash });
attributes.push(quote! { (#no_hash) });
};
// Pass on the anon modifier
if let Some(anon) = &modifiers.anon {
attributes.push(quote! { #anon });
attributes.push(quote! { (#anon) });
};
// Pass on the eval_always modifier
if let Some(eval_always) = &modifiers.eval_always {
attributes.push(quote! { #eval_always });
attributes.push(quote! { (#eval_always) });
};

// This uses the span of the query definition for the commas,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ macro_rules! is_eval_always_attr {
}

macro_rules! contains_anon_attr {
($($attr:ident $(($($attr_args:tt)*))* ),*) => ({$(is_anon_attr!($attr) | )* false});
($(($attr:ident $($attr_args:tt)* )),*) => ({$(is_anon_attr!($attr) | )* false});
}

macro_rules! contains_eval_always_attr {
($($attr:ident $(($($attr_args:tt)*))* ),*) => ({$(is_eval_always_attr!($attr) | )* false});
($(($attr:ident $($attr_args:tt)* )),*) => ({$(is_eval_always_attr!($attr) | )* false});
}

#[allow(non_upper_case_globals)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#![feature(thread_local_const_init)]
#![feature(trusted_step)]
#![feature(try_blocks)]
#![feature(try_reserve)]
#![feature(try_reserve_kind)]
#![feature(nonzero_ops)]
#![recursion_limit = "512"]
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/ty/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ macro_rules! query_storage {
([][$K:ty, $V:ty]) => {
<DefaultCacheSelector as CacheSelector<$K, $V>>::Cache
};
([storage($ty:ty) $($rest:tt)*][$K:ty, $V:ty]) => {
([(storage $ty:ty) $($rest:tt)*][$K:ty, $V:ty]) => {
<$ty as CacheSelector<$K, $V>>::Cache
};
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
query_storage!([$($($modifiers)*)*][$($args)*])
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
query_storage!([$($modifiers)*][$($args)*])
};
}

Expand Down
19 changes: 18 additions & 1 deletion compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2322,7 +2322,24 @@ impl<'a> Parser<'a> {
None
};
let arrow_span = this.token.span;
this.expect(&token::FatArrow)?;
if let Err(mut err) = this.expect(&token::FatArrow) {
// We might have a `=>` -> `=` or `->` typo (issue #89396).
if TokenKind::FatArrow
.similar_tokens()
.map_or(false, |similar_tokens| similar_tokens.contains(&this.token.kind))
{
err.span_suggestion(
this.token.span,
"try using a fat arrow here",
"=>".to_string(),
Applicability::MaybeIncorrect,
);
err.emit();
this.bump();
} else {
return Err(err);
}
}
let arm_start_span = this.token.span;

let expr = this.parse_expr_res(Restrictions::STMT_EXPR, None).map_err(|mut err| {
Expand Down
26 changes: 13 additions & 13 deletions compiler/rustc_query_impl/src/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,53 +253,53 @@ macro_rules! handle_cycle_error {
$error.emit();
Value::from_cycle_error($tcx)
}};
([fatal_cycle $($rest:tt)*][$tcx:expr, $error:expr]) => {{
([(fatal_cycle) $($rest:tt)*][$tcx:expr, $error:expr]) => {{
$error.emit();
$tcx.sess.abort_if_errors();
unreachable!()
}};
([cycle_delay_bug $($rest:tt)*][$tcx:expr, $error:expr]) => {{
([(cycle_delay_bug) $($rest:tt)*][$tcx:expr, $error:expr]) => {{
$error.delay_as_bug();
Value::from_cycle_error($tcx)
}};
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
handle_cycle_error!([$($($modifiers)*)*][$($args)*])
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
handle_cycle_error!([$($modifiers)*][$($args)*])
};
}

macro_rules! is_anon {
([]) => {{
false
}};
([anon $($rest:tt)*]) => {{
([(anon) $($rest:tt)*]) => {{
true
}};
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*]) => {
is_anon!([$($($modifiers)*)*])
([$other:tt $($modifiers:tt)*]) => {
is_anon!([$($modifiers)*])
};
}

macro_rules! is_eval_always {
([]) => {{
false
}};
([eval_always $($rest:tt)*]) => {{
([(eval_always) $($rest:tt)*]) => {{
true
}};
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*]) => {
is_eval_always!([$($($modifiers)*)*])
([$other:tt $($modifiers:tt)*]) => {
is_eval_always!([$($modifiers)*])
};
}

macro_rules! hash_result {
([][$hcx:expr, $result:expr]) => {{
dep_graph::hash_result($hcx, &$result)
}};
([no_hash $($rest:tt)*][$hcx:expr, $result:expr]) => {{
([(no_hash) $($rest:tt)*][$hcx:expr, $result:expr]) => {{
None
}};
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
hash_result!([$($($modifiers)*)*][$($args)*])
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
hash_result!([$($modifiers)*][$($args)*])
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ use crate::traits::normalize_projection_type;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{error_code, struct_span_err, Applicability, DiagnosticBuilder, Style};
use rustc_errors::{
error_code, pluralize, struct_span_err, Applicability, DiagnosticBuilder, Style,
};
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::DefId;
Expand Down Expand Up @@ -2273,7 +2275,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
parent_trait_ref = child_trait_ref;
}
if count > 0 {
err.note(&format!("{} redundant requirements hidden", count));
err.note(&format!(
"{} redundant requirement{} hidden",
count,
pluralize!(count)
));
err.note(&format!(
"required because of the requirements on the impl of `{}` for `{}`",
parent_trait_ref.print_only_trait_path(),
Expand Down
Loading