Skip to content

Rollup of 6 pull requests #98767

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
Jul 1, 2022
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
e67e165
Make `ThinBox<T>` covariant in `T`
cuviper Jun 27, 2022
7dc0489
fix ICE with -Wrust-2021-incompatible-closure-captures
matthiaskrgr Jun 28, 2022
81abfe3
add blanket impl suggestion to the local traits
vincenzopalazzo May 14, 2022
86c1a73
ui test: add test of blanklet implementation
vincenzopalazzo Jun 22, 2022
835b7a5
ui: improve suggestion test by addig the help message
vincenzopalazzo Jun 29, 2022
72a1621
Use `split_{first,last}` in `cs_fold1`.
nnethercote Jun 28, 2022
7a4fdcb
Remove unnecessary fields from `EnumNonMatchingCollapsed`.
nnethercote Jun 27, 2022
d13fa0d
Remove `Substructure::method_ident`.
nnethercote Jun 28, 2022
625122a
fix grammar in useless doc comment lint
euclio Jun 30, 2022
1254fe9
Remove `{Method,Trait}Def::is_unsafe`.
nnethercote Jun 28, 2022
89f6917
Remove `Substructure::self_args`.
nnethercote Jun 28, 2022
57d5689
Remove some unnecessary `pub`s.
nnethercote Jun 28, 2022
623ebbe
Remove some commented-out code.
nnethercote Jun 28, 2022
78ec19f
`expand_deriving_clone` tweaks.
nnethercote Jun 28, 2022
b942466
Simplify pointer handling.
nnethercote Jun 29, 2022
18fef6b
Remove lifetime support in deriving code.
nnethercote Jun 30, 2022
00307a5
Rename `Ty::Literal` as `Ty::Path`.
nnethercote Jun 30, 2022
85e8d94
Change `Ty::Tuple` to `Ty::Unit`.
nnethercote Jun 30, 2022
f791ac6
use const instead of function and make it private
TaKO8Ki Jul 1, 2022
e2ed8d7
Rollup merge of #97488 - vincenzopalazzo:macros/blanket_sugg, r=compi…
Dylan-DPC Jul 1, 2022
9dd3288
Rollup merge of #98585 - cuviper:covariant-thinbox, r=thomcc
Dylan-DPC Jul 1, 2022
90b296d
Rollup merge of #98644 - matthiaskrgr:drp_loc_span_err__2021_inc_clos…
Dylan-DPC Jul 1, 2022
528202f
Rollup merge of #98739 - euclio:useless-comment-plural, r=Dylan-DPC
Dylan-DPC Jul 1, 2022
c0cf363
Rollup merge of #98741 - nnethercote:deriving-cleanups, r=Mark-Simula…
Dylan-DPC Jul 1, 2022
6404620
Rollup merge of #98756 - TaKO8Ki:use-const-instead-of-function, r=Dyl…
Dylan-DPC Jul 1, 2022
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
Rename Ty::Literal as Ty::Path.
Because a `Literal` is a type of expression, and is simply the wrong
name for this.
  • Loading branch information
