Skip to content

Rollup of 6 pull requests #98910

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 20 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
369555c
Implement `FusedIterator` for `std::net::[Into]Incoming`
ChayimFriedman2 May 23, 2022
c36572c
add AllocRange Debug impl; remove redundant AllocId Display impl
RalfJung Jul 2, 2022
d31cbb5
make AllocRef APIs more consistent
RalfJung Jul 2, 2022
0832d1d
more use of format! variable capture
RalfJung Jul 2, 2022
76c0429
Bump std::net::Incoming FusedIterator impl to Rust 1.64
dtolnay Jul 2, 2022
46ccde4
clean up the borrowing in rustc_hir_pretty
kadiwa4 Jul 3, 2022
7fc7780
fix interpreter validity check on Box
RalfJung Jul 3, 2022
d7edf66
move Box mess handling into general visitor
RalfJung Jul 4, 2022
eb80407
suggest `#[derive(Default)]` to enums with `#[default]`
TaKO8Ki Jul 4, 2022
c2ed087
remove unused function argument
lcnr Jul 1, 2022
f1836c4
update infer cost computation for types
lcnr Jul 1, 2022
eef34a6
stop suggesting things inside of macros
lcnr Jul 1, 2022
7952d2e
resolve vars in node substs
lcnr Jul 1, 2022
f475e88
`InferSource::GenericArg`, check for contains
lcnr Jul 1, 2022
d26ccf7
Rollup merge of #97300 - ChayimFriedman2:patch-1, r=dtolnay
Dylan-DPC Jul 5, 2022
6a9db39
Rollup merge of #98761 - lcnr:need_type_info-cont, r=estebank
Dylan-DPC Jul 5, 2022
522d52c
Rollup merge of #98811 - RalfJung:interpret-alloc-range, r=oli-obk
Dylan-DPC Jul 5, 2022
7702c50
Rollup merge of #98847 - RalfJung:box-is-special, r=oli-obk
Dylan-DPC Jul 5, 2022
6e5f1d4
Rollup merge of #98854 - kadiwa4:rustc_hir_pretty_clean_up_borrowing,…
Dylan-DPC Jul 5, 2022
9a2274c
Rollup merge of #98873 - TaKO8Ki:suggest-default-derive-to-enum-with-…
Dylan-DPC Jul 5, 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
9 changes: 9 additions & 0 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,15 @@ impl<'a> Resolver<'a> {
err.help("have you added the `#[macro_use]` on the module/import?");
return;
}
if ident.name == kw::Default
&& let ModuleKind::Def(DefKind::Enum, def_id, _) = parent_scope.module.kind
&& let Some(span) = self.opt_span(def_id)
{
err.span_help(
self.session.source_map().guess_head_span(span),
"consider adding `#[derive(Default)]` to this enum",
);
}
for ns in [Namespace::MacroNS, Namespace::TypeNS, Namespace::ValueNS] {
if let Ok(binding) = self.early_resolve_ident_in_lexical_scope(
ident,
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/enum/suggest-default-attribute.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pub enum Test { //~ HELP consider adding `#[derive(Default)]` to this enum
#[default]
//~^ ERROR cannot find attribute `default` in this scope
First,
Second,
}

fn main() {}
14 changes: 14 additions & 0 deletions src/test/ui/enum/suggest-default-attribute.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: cannot find attribute `default` in this scope
--> $DIR/suggest-default-attribute.rs:2:7
|
LL | #[default]
| ^^^^^^^
|
help: consider adding `#[derive(Default)]` to this enum
--> $DIR/suggest-default-attribute.rs:1:1
|
LL | pub enum Test {
| ^^^^^^^^^^^^^

error: aborting due to previous error