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 10 pull requests #132753

Closed
wants to merge 183 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
62026c3
Add units/unit prefixes of frequency to doc-valid-idents
ROMemories Sep 26, 2024
b95aa31
Stabilize `isqrt` feature
ChaiTRex Oct 8, 2024
6b1779b
Add lint to check for slow symbol comparisons
GnomedDev Oct 12, 2024
dedc380
Apply fixes from lint
GnomedDev Oct 13, 2024
a650692
Add test
GnomedDev Oct 13, 2024
979e297
Update book
GnomedDev Oct 13, 2024
11162d1
fix: remove unnecessary unfilter_map usages
wowinter13 Oct 14, 2024
40cb24f
fix: simplify suggestion
wowinter13 Oct 15, 2024
ad002ea
fix: linter
wowinter13 Oct 15, 2024
8555922
Don't trigger const_is_empty for inline const assertions
alex-semenyuk Oct 17, 2024
fea5e77
Merge commit 'a109190d7060236e655fc75533373fa274ec5343' into clippy-s…
flip1995 Oct 18, 2024
91a458f
Hotfix TRAIT_METHODS static->const
flip1995 Oct 18, 2024
2c3a34a
pulldown-cmark: don't pull getopts dep
klensy Oct 18, 2024
82969e5
Allow to go through clippy lints page without javascript
GuillaumeGomez Oct 11, 2024
da19d47
Fix lints syntax highlighting
GuillaumeGomez Oct 14, 2024
47effe4
Auto merge of #13562 - klensy:pc, r=flip1995
bors Oct 18, 2024
6a79588
Auto merge of #13539 - GuillaumeGomez:allow-no-js, r=Alexendoo
bors Oct 18, 2024
a739cc3
Stop linting manual_bits in any macro invoke
GnomedDev Oct 18, 2024
f2f0175
Auto merge of #13543 - GnomedDev:symbol-comparisons, r=y21
bors Oct 18, 2024
5678531
Auto merge of #13564 - GnomedDev:fix-manualbits-in-macro, r=blyxyas
bors Oct 19, 2024
6983631
Do not run lints that cannot emit
blyxyas Nov 13, 2023
8f8aa46
Follow review comments (optimize the filtering)
blyxyas Jun 18, 2024
e427a4e
Remove module passes filtering
blyxyas Sep 7, 2024
e518d66
Apply review comments + use `shallow_lint_levels_on`
blyxyas Oct 15, 2024
38cf3f3
add debug assertions for overlapping spans and empty replacements
y21 Oct 19, 2024
4de65a1
fix empty suggestion ICE in from_over_into
y21 Oct 19, 2024
69b0886
Fix tests
compiler-errors Sep 27, 2024
64c4cf1
Fix version for `ref_option`
alex-semenyuk Oct 20, 2024
2a5de35
docs: remove stray comma
Kijewski Oct 20, 2024
aab0eee
make unsupported_calling_conventions a hard error
RalfJung Sep 3, 2024
d8b2f93
Rip out old effects var handling code from traits
compiler-errors Oct 20, 2024
65eb1ec
remove the semicolon for builtin macro call statements in `statement_…
y21 Oct 20, 2024
2666ed6
Fix indentation of website code snippets
Alexendoo Oct 20, 2024
2f71ce6
don't lint unnamed constants in `missing_docs_in_private_items`
y21 Oct 20, 2024
b3bf128
don't lint nested items that don't have generated documentation in `m…
y21 Oct 20, 2024
d00ab2e
Auto merge of #13569 - alex-semenyuk:fix_version, r=blyxyas
bors Oct 20, 2024
1d0dad5
Auto merge of #131988 - matthiaskrgr:rollup-tx173wn, r=matthiaskrgr
bors Oct 21, 2024
8538562
Auto merge of #13567 - y21:span_debug_assertions, r=flip1995
bors Oct 21, 2024
5873cb9
Auto merge of #13570 - Kijewski:pr-stray-comma, r=xFrednet
bors Oct 21, 2024
3773534
Move COGNITIVE_COMPLEXITY to use macro again
blyxyas Oct 19, 2024
f03f7c6
Auto merge of #129935 - RalfJung:unsupported_calling_conventions, r=c…
bors Oct 22, 2024
2fd8222
terminology: #[feature] *enables* a feature (instead of "declaring" o…
RalfJung Oct 8, 2024
78fc7bb
Auto merge of #131321 - RalfJung:feature-activation, r=nnethercote
bors Oct 22, 2024
088f07a
Represent TraitBoundModifiers as distinct parts in HIR
compiler-errors Oct 20, 2024
0bcc6f8
docs: Fix too_long_first_doc_paragraph: line -> paragraph
evanj Oct 22, 2024
97d13a8
Fix not working lint anchor
GuillaumeGomez Oct 22, 2024
b33977b
Fix invalid lint ID filtering
GuillaumeGomez Oct 22, 2024
54f9bc4
nightly feature tracking: get rid of the per-feature bool fields
RalfJung Oct 9, 2024
7115404
Open lint when clicking on its anchor
GuillaumeGomez Oct 23, 2024
cefa31a
Auto merge of #13588 - GuillaumeGomez:fix-lint-anchor, r=flip1995
bors Oct 23, 2024
cc0ec04
Fix #131977 parens mangled in shared mut static lint suggestion
Oct 24, 2024
b0412d0
borrow_deref_ref: do not trigger on `&raw` references
samueltardieu Oct 20, 2024
c2534dc
Auto merge of #13460 - ROMemories:feat/freq-units-allowed-idents, r=C…
bors Oct 24, 2024
eb6026a
Remove associated type based effects logic
compiler-errors Oct 20, 2024
6bcd0b9
Auto merge of #13558 - alex-semenyuk:const_is_empty_fix, r=dswij
bors Oct 24, 2024
5d681cf
Pass Ident by reference in ast Visitor
maxcabrajac Oct 24, 2024
9cf416d
Auto merge of #13586 - evanj:evan.jones/long-paragraph-edit, r=xFrednet
bors Oct 24, 2024
3338611
Switch CI from bors to merge queue
Kobzol Oct 25, 2024
59ecf4d
Fix is_from_proc_macro attr
RuairidhWilliamson Oct 25, 2024
a1ff955
Rollup merge of #132106 - maxcabrajac:ident_ref, r=petrochenkov
matthiaskrgr Oct 25, 2024
cd21594
tcx.is_const_fn doesn't work the way it is described, remove it
RalfJung Oct 12, 2024
8b9376a
Auto merge of #131349 - RalfJung:const-stability-checks, r=compiler-e…
bors Oct 25, 2024
560353c
Stop linting unused_io_amount in io traits
GnomedDev Oct 25, 2024
350d1c4
Effects cleanup
fee1-dead Oct 26, 2024
b75d511
Rollup merge of #132168 - fee1-dead-contrib:fxclean, r=compiler-errors
matthiaskrgr Oct 26, 2024
9e36f89
Auto merge of #125116 - blyxyas:ignore-allowed-lints-final, r=cjgillot
bors Oct 26, 2024
c4815ae
[`infinite_loops`]: fix suggestion error on async functions/closures
J-ZhengLi Oct 26, 2024
3caff99
Auto merge of #13571 - Alexendoo:website-code-indent, r=Centri3
bors Oct 26, 2024
a0fab5c
Auto merge of #13605 - GnomedDev:read-exact-in-read-exact, r=llogiq
bors Oct 27, 2024
900db48
Add test case for missing_errors_doc at tests with option check-priva…
alex-semenyuk Oct 27, 2024
c02f3a2
Auto merge of #13600 - samueltardieu:push-tzuvnutssmrs, r=xFrednet
bors Oct 27, 2024
31f6679
Auto merge of #13610 - alex-semenyuk:add_test_case, r=xFrednet
bors Oct 27, 2024
d0b15f1
Swap Msrv from Vec to SmallVec
GnomedDev Oct 27, 2024
f562d47
Unvacation giraffate and remove gh-pages -> xFrednet assignment
xFrednet Oct 27, 2024
12ca363
Auto merge of #13611 - xFrednet:0-giraffate-alumni, r=xFrednet
bors Oct 27, 2024
73bad36
Auto merge of #13548 - wowinter13:unnecessary_filter_map_filter_map_s…
bors Oct 27, 2024
62c4daf
New lint `needless_as_bytes`
samueltardieu Sep 21, 2024
f152bcb
Update the number of lints (over 700 → over 750)
samueltardieu Oct 28, 2024
d30a026
check if we need a parenthesis
CoCo-Japan-pan Oct 24, 2024
303ab51
Rollup merge of #131391 - ChaiTRex:isqrt, r=scottmcm,tgross35
matthiaskrgr Oct 28, 2024
f286174
New lint: `dangling_pointers_from_temporaries`
GrigorenkoPV Oct 16, 2024
a529c44
Auto merge of #13472 - GnomedDev:smaller-msrv, r=Jarcho
bors Oct 28, 2024
2e4a11e
Auto merge of #13338 - CoCo-Japan-pan:nonminimal_bool_casted, r=Centri3
bors Oct 28, 2024
d63322f
fix: usage of `a deprecated Node.js version`
hamirmahal Oct 28, 2024
d09d85d
Auto merge of #13614 - hamirmahal:fix/usage-of-a-deprecated-nodejs-ve…
bors Oct 28, 2024
c5df79d
Fire large_const_arrays for computed array lengths
GnomedDev Oct 28, 2024
528dcc3
Auto merge of #13620 - GnomedDev:large-const-array-compute-const, r=M…
bors Oct 28, 2024
149665a
Auto merge of #128985 - GrigorenkoPV:instantly-dangling-pointer, r=Urgau
bors Oct 29, 2024
353868a
Remove region from adjustments
compiler-errors Oct 29, 2024
625d391
Auto merge of #13437 - samueltardieu:issue-13434, r=y21
bors Oct 29, 2024
f2f73f9
Replace `.map(…).any(identity)` by `.any(…)`
samueltardieu Oct 4, 2024
91a1d16
Add new lint: `map_all_any_identity`
samueltardieu Oct 4, 2024
35a7095
Auto merge of #13499 - samueltardieu:map-all-any-identity, r=xFrednet
bors Oct 29, 2024
8d190cc
update tools
lcnr Oct 24, 2024
acc3842
Add new `map_with_unused_argument_over_ranges` lint
rspencer01 Jul 3, 2024
15ad824
Auto merge of #13034 - rspencer01:trivial_map_over_range, r=y21
bors Oct 29, 2024
ae82c75
Remove `Analysis::into_engine`.
nnethercote Oct 29, 2024
297f28c
Rollup merge of #132338 - nnethercote:rm-Engine, r=nnethercote
matthiaskrgr Oct 30, 2024
a304709
Do not use `gen` as a variable name
samueltardieu Oct 29, 2024
f7ab2c9
new lint: `source_item_ordering`
decryphe Aug 29, 2024
0c1ef98
Use match ergonomics compatible with editions 2021 and 2024
samueltardieu Oct 29, 2024
540e116
Return iterator must not capture lifetimes in Rust 2024
samueltardieu Oct 29, 2024
8052451
no_mangle attribute requires unsafe in Rust 2024
samueltardieu Oct 30, 2024
bd4aa17
Add 'CoAP' to doc-valid-idents
chrysn Oct 30, 2024
1bdc08a
Auto merge of #13599 - RuairidhWilliamson:proc_macro_attr, r=blyxyas
bors Oct 30, 2024
d9a0fec
Remap impl-trait lifetimes on HIR instead of AST lowering.
cjgillot Aug 20, 2024
323f144
Cleanup code suggestion for `into_iter_without_iter`
nyurik Oct 30, 2024
a7aa8bf
Watch `tests/compile-test.rs` in `cargo dev serve`
Alexendoo Oct 30, 2024
0c29fcc
Extend `large_include_file` lint to also work on attributes
GuillaumeGomez Oct 30, 2024
1998abc
Auto merge of #13633 - chrysn-pull-requests:doc-valid-ident-coap, r=C…
bors Oct 30, 2024
e1fa1b2
Auto merge of #13636 - GuillaumeGomez:extend-large_include_file, r=dswij
bors Oct 31, 2024
65b986b
compiletest: add `{ignore,needs}-{rustc,std}-debug-assertions` direct…
jieyouxu Oct 19, 2024
3870022
bootstrap: pass `--with-{rustc,std}-debug-assertions` to compiletest
jieyouxu Oct 21, 2024
0d5cc8e
tests: `ignore-debug` -> `ignore-std-debug-assertions`
jieyouxu Oct 19, 2024
9f89421
Auto merge of #132301 - compiler-errors:adjust, r=lcnr
bors Oct 31, 2024
d30a0b2
`ConstCx` stop using `ParamEnv::reveal`
lcnr Oct 31, 2024
bad3edd
clippy: we've got a `LateContext` use it for `TypingMode`
lcnr Oct 31, 2024
2298a67
Auto merge of #13628 - samueltardieu:push-puluprmsyuzq, r=xFrednet
bors Oct 31, 2024
d7850ec
stop using `ParamEnv::reveal` while handling MIR
lcnr Oct 31, 2024
8568ca8
Auto merge of #13634 - nyurik:fix-iter-without-into, r=xFrednet,samue…
bors Oct 31, 2024
c2db7fa
Rollup merge of #132403 - lcnr:typing-mode, r=compiler-errors
workingjubilee Nov 1, 2024
012e306
Explain why clippy's HIR const eval exists
GnomedDev Oct 27, 2024
c782988
Auto merge of #13615 - GnomedDev:document-constevalctx-point, r=Alexe…
bors Nov 1, 2024
c056928
Improve display of clippy lints page when JS is disabled
GuillaumeGomez Oct 22, 2024
ca5c6f6
Improve theme handling when JS is disabled
GuillaumeGomez Oct 22, 2024
ac764df
Handle noscript style with "js" class on `<html>`.
GuillaumeGomez Nov 1, 2024
e4dc892
Auto merge of #13608 - J-ZhengLi:issue12338-new, r=Alexendoo
bors Nov 1, 2024
9d03956
Auto merge of #13635 - Alexendoo:cargo-dev-serve-watch-test, r=blyxyas
bors Nov 1, 2024
e8b78e2
Auto merge of #13630 - samueltardieu:push-qrnxuykslnsl, r=y21
bors Nov 1, 2024
5c6fe68
Auto merge of #13376 - decryphe:source-ordering, r=llogiq
bors Nov 2, 2024
52b8324
Auto merge of #13585 - GuillaumeGomez:no-js, r=Alexendoo
bors Nov 2, 2024
ddd1a86
Auto merge of #13573 - y21:issue13427, r=Centri3
bors Nov 3, 2024
2f1b7b6
needless_continue: check labels consistency before warning
samueltardieu Nov 3, 2024
040129b
Auto merge of #13629 - samueltardieu:push-nwukowumrvsn, r=flip1995
bors Nov 3, 2024
f0cf996
Rename the FIXMEs, remove a few that dont matter anymore
compiler-errors Nov 1, 2024
a1a9aae
Auto merge of #13631 - samueltardieu:push-uoowutzkvsrk, r=Centri3
bors Nov 3, 2024
ccf7c88
Auto merge of #13648 - samueltardieu:push-rpxvoukpolvm, r=Centri3
bors Nov 3, 2024
b14362f
ty::KContainer -> ty::AssocItemContainer::K
compiler-errors Nov 3, 2024
efeed55
Remove BorrowKind glob, make names longer
compiler-errors Nov 3, 2024
63d0ba9
Move two attribute lints to be early pass (post expansion)
jdonszelmann Nov 4, 2024
44c2a82
Swap Visitors to early exit, instead of storing poison flag
GnomedDev Nov 4, 2024
d8a3fcc
Auto merge of #132580 - compiler-errors:globs, r=Noratrieb
bors Nov 5, 2024
626406f
Do not filter empty passes & Make CTFE Clippy into lintless pass
blyxyas Nov 5, 2024
6631a2c
Auto merge of #13654 - GnomedDev:early-exit-visitors, r=Alexendoo
bors Nov 5, 2024
4847c40
Rollup merge of #132637 - blyxyas:lint-less-passes, r=flip1995
matthiaskrgr Nov 5, 2024
c931096
collect attribute spans early for disallowed macros
jdonszelmann Nov 5, 2024
c1ab18d
no_mangle_with_rust_abi: properly position the suggested ABI
samueltardieu Nov 5, 2024
f02a020
Auto merge of #13659 - samueltardieu:push-twtxmtvopoxo, r=blyxyas
bors Nov 6, 2024
7bcd578
Link fix
alex-semenyuk Nov 6, 2024
ab560d8
Auto merge of #13661 - alex-semenyuk:doc_fix, r=Manishearth
bors Nov 6, 2024
0720880
Separate f128 `%` operation to deal with missing `fmodl` symbol
raoulstrackx Nov 6, 2024
9f5e17f
Fix file formatting
GuillaumeGomez Nov 7, 2024
b816d4e
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Nov 7, 2024
03daf7c
Fix author lint and move it back to tests/ui
flip1995 Nov 7, 2024
4f12b98
Clean up declare_clippy_lint
flip1995 Nov 3, 2024
c64f1e3
Fix lint_without_lint_pass internal lint
flip1995 Nov 3, 2024
b27570b
Fix cargo dev update_lints
flip1995 Nov 3, 2024
a5d6100
Bump nightly version -> 2024-11-07
flip1995 Nov 7, 2024
d583df0
Remove ui/no_lints.rs test
flip1995 Nov 7, 2024
ab1787b
core: move intrinsics.rs into intrinsics folder
RalfJung Nov 5, 2024
1ee5ab3
bootstrap: Print better message if lock pid isn't available
clubby789 Nov 7, 2024
9ebe68d
Add conclusion job to PR CI
Kobzol Nov 7, 2024
843ef1b
Remove path filter
Kobzol Nov 7, 2024
a28c44f
Merge pull request #13587 from Kobzol/ci-remove-bors
flip1995 Nov 7, 2024
b116696
Remove CI badge from README and book
flip1995 Nov 7, 2024
3518178
Merge pull request #13639 from flip1995/rustup
flip1995 Nov 7, 2024
0e58f1c
Update test for LLVM 20's new vector splat syntax
zmodem Nov 7, 2024
392ac35
Update mips64 data layout to match LLVM 20 change
zmodem Nov 7, 2024
f712eb5
Merge pull request #13657 from jdonszelmann/disallowed-macros-to-early
flip1995 Nov 7, 2024
eb7d95b
remove the extra specification for llvm versions < 20
zmodem Nov 7, 2024
0ce579f
[StableMIR] API to retrieve definitions from crates
celinval Oct 25, 2024
40aec58
Merge commit 'f712eb5cdccd121d0569af12f20e6a0fabe4364d' into clippy-s…
flip1995 Nov 7, 2024
2ab848b
Update Cargo.lock
flip1995 Nov 7, 2024
ddf3a99
Rollup merge of #131913 - jieyouxu:only_debug_assertions, r=onur-ozkan
workingjubilee Nov 8, 2024
9d3d81d
Rollup merge of #132095 - gechelberger:fix-131977, r=wesleywiser
workingjubilee Nov 8, 2024
fad107e
Rollup merge of #132131 - celinval:smir-crate-defs, r=compiler-errors
workingjubilee Nov 8, 2024
031b694
Rollup merge of #132639 - RalfJung:intrinsics, r=workingjubilee,Amanieu
workingjubilee Nov 8, 2024
4130f44
Rollup merge of #132696 - fortanix:raoul/rte-235-fix_fmodl_missing_sy…
workingjubilee Nov 8, 2024
3ee523c
Rollup merge of #132737 - clubby789:lock-no-pid, r=jieyouxu
workingjubilee Nov 8, 2024
83a5dde
Rollup merge of #132739 - GuillaumeGomez:cleanup-scrape-code, r=notri…
workingjubilee Nov 8, 2024
fd1932a
Rollup merge of #132740 - zmodem:simd_syntax_update, r=durin42
workingjubilee Nov 8, 2024
a7bae73
Rollup merge of #132741 - zmodem:mips_data_layout, r=nikic
workingjubilee Nov 8, 2024
9090647
Rollup merge of #132746 - flip1995:clippy-subtree-update, r=Manishearth
workingjubilee Nov 8, 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
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2861,7 +2861,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "679341d22c78c6c649893cbd6c3278dcbe9fc4faa62fea3a9296ae2b50c14625"
dependencies = [
"bitflags 2.6.0",
"getopts",
"memchr",
"pulldown-cmark-escape 0.11.0",
"unicase",
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ pub(crate) unsafe fn create_module<'ll>(
// See https://github.com/llvm/llvm-project/pull/106951
target_data_layout = target_data_layout.replace("-i128:128", "");
}
if sess.target.arch.starts_with("mips64") {
// LLVM 20 updates the mips64 layout to correctly align 128 bit integers to 128 bit.
// See https://github.com/llvm/llvm-project/pull/112084
target_data_layout = target_data_layout.replace("-i128:128", "");
}
}

