Skip to content

Rollup of 9 pull requests #121591

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

Merged
merged 25 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
47b2173
Factor out unspecialization
Nadrieril Jan 31, 2024
06d6c62
Add newtype for raw idents
clubby789 Feb 13, 2024
f5d0d08
Add newtype for `IsTuple`
clubby789 Feb 13, 2024
4850ae8
Add newtype for parser recovery
clubby789 Feb 13, 2024
acb2cee
Add newtype for trailing in parser
clubby789 Feb 13, 2024
cb51c85
Use `Recovered` more
clubby789 Feb 13, 2024
9bfc46c
Add newtype for first input type
clubby789 Feb 13, 2024
3377dac
Add newtype for signedness in LLVM SIMD
clubby789 Feb 14, 2024
06e7739
Add newtype for using the prelude in resolution
clubby789 Feb 14, 2024
6edbc8d
Prevent cycle in implied predicates computation
compiler-errors Feb 21, 2024
e656844
moved tests file
nshyrei Feb 23, 2024
93ec0e6
Stabilize `cfg_target_abi`
ChrisDenton Jan 4, 2024
2401ae1
Make most bootstrap step types !Copy
Noratrieb Feb 24, 2024
24aa348
Add test cases for inlining compiler-private items
notriddle Feb 24, 2024
5b7786c
make non-PartialEq-typed consts as patterns a hard error
RalfJung Feb 8, 2024
fa75571
Don't use `unwrap()` in `ArrayIntoIter` lint when typeck fails
gurry Feb 25, 2024
e13f454
Rollup merge of #119590 - ChrisDenton:cfg-target-abi, r=Nilstrieb
matthiaskrgr Feb 25, 2024
c99902e
Rollup merge of #120805 - RalfJung:const-pat-partial-eq, r=oli-obk
matthiaskrgr Feb 25, 2024
7c88ea2
Rollup merge of #121060 - clubby789:bool-newtypes, r=cjgillot
matthiaskrgr Feb 25, 2024
f780824
Rollup merge of #121284 - notriddle:notriddle/issue-106421, r=Mark-Si…
matthiaskrgr Feb 25, 2024
86a35c0
Rollup merge of #121324 - Nadrieril:unspecialize, r=cjgillot
matthiaskrgr Feb 25, 2024
4d442f5
Rollup merge of #121409 - compiler-errors:atb-cycle, r=cjgillot
matthiaskrgr Feb 25, 2024
f548636
Rollup merge of #121513 - nshyrei:fix_tests_module, r=cuviper
matthiaskrgr Feb 25, 2024
3d5fd9d
Rollup merge of #121570 - Nilstrieb:!copy, r=clubby789
matthiaskrgr Feb 25, 2024
a442388
Rollup merge of #121586 - gurry:121532-ice-unwrap-on-none, r=cjgillot
matthiaskrgr Feb 25, 2024
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
Prev Previous commit
Next Next commit
Add newtype for IsTuple
  • Loading branch information
clubby789 committed Feb 20, 2024
commit f5d0d087ad310856f9ed32fdef01acc009a91ff7
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/decodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ where
match fields {
Unnamed(fields, is_tuple) => {
let path_expr = cx.expr_path(outer_pat_path);
if !*is_tuple {
if matches!(is_tuple, IsTuple::No) {
path_expr
} else {
let fields = fields
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/deriving/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ fn default_struct_substructure(
let default_call = |span| cx.expr_call_global(span, default_ident.clone(), ThinVec::new());

let expr = match summary {
Unnamed(_, false) => cx.expr_ident(trait_span, substr.type_ident),
Unnamed(fields, true) => {
Unnamed(_, IsTuple::No) => cx.expr_ident(trait_span, substr.type_ident),
Unnamed(fields, IsTuple::Yes) => {
let exprs = fields.iter().map(|sp| default_call(*sp)).collect();
cx.expr_call_ident(trait_span, substr.type_ident, exprs)
}
Expand Down
13 changes: 11 additions & 2 deletions compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,16 @@ pub struct FieldInfo {
pub other_selflike_exprs: Vec<P<Expr>>,
}

#[derive(Copy, Clone)]
pub enum IsTuple {
No,
Yes,
}

/// Fields for a static method
pub enum StaticFields {
/// Tuple and unit structs/enum variants like this.
Unnamed(Vec<Span>, bool /*is tuple*/),
Unnamed(Vec<Span>, IsTuple),
/// Normal structs/struct variants.
Named(Vec<(Ident, Span)>),
}
Expand Down Expand Up @@ -1439,7 +1445,10 @@ impl<'a> TraitDef<'a> {
}
}

let is_tuple = matches!(struct_def, ast::VariantData::Tuple(..));
let is_tuple = match struct_def {
ast::VariantData::Tuple(..) => IsTuple::Yes,
_ => IsTuple::No,
};
match (just_spans.is_empty(), named_idents.is_empty()) {
(false, false) => cx
.dcx()
Expand Down