nnethercote committed Jul 1, 2022
commit 00307a5b6f1d81fb5d19f1ef7235ff235ce75d50
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn expand_deriving_clone(
}
}
ItemKind::Union(..) => {
bounds = vec![Literal(path_std!(marker::Copy))];
bounds = vec![Path(path_std!(marker::Copy))];
is_simple = true;
substructure = combine_substructure(Box::new(|c, s, sub| {
cs_clone_simple("Clone", c, s, sub, true)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn expand_deriving_ord(
generics: Bounds::empty(),
explicit_self: true,
args: vec![(self_ref(), sym::other)],
ret_ty: Literal(path_std!(cmp::Ordering)),
ret_ty: Path(path_std!(cmp::Ordering)),
attributes: attrs,
unify_fieldless_variants: true,
combine_substructure: combine_substructure(Box::new(|a, b, c| cs_cmp(a, b, c))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn expand_deriving_partial_eq(
generics: Bounds::empty(),
explicit_self: true,
args: vec![(self_ref(), sym::other)],
ret_ty: Literal(path_local!(bool)),
ret_ty: Path(path_local!(bool)),
attributes: attrs,
unify_fieldless_variants: true,
combine_substructure: combine_substructure(Box::new(|a, b, c| $f(a, b, c))),
Expand Down
9 changes: 3 additions & 6 deletions compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ pub fn expand_deriving_partial_ord(
item: &Annotatable,
push: &mut dyn FnMut(Annotatable),
) {
let ordering_ty = Literal(path_std!(cmp::Ordering));
let ret_ty = Literal(Path::new_(
pathvec_std!(option::Option),
vec![Box::new(ordering_ty)],
PathKind::Std,
));
let ordering_ty = Path(path_std!(cmp::Ordering));
let ret_ty =
Path(Path::new_(pathvec_std!(option::Option), vec![Box::new(ordering_ty)], PathKind::Std));

let inline = cx.meta_word(span, sym::inline);
let attrs = vec![cx.attribute(inline)];
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/deriving/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn expand_deriving_debug(
push: &mut dyn FnMut(Annotatable),
) {
// &mut ::std::fmt::Formatter
let fmtr = Ref(Box::new(Literal(path_std!(fmt::Formatter))), ast::Mutability::Mut);
let fmtr = Ref(Box::new(Path(path_std!(fmt::Formatter))), ast::Mutability::Mut);

let trait_def = TraitDef {
span,
Expand All @@ -30,7 +30,7 @@ pub fn expand_deriving_debug(
generics: Bounds::empty(),
explicit_self: true,
args: vec![(fmtr, sym::f)],
ret_ty: Literal(path_std!(fmt::Result)),
ret_ty: Path(path_std!(fmt::Result)),
attributes: Vec::new(),
unify_fieldless_variants: false,
combine_substructure: combine_substructure(Box::new(|a, b, c| {
Expand Down
10 changes: 3 additions & 7 deletions compiler/rustc_builtin_macros/src/deriving/decodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,12 @@ pub fn expand_deriving_rustc_decodable(
)],
},
explicit_self: false,
args: vec![(Ref(Box::new(Literal(Path::new_local(typaram))), Mutability::Mut), sym::d)],
ret_ty: Literal(Path::new_(
args: vec![(Ref(Box::new(Path(Path::new_local(typaram))), Mutability::Mut), sym::d)],
ret_ty: Path(Path::new_(
pathvec_std!(result::Result),
vec![
Box::new(Self_),
Box::new(Literal(Path::new_(
vec![typaram, sym::Error],
vec![],
PathKind::Local,
))),
Box::new(Path(Path::new_(vec![typaram, sym::Error], vec![], PathKind::Local))),
],
PathKind::Std,
)),
Expand Down
10 changes: 3 additions & 7 deletions compiler/rustc_builtin_macros/src/deriving/encodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,12 @@ pub fn expand_deriving_rustc_encodable(
)],
},
explicit_self: true,
args: vec![(Ref(Box::new(Literal(Path::new_local(typaram))), Mutability::Mut), sym::s)],
ret_ty: Literal(Path::new_(
args: vec![(Ref(Box::new(Path(Path::new_local(typaram))), Mutability::Mut), sym::s)],
ret_ty: Path(Path::new_(
pathvec_std!(result::Result),
vec![
Box::new(Tuple(Vec::new())),
Box::new(Literal(Path::new_(
vec![typaram, sym::Error],
vec![],
PathKind::Local,
))),
Box::new(Path(Path::new_(vec![typaram, sym::Error], vec![], PathKind::Local))),
],
PathKind::Std,
)),
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_builtin_macros/src/deriving/generic/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub enum Ty {
Ref(Box<Ty>, ast::Mutability),
/// `mod::mod::Type<[lifetime], [Params...]>`, including a plain type
/// parameter, and things like `i32`
Literal(Path),
Path(Path),
/// includes unit
Tuple(Vec<Ty>),
}
Expand All @@ -103,7 +103,7 @@ impl Ty {
let raw_ty = ty.to_ty(cx, span, self_ty, self_generics);
cx.ty_rptr(span, raw_ty, None, *mutbl)
}
Literal(p) => p.to_ty(cx, span, self_ty, self_generics),
Path(p) => p.to_ty(cx, span, self_ty, self_generics),
Self_ => cx.ty_path(self.to_path(cx, span, self_ty, self_generics)),
Tuple(fields) => {
let ty = ast::TyKind::Tup(
Expand Down Expand Up @@ -141,7 +141,7 @@ impl Ty {

cx.path_all(span, false, vec![self_ty], params)
}
Literal(ref p) => p.to_path(cx, span, self_ty, generics),
Path(ref p) => p.to_path(cx, span, self_ty, generics),
Ref(..) => cx.span_bug(span, "ref in a path in generic `derive`"),
Tuple(..) => cx.span_bug(span, "tuple in a path in generic `derive`"),
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn expand_deriving_hash(
name: sym::hash,
generics: Bounds { bounds: vec![(typaram, vec![path_std!(hash::Hasher)])] },
explicit_self: true,
args: vec![(Ref(Box::new(Literal(arg)), Mutability::Mut), sym::state)],
args: vec![(Ref(Box::new(Path(arg)), Mutability::Mut), sym::state)],
ret_ty: nil_ty(),
attributes: vec![],
unify_fieldless_variants: true,
Expand Down