// Ensure the data-layout values hardcoded remain the defaults.
Expand Down
27 changes: 19 additions & 8 deletions compiler/rustc_lint/src/static_mut_refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use rustc_hir::{Expr, Stmt};
use rustc_middle::ty::{Mutability, TyKind};
use rustc_session::lint::FutureIncompatibilityReason;
use rustc_session::{declare_lint, declare_lint_pass};
use rustc_span::Span;
use rustc_span::edition::Edition;
use rustc_span::{BytePos, Span};

use crate::lints::{MutRefSugg, RefOfMutStatic};
use crate::{LateContext, LateLintPass, LintContext};
Expand Down Expand Up @@ -71,13 +71,24 @@ impl<'tcx> LateLintPass<'tcx> for StaticMutRefs {
if matches!(borrow_kind, hir::BorrowKind::Ref)
&& let Some(err_span) = path_is_static_mut(ex, err_span) =>
{
emit_static_mut_refs(
cx,
err_span,
err_span.with_hi(ex.span.lo()),
m,
!expr.span.from_expansion(),
);
let source_map = cx.sess().source_map();
let snippet = source_map.span_to_snippet(err_span);

let sugg_span = if let Ok(snippet) = snippet {
// ( ( &IDENT ) )
// ~~~~ exclude these from the suggestion span to avoid unmatching parens
let exclude_n_bytes: u32 = snippet
.chars()
.take_while(|ch| ch.is_whitespace() || *ch == '(')
.map(|ch| ch.len_utf8() as u32)
.sum();

err_span.with_lo(err_span.lo() + BytePos(exclude_n_bytes)).with_hi(ex.span.lo())
} else {
err_span.with_hi(ex.span.lo())
};

emit_static_mut_refs(cx, err_span, sugg_span, m, !expr.span.from_expansion());
}
hir::ExprKind::MethodCall(_, e, _, _)
if let Some(err_span) = path_is_static_mut(e, expr.span)
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ provide! { tcx, def_id, other, cdata,
crate_hash => { cdata.root.header.hash }
crate_host_hash => { cdata.host_hash }
crate_name => { cdata.root.header.name }
num_extern_def_ids => { cdata.num_def_ids() }

extra_filename => { cdata.root.extra_filename.clone() }

Expand Down
10 changes: 10 additions & 0 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,16 @@ rustc_queries! {
desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id) }
}

