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 12 pull requests #79369

Closed
wants to merge 174 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
be81608
split `interior_mutable_const` tests and clean it
rail-rain Sep 30, 2020
f58a169
fix a FP in `interior_mutable_const`
rail-rain Sep 30, 2020
7c74d87
Fix vec_box scope error
camsteffen Oct 30, 2020
c0d1002
Fix unnecessary_lazy_eval suggestion applicability
camsteffen Oct 30, 2020
158bf9a
Fix incorrect suggestion for macro expansion in `deref_addrof` lint
ThibsG Oct 31, 2020
343bdb3
Give better suggestion by working on span on `deref_addrof` lint
ThibsG Nov 2, 2020
ce98468
Fix incorrect suggestion when from expansion in `try_err` lint
ThibsG Nov 2, 2020
a6611de
Include bindings as machine applicable
camsteffen Nov 2, 2020
89fa373
rustc_ast: Do not panic by default when visiting macro calls
petrochenkov Nov 3, 2020
c2a769f
rustc_ast: `visit_mac` -> `visit_mac_call`
petrochenkov Nov 3, 2020
a4acb31
Fix example for cargo common data
Urcra Nov 4, 2020
fd8dece
Readme improvements
camsteffen Nov 3, 2020
bc27d14
Add string_from_utf8_as_bytes linter
patrickelectric Oct 8, 2020
f83762b
Skip rustfmt as it is wanted for this test
ThibsG Nov 2, 2020
3424419
Merge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup
flip1995 Nov 5, 2020
83e75f9
Fix incorrect suggestion for `try_err` lint when `Err` arg is itself …
ThibsG Nov 5, 2020
1e4ce0f
Fix `await_holding_refcell_ref` examples for clarify
JohnTitor Nov 5, 2020
1624b00
Fix suggestion to add unneeded space in `manual_async`
giraffate Nov 5, 2020
5f57608
do not trigger map_clone in the case of &mut
alex-700 Nov 6, 2020
b7892c6
Refactor to make getting position just before RArrow a common function
giraffate Nov 6, 2020
8242b2f
Remove needless allow
ThibsG Oct 30, 2020
2ea08e1
Auto merge of #6294 - giraffate:fix_suggestion_to_add_space_in_manual…
bors Nov 6, 2020
5253595
FROM_ITER_INSTEAD_OF_COLLECT: avoid unwrapping unconditionally
matthiaskrgr Nov 6, 2020
4bbef42
Auto merge of #6272 - camsteffen:unnecesary-lazy-eval-type, r=llogiq
bors Nov 7, 2020
694cec1
Auto merge of #6110 - rail-rain:care_enums_non_copy_const, r=llogiq
bors Nov 7, 2020
92ba075
Auto merge of #6134 - patrickelectric:as_utf8, r=llogiq
bors Nov 7, 2020
4aca13f
Auto merge of #6287 - camsteffen:readme, r=llogiq
bors Nov 7, 2020
5effc99
Auto merge of #6298 - JohnTitor:fix-example, r=llogiq
bors Nov 7, 2020
c015622
Auto merge of #6304 - matthiaskrgr:crash_6302, r=llogiq
bors Nov 7, 2020
96d5f45
Auto merge of #6301 - alex-700:fix-map-clone, r=matthiaskrgr
bors Nov 8, 2020
c6a91df
Enable empty_loop lint for no_std crates
josephlr Oct 23, 2020
3579b7d
Update clippy_lints/src/loops.rs
josephlr Nov 4, 2020
00dee9d
Update reference files
flip1995 Nov 8, 2020
abfa331
Auto merge of #6205 - josephlr:empty-loop2, r=flip1995
bors Nov 8, 2020
f1f780c
Add let_underscore_drop
smoelius Nov 7, 2020
b1faa7f
Auto merge of #6271 - camsteffen:vec-box-import, r=flip1995
bors Nov 8, 2020
9c6a0b9
Update references
smoelius Nov 8, 2020
7079de9
Auto merge of #6293 - Urcra:lint-example-fix, r=flip1995
bors Nov 8, 2020
7c612c1
Force contributors/reviewers to set _some_ changelog entry
flip1995 Nov 8, 2020
040d0ca
Auto merge of #6288 - flip1995:changelog_internal, r=matthiaskrgr
bors Nov 8, 2020
b099406
Make KNOW_TYPES static
camsteffen Oct 29, 2020
9cab084
Fix or_fun_call for index operator
camsteffen Oct 29, 2020
2067a01
Auto merge of #6267 - camsteffen:or-fun-idx, r=flip1995
bors Nov 8, 2020
aa6bf1f
Update clippy_lints/src/let_underscore.rs
smoelius Nov 8, 2020
9751cba
Update clippy_lints/src/let_underscore.rs
smoelius Nov 8, 2020
8211b59
Update clippy_lints/src/let_underscore.rs
smoelius Nov 8, 2020
40d7af5
Update lints
smoelius Nov 8, 2020
8845f10
Do not collect tokens for doc comments
petrochenkov Nov 5, 2020
06e81bb
Update references
smoelius Nov 8, 2020
d212c38
Auto merge of #6278 - ThibsG:DerefAddrOf, r=llogiq
bors Nov 9, 2020
4852cca
Allow `let_underscore_drop` in `filter_methods` test
smoelius Nov 9, 2020
6294300
Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwco
Dylan-DPC Nov 9, 2020
dd826b4
Auto merge of #6305 - smoelius:master, r=flip1995
bors Nov 9, 2020
3ea6f77
Merge remote-tracking branch 'upstream/master' into rustup
ebroto Nov 10, 2020
effcb52
Run cargo dev fmt
ebroto Nov 10, 2020
467bf95
Auto merge of #6319 - ebroto:rustup, r=ebroto
bors Nov 10, 2020
d0858d0
Auto merge of #6303 - ThibsG:OptionOptionSerde, r=ebroto
bors Nov 10, 2020
7690944
Fix map_clone with deref and clone
camsteffen Oct 30, 2020
c4fc076
Auto merge of #6269 - camsteffen:map-clone-deref, r=ebroto
bors Nov 11, 2020
a1cf2d3
Added a lint as suggested in 6010 which recommends using `contains()`
rsulli55 Oct 6, 2020
431fcbc
Moved the tests for lint `search_is_some` to new files
rsulli55 Oct 17, 2020
55dc822
Ran `tests/ui/update-all-references.sh" and `cargo dev fmt`
rsulli55 Oct 17, 2020
e9612f3
Remove `to_string` on msg
rsulli55 Oct 26, 2020
fb74b48
Remove borrow
rsulli55 Oct 26, 2020
ee1b959
Added period back to lint `search_is_some` and ran
rsulli55 Oct 31, 2020
fd30313
Cleaned up message and suggestion for `lint_search_is_some`
rsulli55 Nov 7, 2020
56d252c
Update clippy_lints/src/methods/mod.rs
rsulli55 Nov 11, 2020
5c1c50e
Change variable named `foo` and rerun `update-all-references`
rsulli55 Nov 11, 2020
f92f8d0
Fix typo in comment
eltociear Nov 11, 2020
5f310d9
Implement destructuring assignment for structs and slices
fanzier Nov 7, 2020
5f64867
Fix suggestion in `manual_range_contains` when using float
giraffate Nov 11, 2020
d569696
Add Metadata in std::os::fortanix_sgx::io::FromRawFd
mzohreva Nov 11, 2020
92ece84
Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011
bors Nov 12, 2020
bd13a35
Auto merge of #6325 - flip1995:rustup, r=flip1995
bors Nov 12, 2020
084b0da
Add missing stability attribute
mzohreva Nov 12, 2020
3a648ff
Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=pe…
m-ou-se Nov 12, 2020
c6b74df
Fix dogfood test
giraffate Nov 13, 2020
cf7b4b0
Auto merge of #6329 - giraffate:sync-from-rust, r=matthiaskrgr
bors Nov 13, 2020
7987f39
update clippy test ouput
vn-ki Nov 13, 2020
408b615
Auto merge of #6320 - giraffate:fix_suggestion_in_manual_range_contai…
bors Nov 14, 2020
864e554
Add underscore expressions for destructuring assignments
fanzier Nov 11, 2020
0c7a48c
Auto merge of #78809 - vn-ki:fix-issue-76064, r=oli-obk
bors Nov 14, 2020
cbb6b1c
Introduce `TypeVisitor::BreakTy`
LeSeulArtichaut Nov 5, 2020
1b55cc7
Set the default `BreakTy` to `!`
LeSeulArtichaut Nov 14, 2020
27a1572
Rollup merge of #79016 - fanzier:underscore-expressions, r=petrochenkov
jonas-schievink Nov 15, 2020
db04641
Auto merge of #6334 - flip1995:rustup, r=flip1995
bors Nov 15, 2020
0e80341
Add `rustfmt::skip` as a work around
giraffate Nov 16, 2020
df3bb58
Auto merge of #6336 - giraffate:sync-from-rust, r=flip1995
bors Nov 16, 2020
ad4f829
Auto merge of #6119 - rsulli55:find_is_some_on_strs, r=flip1995
bors Nov 16, 2020
3567ea5
clippy: fold by value
lcnr Oct 24, 2020
5b8f2b6
Remove `expect()` calls to avoid ICEs in `deref_addrof` lint
ThibsG Nov 16, 2020
a467c51
Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obk
bors Nov 17, 2020
a7ac441
Add new lint to detect unnecessarily wrapped value
hkmatsumoto Sep 19, 2020
750c118
Add suggestion on type signatures
hkmatsumoto Sep 20, 2020
0335b8d
Fix lint example
hkmatsumoto Sep 20, 2020
0e9d227
Add test cases
hkmatsumoto Sep 20, 2020
ebdd4e2
Refactor code according to reivews
hkmatsumoto Sep 22, 2020
6a62390
Optout rustfix test
hkmatsumoto Sep 22, 2020
3ed8902
Fix typo
hkmatsumoto Sep 22, 2020
c775856
Call `diag.multipart_suggestion` instead
hkmatsumoto Sep 22, 2020
a433d46
Run rustfmt
hkmatsumoto Sep 22, 2020
cdb72df
Split lint suggestion into two
hkmatsumoto Sep 26, 2020
6b55f3f
Add test case
hkmatsumoto Sep 26, 2020
df0d565
Move `find_all_ret_expressions` into `utils`
hkmatsumoto Oct 2, 2020
eec7f5c
Update clippy_lints/src/unnecessary_wrap.rs
hkmatsumoto Oct 12, 2020
1bdac87
Improve lint message
hkmatsumoto Oct 12, 2020
8392bc7
Run `cargo dev fmt`
hkmatsumoto Oct 12, 2020
2f85aa7
Make lint skip closures
hkmatsumoto Oct 18, 2020
12474c6
Add support for methods
hkmatsumoto Oct 18, 2020
c5447eb
Make lint skip macros
hkmatsumoto Oct 18, 2020
c7692cf
Skip function with no exprs contained
hkmatsumoto Oct 18, 2020
30632fb
Allow this lint on lint tests
hkmatsumoto Oct 18, 2020
e998d61
Downgrade applicability to MaybeIncorrect
hkmatsumoto Oct 18, 2020
9d96311
Remove wildcard use
hkmatsumoto Oct 18, 2020
532d205
Skip functions in PartialOrd
hkmatsumoto Oct 18, 2020
bf46f78
Fix clippy error
hkmatsumoto Oct 18, 2020
86331a4
Update stderr files
hkmatsumoto Nov 2, 2020
4c8d248
Update stderr files
hkmatsumoto Nov 14, 2020
4e5c02e
Ignore trait implementations
hkmatsumoto Nov 14, 2020
1f577c0
Fix embarrassing grammatical error
hkmatsumoto Nov 14, 2020
c7445d7
Pluralize lint name
hkmatsumoto Nov 17, 2020
bf2d31d
Run cargo dev fmt
flip1995 Nov 17, 2020
a8cafc6
Auto merge of #6338 - flip1995:rustup, r=flip1995
bors Nov 17, 2020
5464cbe
Auto merge of #6337 - ThibsG:FixIce6332, r=Manishearth
bors Nov 17, 2020
4e4c4fb
Fix handling of panic calls
camelid Nov 17, 2020
44d9445
Auto merge of #6070 - matsujika:unnecessary_wrap, r=flip1995
bors Nov 17, 2020
0502ac2
Improve doc about `map_clone`
giraffate Nov 17, 2020
8c2e2fd
Auto merge of #6340 - giraffate:improve_doc_for_map_clone, r=Manishearth
bors Nov 18, 2020
6494bd0
Revert "Add `rustfmt::skip` as a work around"
giraffate Nov 18, 2020
577ebc8
Rollup merge of #79145 - camelid:clippy-fix-panics, r=flip1995
m-ou-se Nov 18, 2020
b2aefb8
Auto merge of #6345 - giraffate:follow_up_of_rustup, r=flip1995
bors Nov 19, 2020
4bf58bd
Add CHANGELOG for 1.48
flip1995 Nov 19, 2020
a98acdb
Fix trailing whitespaces in CHANGELOG file
flip1995 Nov 19, 2020
e9afdf0
Improve changlog update documentation
flip1995 Nov 19, 2020
78faaef
Remove the clippy::panic-params lint.
m-ou-se Nov 19, 2020
113c147
Clippy: Match on assert!() expansions without an inner block.
m-ou-se Nov 19, 2020
dd4e471
Properly deprecate panic_params lint
flip1995 Nov 20, 2020
5ee0a40
Fix dogfood errors
flip1995 Nov 20, 2020
8325d48
Auto merge of #6351 - flip1995:rustup, r=flip1995
bors Nov 20, 2020
70ffebf
Auto merge of #6347 - flip1995:changelog, r=Manishearth
bors Nov 20, 2020
8b21241
Revert "Convert the await holding lints to correctness"
Nov 20, 2020
0402c6a
Auto merge of #6354 - Daniel-B-Smith:refcell_ref_await, r=flip1995
bors Nov 20, 2020
9b910e1
a typo
Nov 22, 2020
e30bb76
update
Nov 22, 2020
6667c66
Add test for an unmotivated "cannot determine resolution" error
petrochenkov Nov 22, 2020
27af650
resolve: Do not put macros into `module.unexpanded_invocations` unles…
petrochenkov Nov 21, 2020
4284ec3
Auto merge of #6364 - o752d:master, r=flip1995
bors Nov 22, 2020
831aa96
Auto merge of #6363 - o752d:patch-2, r=flip1995
bors Nov 22, 2020
034244f
Small grammar, punctuation, and code style improvements to docs
carols10cents Nov 21, 2020
445466e
Apply suggestions from code review to change "that" to "which"
carols10cents Nov 22, 2020
3e7c6de
Auto merge of #6361 - integer32llc:doc-style, r=carols10cents
bors Nov 22, 2020
ab1e634
Make `fold_item_recur` non-nullable
jyn514 Nov 22, 2020
0043fc9
Get rid of `doctree::Impl`
jyn514 Nov 22, 2020
0b6537a
Accept '!' in intra-doc links
camelid Nov 22, 2020
fafe3cd
Allow using `-Z fewer-names=no` to retain value names
tmiasko Nov 23, 2020
dfac9be
Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup
flip1995 Nov 23, 2020
99b9459
Fix ICE in utils::implements_trait
flip1995 Nov 23, 2020
c5c3d7b
Fix typo in keyword docs for traits
Takashiidobe Nov 23, 2020
8526c31
BTreeMap: cut out the ceremony around BoxedNode
ssomers Nov 23, 2020
9c8db45
BTreeMap/BTreeSet: make public doc more consistent
ssomers Nov 23, 2020
fcbe638
Make ui test that are run-pass and do not test the compiler itself li…
CDirkx Nov 22, 2020
7b62e09
Allow disabling TrapUnreachable via -Ztrap-unreachable=no
Dirbaio Nov 23, 2020
04db18d
Rollup merge of #78953 - mzohreva:mz/from_raw_fd, r=Mark-Simulacrum
Dylan-DPC Nov 24, 2020
21b3fc0
Rollup merge of #79038 - CDirkx:move-ui-tests, r=dtolnay
Dylan-DPC Nov 24, 2020
f7875d3
Rollup merge of #79228 - flip1995:clippyup, r=oli-obk
Dylan-DPC Nov 24, 2020
8c315c6
Rollup merge of #79294 - petrochenkov:determ, r=varkor
Dylan-DPC Nov 24, 2020
e6349ac
Rollup merge of #79310 - jyn514:fold-item-cleanup, r=GuillaumeGomez
Dylan-DPC Nov 24, 2020
5b492c9
Rollup merge of #79312 - jyn514:doctree-impl, r=GuillaumeGomez
Dylan-DPC Nov 24, 2020
9a05fd6
Rollup merge of #79321 - camelid:intra-doc-bang, r=Manishearth
Dylan-DPC Nov 24, 2020
f013b4d
Rollup merge of #79346 - tmiasko:more-names, r=jonas-schievink
Dylan-DPC Nov 24, 2020
1361d74
Rollup merge of #79351 - Takashiidobe:keyword-docs-typo, r=m-ou-se
Dylan-DPC Nov 24, 2020
a8c1597
Rollup merge of #79354 - ssomers:btree_bereave_BoxedNode, r=Mark-Simu…
Dylan-DPC Nov 24, 2020
0e7ce1e
Rollup merge of #79358 - ssomers:btree_public_comments, r=Mark-Simula…
Dylan-DPC Nov 24, 2020
e5a4e14
Rollup merge of #79367 - Dirbaio:trap-unreachable, r=jonas-schievink
Dylan-DPC Nov 24, 2020
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
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ pub fn target_machine_factory(
let features = features.join(",");
let features = CString::new(features).unwrap();
let abi = SmallCStr::new(&sess.target.llvm_abiname);
let trap_unreachable = sess.target.trap_unreachable;
let trap_unreachable =
sess.opts.debugging_opts.trap_unreachable.unwrap_or(sess.target.trap_unreachable);
let emit_stack_size_section = sess.opts.debugging_opts.emit_stack_sizes;

let asm_comments = sess.asm_comments();
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ fn test_debugging_options_tracking_hash() {
tracked!(debug_macros, true);
tracked!(dep_info_omit_d_target, true);
tracked!(dual_proc_macros, true);
tracked!(fewer_names, true);
tracked!(fewer_names, Some(true));
tracked!(force_overflow_checks, Some(true));
tracked!(force_unstable_if_unmarked, true);
tracked!(fuel, Some(("abc".to_string(), 99)));
Expand Down Expand Up @@ -592,6 +592,7 @@ fn test_debugging_options_tracking_hash() {
tracked!(thinlto, Some(true));
tracked!(tune_cpu, Some(String::from("abc")));
tracked!(tls_model, Some(TlsModel::GeneralDynamic));
tracked!(trap_unreachable, Some(false));
tracked!(treat_err_as_bug, Some(1));
tracked!(unleash_the_miri_inside_of_you, true);
tracked!(use_ctors_section, Some(true));
Expand Down
29 changes: 20 additions & 9 deletions compiler/rustc_resolve/src/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1155,14 +1155,18 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
false
}

fn visit_invoc(&mut self, id: NodeId) -> MacroRulesScopeRef<'a> {
fn visit_invoc(&mut self, id: NodeId) -> ExpnId {
let invoc_id = id.placeholder_to_expn_id();

self.parent_scope.module.unexpanded_invocations.borrow_mut().insert(invoc_id);

let old_parent_scope = self.r.invocation_parent_scopes.insert(invoc_id, self.parent_scope);
assert!(old_parent_scope.is_none(), "invocation data is reset for an invocation");
invoc_id
}

/// Visit invocation in context in which it can emit a named item (possibly `macro_rules`)
/// directly into its parent scope's module.
fn visit_invoc_in_module(&mut self, id: NodeId) -> MacroRulesScopeRef<'a> {
let invoc_id = self.visit_invoc(id);
self.parent_scope.module.unexpanded_invocations.borrow_mut().insert(invoc_id);
self.r.arenas.alloc_macro_rules_scope(MacroRulesScope::Invocation(invoc_id))
}

Expand Down Expand Up @@ -1291,7 +1295,7 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
return;
}
ItemKind::MacCall(..) => {
self.parent_scope.macro_rules = self.visit_invoc(item.id);
self.parent_scope.macro_rules = self.visit_invoc_in_module(item.id);
return;
}
ItemKind::Mod(..) => self.contains_macro_use(&item.attrs),
Expand All @@ -1309,15 +1313,15 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {

fn visit_stmt(&mut self, stmt: &'b ast::Stmt) {
if let ast::StmtKind::MacCall(..) = stmt.kind {
self.parent_scope.macro_rules = self.visit_invoc(stmt.id);
self.parent_scope.macro_rules = self.visit_invoc_in_module(stmt.id);
} else {
visit::walk_stmt(self, stmt);
}
}

fn visit_foreign_item(&mut self, foreign_item: &'b ForeignItem) {
if let ForeignItemKind::MacCall(_) = foreign_item.kind {
self.visit_invoc(foreign_item.id);
self.visit_invoc_in_module(foreign_item.id);
return;
}

Expand All @@ -1336,7 +1340,14 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {

fn visit_assoc_item(&mut self, item: &'b AssocItem, ctxt: AssocCtxt) {
if let AssocItemKind::MacCall(_) = item.kind {
self.visit_invoc(item.id);
match ctxt {
AssocCtxt::Trait => {
self.visit_invoc_in_module(item.id);
}
AssocCtxt::Impl => {
self.visit_invoc(item.id);
}
}
return;
}

Expand Down Expand Up @@ -1460,7 +1471,7 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
// type and value namespaces.
fn visit_variant(&mut self, variant: &'b ast::Variant) {
if variant.is_placeholder {
self.visit_invoc(variant.id);
self.visit_invoc_in_module(variant.id);
return;
}

Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"emits a future-incompatibility report for lints (RFC 2834)"),
emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
"emit a section containing stack size metadata (default: no)"),
fewer_names: bool = (false, parse_bool, [TRACKED],
fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED],
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
(default: no)"),
force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
Expand Down Expand Up @@ -1113,6 +1113,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"choose the TLS model to use (`rustc --print tls-models` for details)"),
trace_macros: bool = (false, parse_bool, [UNTRACKED],
"for every macro invocation, print its name and arguments (default: no)"),
trap_unreachable: Option<bool> = (None, parse_opt_bool, [TRACKED],
"generate trap instructions for unreachable intrinsics (default: use target setting, usually yes)"),
treat_err_as_bug: Option<usize> = (None, parse_treat_err_as_bug, [TRACKED],
"treat error number `val` that occurs as bug"),
trim_diagnostic_paths: bool = (true, parse_bool, [UNTRACKED],
Expand Down
15 changes: 9 additions & 6 deletions compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,12 +734,15 @@ impl Session {
self.opts.cg.panic.unwrap_or(self.target.panic_strategy)
}
pub fn fewer_names(&self) -> bool {
let more_names = self.opts.output_types.contains_key(&OutputType::LlvmAssembly)
|| self.opts.output_types.contains_key(&OutputType::Bitcode)
// AddressSanitizer and MemorySanitizer use alloca name when reporting an issue.
|| self.opts.debugging_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY);

self.opts.debugging_opts.fewer_names || !more_names
if let Some(fewer_names) = self.opts.debugging_opts.fewer_names {
fewer_names
} else {
let more_names = self.opts.output_types.contains_key(&OutputType::LlvmAssembly)
|| self.opts.output_types.contains_key(&OutputType::Bitcode)
// AddressSanitizer and MemorySanitizer use alloca name when reporting an issue.
|| self.opts.debugging_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY);
!more_names
}
}

pub fn unstable_options(&self) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for RangeMut<'_, K, V> {
}

impl<K: Ord, V> BTreeMap<K, V> {
/// Makes a new empty BTreeMap.
/// Makes a new, empty `BTreeMap`.
///
/// Does not allocate anything on its own.
///
Expand Down Expand Up @@ -1924,7 +1924,7 @@ impl<K: Hash, V: Hash> Hash for BTreeMap<K, V> {

#[stable(feature = "rust1", since = "1.0.0")]
impl<K: Ord, V> Default for BTreeMap<K, V> {
/// Creates an empty `BTreeMap<K, V>`.
/// Creates an empty `BTreeMap`.
fn default() -> BTreeMap<K, V> {
BTreeMap::new()
}
Expand Down
50 changes: 12 additions & 38 deletions library/alloc/src/collections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,8 @@ impl<K, V> InternalNode<K, V> {
///
/// However, `BoxedNode` contains no information as to which of the two types
/// of nodes it actually contains, and, partially due to this lack of information,
/// has no destructor.
struct BoxedNode<K, V> {
ptr: NonNull<LeafNode<K, V>>,
}

impl<K, V> BoxedNode<K, V> {
fn from_owned(ptr: NonNull<LeafNode<K, V>>) -> Self {
BoxedNode { ptr }
}

fn as_ptr(&self) -> NonNull<LeafNode<K, V>> {
self.ptr
}
}
/// is not a separate type and has no destructor.
type BoxedNode<K, V> = NonNull<LeafNode<K, V>>;

/// An owned tree.
///
Expand Down Expand Up @@ -168,11 +156,6 @@ impl<K, V, Type> NodeRef<marker::Owned, K, V, Type> {
pub fn borrow_valmut(&mut self) -> NodeRef<marker::ValMut<'_>, K, V, Type> {
NodeRef { height: self.height, node: self.node, _marker: PhantomData }
}

/// Packs the reference, aware of type and height, into a type-agnostic pointer.
fn into_boxed_node(self) -> BoxedNode<K, V> {
BoxedNode::from_owned(self.node)
}
}

impl<K, V> NodeRef<marker::Owned, K, V, marker::LeafOrInternal> {
Expand All @@ -181,7 +164,7 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::LeafOrInternal> {
/// and is the opposite of `pop_internal_level`.
pub fn push_internal_level(&mut self) -> NodeRef<marker::Mut<'_>, K, V, marker::Internal> {
let mut new_node = Box::new(unsafe { InternalNode::new() });
new_node.edges[0].write(BoxedNode::from_owned(self.node));
new_node.edges[0].write(self.node);
let mut new_root = NodeRef::from_new_internal(new_node, self.height + 1);
new_root.borrow_mut().first_edge().correct_parent_link();
*self = new_root.forget_type();
Expand Down Expand Up @@ -288,13 +271,6 @@ unsafe impl<'a, K: Send + 'a, V: Send + 'a, Type> Send for NodeRef<marker::Mut<'
unsafe impl<'a, K: Send + 'a, V: Send + 'a, Type> Send for NodeRef<marker::ValMut<'a>, K, V, Type> {}
unsafe impl<K: Send, V: Send, Type> Send for NodeRef<marker::Owned, K, V, Type> {}

impl<BorrowType, K, V> NodeRef<BorrowType, K, V, marker::LeafOrInternal> {
/// Unpack a node reference that was packed by `Root::into_boxed_node`.
fn from_boxed_node(boxed_node: BoxedNode<K, V>, height: usize) -> Self {
NodeRef { height, node: boxed_node.as_ptr(), _marker: PhantomData }
}
}

impl<BorrowType, K, V> NodeRef<BorrowType, K, V, marker::Internal> {
/// Unpack a node reference that was packed as `NodeRef::parent`.
fn from_internal(node: NonNull<InternalNode<K, V>>, height: usize) -> Self {
Expand Down Expand Up @@ -695,7 +671,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
unsafe {
self.reborrow_mut().into_key_area_mut_at(idx).write(key);
self.reborrow_mut().into_val_area_mut_at(idx).write(val);
self.reborrow_mut().into_edge_area_mut_at(idx + 1).write(edge.into_boxed_node());
self.reborrow_mut().into_edge_area_mut_at(idx + 1).write(edge.node);
Handle::new_edge(self.reborrow_mut(), idx + 1).correct_parent_link();
}
}
Expand All @@ -710,7 +686,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
*self.reborrow_mut().into_len_mut() += 1;
slice_insert(self.reborrow_mut().into_key_area_slice(), 0, key);
slice_insert(self.reborrow_mut().into_val_area_slice(), 0, val);
slice_insert(self.reborrow_mut().into_edge_area_slice(), 0, edge.into_boxed_node());
slice_insert(self.reborrow_mut().into_edge_area_slice(), 0, edge.node);
}

self.correct_all_childrens_parent_links();
Expand All @@ -732,8 +708,8 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
let edge = match self.reborrow_mut().force() {
ForceResult::Leaf(_) => None,
ForceResult::Internal(internal) => {
let boxed_node = ptr::read(internal.reborrow().edge_at(idx + 1));
let mut edge = Root::from_boxed_node(boxed_node, internal.height - 1);
let node = ptr::read(internal.reborrow().edge_at(idx + 1));
let mut edge = Root { node, height: internal.height - 1, _marker: PhantomData };
// In practice, clearing the parent is a waste of time, because we will
// insert the node elsewhere and set its parent link again.
edge.borrow_mut().clear_parent_link();
Expand All @@ -760,9 +736,8 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
let edge = match self.reborrow_mut().force() {
ForceResult::Leaf(_) => None,
ForceResult::Internal(mut internal) => {
let boxed_node =
slice_remove(internal.reborrow_mut().into_edge_area_slice(), 0);
let mut edge = Root::from_boxed_node(boxed_node, internal.height - 1);
let node = slice_remove(internal.reborrow_mut().into_edge_area_slice(), 0);
let mut edge = Root { node, height: internal.height - 1, _marker: PhantomData };
// In practice, clearing the parent is a waste of time, because we will
// insert the node elsewhere and set its parent link again.
edge.borrow_mut().clear_parent_link();
Expand Down Expand Up @@ -1041,12 +1016,11 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
debug_assert!(self.node.len() < CAPACITY);
debug_assert!(edge.height == self.node.height - 1);

let boxed_node = edge.into_boxed_node();
unsafe {
*self.node.reborrow_mut().into_len_mut() += 1;
slice_insert(self.node.reborrow_mut().into_key_area_slice(), self.idx, key);
slice_insert(self.node.reborrow_mut().into_val_area_slice(), self.idx, val);
slice_insert(self.node.reborrow_mut().into_edge_area_slice(), self.idx + 1, boxed_node);
slice_insert(self.node.reborrow_mut().into_edge_area_slice(), self.idx + 1, edge.node);

self.node.correct_childrens_parent_links((self.idx + 1)..=self.node.len());
}
Expand Down Expand Up @@ -1135,8 +1109,8 @@ impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Internal>, marke
// reference (Rust issue #73987) and invalidate any other references
// to or inside the array, should any be around.
let parent_ptr = NodeRef::as_internal_ptr(&self.node);
let boxed_node = unsafe { (*parent_ptr).edges.get_unchecked(self.idx).assume_init_read() };
NodeRef::from_boxed_node(boxed_node, self.node.height - 1)
let node = unsafe { (*parent_ptr).edges.get_unchecked(self.idx).assume_init_read() };
NodeRef { node, height: self.node.height - 1, _marker: PhantomData }
}
}

Expand Down
6 changes: 4 additions & 2 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ impl<T: fmt::Debug> fmt::Debug for Union<'_, T> {
const ITER_PERFORMANCE_TIPPING_SIZE_DIFF: usize = 16;

impl<T: Ord> BTreeSet<T> {
/// Makes a new `BTreeSet` with a reasonable choice of B.
/// Makes a new, empty `BTreeSet`.
///
/// Does not allocate anything on its own.
///
/// # Examples
///
Expand Down Expand Up @@ -1121,7 +1123,7 @@ impl<'a, T: 'a + Ord + Copy> Extend<&'a T> for BTreeSet<T> {

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Default for BTreeSet<T> {
/// Makes an empty `BTreeSet<T>` with a reasonable choice of B.
/// Creates an empty `BTreeSet`.
fn default() -> BTreeSet<T> {
BTreeSet::new()
}
Expand Down
Loading