/// Gets the number of definitions in a foreign crate.
///
/// This allows external tools to iterate over all definitions in a foreign crate.
///
/// This should never be used for the local crate, instead use `iter_local_def_id`.
query num_extern_def_ids(_: CrateNum) -> usize {
desc { "fetching the number of definitions in a crate" }
separate_provide_extern
}

query lib_features(_: CrateNum) -> &'tcx LibFeatures {
desc { "calculating the lib features defined in a crate" }
separate_provide_extern
Expand Down
16 changes: 15 additions & 1 deletion compiler/rustc_smir/src/rustc_smir/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use stable_mir::{Crate, CrateDef, CrateItem, CrateNum, DefId, Error, Filename, I

use crate::rustc_internal::RustcInternal;
use crate::rustc_smir::builder::BodyBuilder;
use crate::rustc_smir::{Stable, Tables, alloc, new_item_kind, smir_crate};
use crate::rustc_smir::{Stable, Tables, alloc, filter_def_ids, new_item_kind, smir_crate};

impl<'tcx> Context for TablesWrapper<'tcx> {
fn target_info(&self) -> MachineInfo {
Expand Down Expand Up @@ -80,6 +80,20 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
.collect()
}

fn crate_functions(&self, crate_num: CrateNum) -> Vec<FnDef> {
let mut tables = self.0.borrow_mut();
let tcx = tables.tcx;
let krate = crate_num.internal(&mut *tables, tcx);
filter_def_ids(tcx, krate, |def_id| tables.to_fn_def(def_id))
}

fn crate_statics(&self, crate_num: CrateNum) -> Vec<StaticDef> {
let mut tables = self.0.borrow_mut();
let tcx = tables.tcx;
let krate = crate_num.internal(&mut *tables, tcx);
filter_def_ids(tcx, krate, |def_id| tables.to_static(def_id))
}

fn foreign_module(
&self,
mod_def: stable_mir::ty::ForeignModuleDef,
Expand Down
34 changes: 32 additions & 2 deletions compiler/rustc_smir/src/rustc_smir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use rustc_middle::mir::interpret::AllocId;
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
use rustc_span::def_id::{CrateNum, DefId, LOCAL_CRATE};
use stable_mir::abi::Layout;
use stable_mir::mir::mono::InstanceDef;
use stable_mir::ty::{MirConstId, Span, TyConstId};
use stable_mir::mir::mono::{InstanceDef, StaticDef};
use stable_mir::ty::{FnDef, MirConstId, Span, TyConstId};
use stable_mir::{CtorKind, ItemKind};
use tracing::debug;

Expand Down Expand Up @@ -79,6 +79,36 @@ impl<'tcx> Tables<'tcx> {
};
!must_override && self.tcx.is_mir_available(def_id)
}

fn to_fn_def(&mut self, def_id: DefId) -> Option<FnDef> {
if matches!(self.tcx.def_kind(def_id), DefKind::Fn | DefKind::AssocFn) {
Some(self.fn_def(def_id))
} else {
None
}
}

fn to_static(&mut self, def_id: DefId) -> Option<StaticDef> {
matches!(self.tcx.def_kind(def_id), DefKind::Static { .. }).then(|| self.static_def(def_id))
}
}

/// Iterate over the definitions of the given crate.
pub(crate) fn filter_def_ids<F, T>(tcx: TyCtxt<'_>, krate: CrateNum, mut func: F) -> Vec<T>
where
F: FnMut(DefId) -> Option<T>,
{
if krate == LOCAL_CRATE {
tcx.iter_local_def_id().filter_map(|did| func(did.to_def_id())).collect()
} else {
let num_definitions = tcx.num_extern_def_ids(krate);
(0..num_definitions)
.filter_map(move |i| {
let def_id = DefId { krate, index: rustc_span::def_id::DefIndex::from_usize(i) };
func(def_id)
})
.collect()
}
}

/// Build a stable mir crate from a given crate number.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
std: None, // ?
},
pointer_width: 64,
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".into(),
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "mips64".into(),
options: TargetOptions {
abi: "abi64".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target {
std: Some(true),
},
pointer_width: 64,
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".into(),
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "mips64".into(),
options: TargetOptions {
abi: "abi64".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
std: Some(true),
},
pointer_width: 64,
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".into(),
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "mips64".into(),
options: TargetOptions {
abi: "abi64".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target {
std: Some(true),
},
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".into(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "mips64".into(),
options: TargetOptions {
abi: "abi64".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
std: Some(true),
},
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".into(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "mips64".into(),
options: TargetOptions { abi: "abi64".into(), mcount: "_mcount".into(), ..base },
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target {
std: None, // ?
},
pointer_width: 64,
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".into(),
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "mips64r6".into(),
options: TargetOptions {
abi: "abi64".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target {
std: Some(true),
},
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".into(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "mips64r6".into(),
options: TargetOptions {
abi: "abi64".into(),
Expand Down
6 changes: 6 additions & 0 deletions compiler/stable_mir/src/compiler_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ pub trait Context {
/// Check whether the body of a function is available.
fn has_body(&self, item: DefId) -> bool;
fn foreign_modules(&self, crate_num: CrateNum) -> Vec<ForeignModuleDef>;

/// Retrieve all functions defined in this crate.
fn crate_functions(&self, crate_num: CrateNum) -> Vec<FnDef>;

/// Retrieve all static items defined in this crate.
fn crate_statics(&self, crate_num: CrateNum) -> Vec<StaticDef>;
fn foreign_module(&self, mod_def: ForeignModuleDef) -> ForeignModule;
fn foreign_items(&self, mod_def: ForeignModuleDef) -> Vec<ForeignDef>;
fn all_trait_decls(&self) -> TraitDecls;
Expand Down
13 changes: 12 additions & 1 deletion compiler/stable_mir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ use serde::Serialize;
use crate::compiler_interface::with;
pub use crate::crate_def::{CrateDef, CrateDefType, DefId};
pub use crate::error::*;
use crate::mir::mono::StaticDef;
use crate::mir::{Body, Mutability};
use crate::ty::{ForeignModuleDef, ImplDef, IndexedVal, Span, TraitDef, Ty};
use crate::ty::{FnDef, ForeignModuleDef, ImplDef, IndexedVal, Span, TraitDef, Ty};

pub mod abi;
#[macro_use]
Expand Down Expand Up @@ -96,6 +97,16 @@ impl Crate {
pub fn trait_impls(&self) -> ImplTraitDecls {
with(|cx| cx.trait_impls(self.id))
}

/// Return a list of function definitions from this crate independent on their visibility.
pub fn fn_defs(&self) -> Vec<FnDef> {
with(|cx| cx.crate_functions(self.id))
}

/// Return a list of static items defined in this crate independent on their visibility.
pub fn statics(&self) -> Vec<StaticDef> {
with(|cx| cx.crate_statics(self.id))
}
}

#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, Serialize)]
Expand Down
File renamed without changes.
22 changes: 20 additions & 2 deletions library/std/src/f128/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
#![cfg(reliable_f128)]

use crate::f128::consts;
use crate::num::{FpCategory as Fp, *};
use crate::num::FpCategory as Fp;
#[cfg(reliable_f128_math)]
use crate::ops::Rem;
use crate::ops::{Add, Div, Mul, Sub};

// Note these tolerances make sense around zero, but not for more extreme exponents.

Expand Down Expand Up @@ -53,7 +56,22 @@ macro_rules! assert_f128_biteq {

#[test]
fn test_num_f128() {
test_num(10f128, 2f128);
// FIXME(f16_f128): replace with a `test_num` call once the required `fmodl`/`fmodf128`
// function is available on all platforms.
let ten = 10f128;
let two = 2f128;
assert_eq!(ten.add(two), ten + two);
assert_eq!(ten.sub(two), ten - two);
assert_eq!(ten.mul(two), ten * two);
assert_eq!(ten.div(two), ten / two);
}

#[test]
#[cfg(reliable_f128_math)]
fn test_num_f128_rem() {
let ten = 10f128;
let two = 2f128;
assert_eq!(ten.rem(two), ten % two);
}

#[test]
Expand Down
8 changes: 6 additions & 2 deletions src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn main() {
// Display PID of process holding the lock
// PID will be stored in a lock file
let lock_path = config.out.join("lock");
let pid = fs::read_to_string(&lock_path).unwrap_or_default();
let pid = fs::read_to_string(&lock_path);

build_lock = fd_lock::RwLock::new(t!(fs::OpenOptions::new()
.write(true)
Expand All @@ -47,7 +47,11 @@ fn main() {
}
err => {
drop(err);
println!("WARNING: build directory locked by process {pid}, waiting for lock");
if let Ok(pid) = pid {
println!("WARNING: build directory locked by process {pid}, waiting for lock");
} else {
println!("WARNING: build directory locked, waiting for lock");
}
let mut lock = t!(build_lock.write());
t!(lock.write(process::id().to_string().as_ref()));
lock
Expand Down
10 changes: 7 additions & 3 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1938,9 +1938,13 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the

cmd.arg("--json");

if builder.config.rust_debug_assertions_std {
cmd.arg("--with-debug-assertions");
};
if builder.config.rustc_debug_assertions {
cmd.arg("--with-rustc-debug-assertions");
}

if builder.config.std_debug_assertions {
cmd.arg("--with-std-debug-assertions");
}

let mut llvm_components_passed = false;
let mut copts_passed = false;
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/builder/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,9 +833,9 @@ impl Builder<'_> {
cargo.env(
profile_var("DEBUG_ASSERTIONS"),
if mode == Mode::Std {
self.config.rust_debug_assertions_std.to_string()
self.config.std_debug_assertions.to_string()
} else {
self.config.rust_debug_assertions.to_string()
self.config.rustc_debug_assertions.to_string()
},
);
cargo.env(
Expand Down
Loading
Loading