Skip to content

Commit 0d50eab

Browse files
committed
Auto merge of #144286 - matthiaskrgr:rollup-1h1nn6b, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #142454 (Add modern AVR mcus like avr128db28 and attiny3224) - #142924 (tidy: move rustdoc js stuff into a tidy extra check) - #143373 (Unquerify maybe_unused_trait_imports.) - #143906 (Miri: non-deterministic floating point operations in `foreign_items`) - #144082 (tests: cover more `exported_private_dependencies` cases) - #144126 (Fix empty target_config in apply_rust_config bootstrap) - #144164 ( opt-dist: add an option for setting path to stage0 root) - #144265 (Dont ICE on copy error being suppressed due to overflow) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9748d87 + 0764554 commit 0d50eab

File tree

45 files changed

+4361
-524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4361
-524
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ __pycache__/
8585

8686
## Node
8787
node_modules
88-
package-lock.json
89-
package.json
9088
/src/doc/rustc-dev-guide/mermaid.min.js
9189

9290
## Rustdoc GUI tests

REUSE.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ path = [
3737
"rust-bors.toml",
3838
"triagebot.toml",
3939
"typos.toml",
40+
"package.json",
41+
"package-lock.json",
4042
"x",
4143
"x.ps1",
4244
"x.py",

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
303303
}
304304

305305
fn has_ambiguous_copy(&mut self, ty: Ty<'tcx>) -> bool {
306-
let Some(copy_trait_def) = self.infcx.tcx.lang_items().copy_trait() else { return false };
307-
// This is only going to be ambiguous if there are incoherent impls, because otherwise
308-
// ambiguity should never happen in MIR.
309-
self.infcx.type_implements_trait(copy_trait_def, [ty], self.infcx.param_env).may_apply()
306+
let Some(copy_def_id) = self.infcx.tcx.lang_items().copy_trait() else { return false };
307+
308+
// Avoid bogus move errors because of an incoherent `Copy` impl.
309+
self.infcx.type_implements_trait(copy_def_id, [ty], self.infcx.param_env).may_apply()
310+
&& self.infcx.tcx.coherent_trait(copy_def_id).is_err()
310311
}
311312

312313
fn report_cannot_move_from_static(&mut self, place: Place<'tcx>, span: Span) -> Diag<'infcx> {

compiler/rustc_hir_analysis/src/check_unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(super) fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) {
1818
used_trait_imports.extend_unord(imports.items().copied());
1919
}
2020

21-
for &id in tcx.maybe_unused_trait_imports(()) {
21+
for &id in tcx.resolutions(()).maybe_unused_trait_imports.iter() {
2222
debug_assert_eq!(tcx.def_kind(id), DefKind::Use);
2323
if tcx.visibility(id).is_public() {
2424
continue;

compiler/rustc_middle/src/query/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,9 +2285,6 @@ rustc_queries! {
22852285
query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
22862286
desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
22872287
}
2288-
query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet<LocalDefId> {
2289-
desc { "fetching potentially unused trait imports" }
2290-
}
22912288

22922289
/// All available crates in the graph, including those that should not be user-facing
22932290
/// (such as private crates).

compiler/rustc_middle/src/ty/context.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,8 +3428,6 @@ pub struct DeducedParamAttrs {
34283428
}
34293429

34303430
pub fn provide(providers: &mut Providers) {
3431-
providers.maybe_unused_trait_imports =
3432-
|tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports;
34333431
providers.extern_mod_stmt_cnum =
34343432
|tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned();
34353433
providers.is_panic_runtime =

compiler/rustc_target/src/spec/base/avr.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ pub fn ef_avr_arch(target_cpu: &str) -> u32 {
322322
"attiny1624" => elf::EF_AVR_ARCH_XMEGA3,
323323
"attiny1626" => elf::EF_AVR_ARCH_XMEGA3,
324324
"attiny1627" => elf::EF_AVR_ARCH_XMEGA3,
325+
"attiny3224" => elf::EF_AVR_ARCH_XMEGA3,
326+
"attiny3226" => elf::EF_AVR_ARCH_XMEGA3,
327+
"attiny3227" => elf::EF_AVR_ARCH_XMEGA3,
325328
"atmega808" => elf::EF_AVR_ARCH_XMEGA3,
326329
"atmega809" => elf::EF_AVR_ARCH_XMEGA3,
327330
"atmega1608" => elf::EF_AVR_ARCH_XMEGA3,
@@ -331,6 +334,70 @@ pub fn ef_avr_arch(target_cpu: &str) -> u32 {
331334
"atmega4808" => elf::EF_AVR_ARCH_XMEGA3,
332335
"atmega4809" => elf::EF_AVR_ARCH_XMEGA3,
333336

337+
"avr64da28" => elf::EF_AVR_ARCH_XMEGA2,
338+
"avr64da32" => elf::EF_AVR_ARCH_XMEGA2,
339+
"avr64da48" => elf::EF_AVR_ARCH_XMEGA2,
340+
"avr64da64" => elf::EF_AVR_ARCH_XMEGA2,
341+
"avr64db28" => elf::EF_AVR_ARCH_XMEGA2,
342+
"avr64db32" => elf::EF_AVR_ARCH_XMEGA2,
343+
"avr64db48" => elf::EF_AVR_ARCH_XMEGA2,
344+
"avr64db64" => elf::EF_AVR_ARCH_XMEGA2,
345+
"avr64dd14" => elf::EF_AVR_ARCH_XMEGA2,
346+
"avr64dd20" => elf::EF_AVR_ARCH_XMEGA2,
347+
"avr64dd28" => elf::EF_AVR_ARCH_XMEGA2,
348+
"avr64dd32" => elf::EF_AVR_ARCH_XMEGA2,
349+
"avr64du28" => elf::EF_AVR_ARCH_XMEGA2,
350+
"avr64du32" => elf::EF_AVR_ARCH_XMEGA2,
351+
"avr64ea28" => elf::EF_AVR_ARCH_XMEGA2,
352+
"avr64ea32" => elf::EF_AVR_ARCH_XMEGA2,
353+
"avr64ea48" => elf::EF_AVR_ARCH_XMEGA2,
354+
"avr64sd28" => elf::EF_AVR_ARCH_XMEGA2,
355+
"avr64sd32" => elf::EF_AVR_ARCH_XMEGA2,
356+
"avr64sd48" => elf::EF_AVR_ARCH_XMEGA2,
357+
358+
"avr16dd20" => elf::EF_AVR_ARCH_XMEGA3,
359+
"avr16dd28" => elf::EF_AVR_ARCH_XMEGA3,
360+
"avr16dd32" => elf::EF_AVR_ARCH_XMEGA3,
361+
"avr16du14" => elf::EF_AVR_ARCH_XMEGA3,
362+
"avr16du20" => elf::EF_AVR_ARCH_XMEGA3,
363+
"avr16du28" => elf::EF_AVR_ARCH_XMEGA3,
364+
"avr16du32" => elf::EF_AVR_ARCH_XMEGA3,
365+
"avr32da28" => elf::EF_AVR_ARCH_XMEGA3,
366+
"avr32da32" => elf::EF_AVR_ARCH_XMEGA3,
367+
"avr32da48" => elf::EF_AVR_ARCH_XMEGA3,
368+
"avr32db28" => elf::EF_AVR_ARCH_XMEGA3,
369+
"avr32db32" => elf::EF_AVR_ARCH_XMEGA3,
370+
"avr32db48" => elf::EF_AVR_ARCH_XMEGA3,
371+
"avr32dd14" => elf::EF_AVR_ARCH_XMEGA3,
372+
"avr32dd20" => elf::EF_AVR_ARCH_XMEGA3,
373+
"avr32dd28" => elf::EF_AVR_ARCH_XMEGA3,
374+
"avr32dd32" => elf::EF_AVR_ARCH_XMEGA3,
375+
"avr32du14" => elf::EF_AVR_ARCH_XMEGA3,
376+
"avr32du20" => elf::EF_AVR_ARCH_XMEGA3,
377+
"avr32du28" => elf::EF_AVR_ARCH_XMEGA3,
378+
"avr32du32" => elf::EF_AVR_ARCH_XMEGA3,
379+
"avr16eb14" => elf::EF_AVR_ARCH_XMEGA3,
380+
"avr16eb20" => elf::EF_AVR_ARCH_XMEGA3,
381+
"avr16eb28" => elf::EF_AVR_ARCH_XMEGA3,
382+
"avr16eb32" => elf::EF_AVR_ARCH_XMEGA3,
383+
"avr16ea28" => elf::EF_AVR_ARCH_XMEGA3,
384+
"avr16ea32" => elf::EF_AVR_ARCH_XMEGA3,
385+
"avr16ea48" => elf::EF_AVR_ARCH_XMEGA3,
386+
"avr32ea28" => elf::EF_AVR_ARCH_XMEGA3,
387+
"avr32ea32" => elf::EF_AVR_ARCH_XMEGA3,
388+
"avr32ea48" => elf::EF_AVR_ARCH_XMEGA3,
389+
"avr32sd20" => elf::EF_AVR_ARCH_XMEGA3,
390+
"avr32sd28" => elf::EF_AVR_ARCH_XMEGA3,
391+
"avr32sd32" => elf::EF_AVR_ARCH_XMEGA3,
392+
"avr128da28" => elf::EF_AVR_ARCH_XMEGA4,
393+
"avr128da32" => elf::EF_AVR_ARCH_XMEGA4,
394+
"avr128da48" => elf::EF_AVR_ARCH_XMEGA4,
395+
"avr128da64" => elf::EF_AVR_ARCH_XMEGA4,
396+
"avr128db28" => elf::EF_AVR_ARCH_XMEGA4,
397+
"avr128db32" => elf::EF_AVR_ARCH_XMEGA4,
398+
"avr128db48" => elf::EF_AVR_ARCH_XMEGA4,
399+
"avr128db64" => elf::EF_AVR_ARCH_XMEGA4,
400+
334401
// Unknown target CPU => Unspecified/generic code
335402
_ => 0,
336403
}

library/core/src/num/f32.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,8 +1936,8 @@ pub mod math {
19361936
/// let abs_difference_x = (f32::math::abs_sub(x, 1.0) - 2.0).abs();
19371937
/// let abs_difference_y = (f32::math::abs_sub(y, 1.0) - 0.0).abs();
19381938
///
1939-
/// assert!(abs_difference_x <= f32::EPSILON);
1940-
/// assert!(abs_difference_y <= f32::EPSILON);
1939+
/// assert!(abs_difference_x <= 1e-6);
1940+
/// assert!(abs_difference_y <= 1e-6);
19411941
/// ```
19421942
///
19431943
/// _This standalone function is for testing only.
@@ -1982,7 +1982,7 @@ pub mod math {
19821982
/// // x^(1/3) - 2 == 0
19831983
/// let abs_difference = (f32::math::cbrt(x) - 2.0).abs();
19841984
///
1985-
/// assert!(abs_difference <= f32::EPSILON);
1985+
/// assert!(abs_difference <= 1e-6);
19861986
/// ```
19871987
///
19881988
/// _This standalone function is for testing only.

library/std/src/num/f32.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ impl f32 {
582582
/// let abs_difference_x = (x.abs_sub(1.0) - 2.0).abs();
583583
/// let abs_difference_y = (y.abs_sub(1.0) - 0.0).abs();
584584
///
585-
/// assert!(abs_difference_x <= f32::EPSILON);
586-
/// assert!(abs_difference_y <= f32::EPSILON);
585+
/// assert!(abs_difference_x <= 1e-6);
586+
/// assert!(abs_difference_y <= 1e-6);
587587
/// ```
588588
#[rustc_allow_incoherent_impl]
589589
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -621,7 +621,7 @@ impl f32 {
621621
/// // x^(1/3) - 2 == 0
622622
/// let abs_difference = (x.cbrt() - 2.0).abs();
623623
///
624-
/// assert!(abs_difference <= f32::EPSILON);
624+
/// assert!(abs_difference <= 1e-6);
625625
/// ```
626626
#[rustc_allow_incoherent_impl]
627627
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -652,7 +652,7 @@ impl f32 {
652652
/// // sqrt(x^2 + y^2)
653653
/// let abs_difference = (x.hypot(y) - (x.powi(2) + y.powi(2)).sqrt()).abs();
654654
///
655-
/// assert!(abs_difference <= 1e-6);
655+
/// assert!(abs_difference <= 1e-5);
656656
/// ```
657657
#[rustc_allow_incoherent_impl]
658658
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -725,7 +725,7 @@ impl f32 {
725725
/// let x = std::f32::consts::FRAC_PI_4;
726726
/// let abs_difference = (x.tan() - 1.0).abs();
727727
///
728-
/// assert!(abs_difference <= f32::EPSILON);
728+
/// assert!(abs_difference <= 1e-6);
729729
/// ```
730730
#[rustc_allow_incoherent_impl]
731731
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -813,7 +813,7 @@ impl f32 {
813813
/// // atan(tan(1))
814814
/// let abs_difference = (f.tan().atan() - 1.0).abs();
815815
///
816-
/// assert!(abs_difference <= f32::EPSILON);
816+
/// assert!(abs_difference <= 1e-6);
817817
/// ```
818818
#[doc(alias = "arctan")]
819819
#[rustc_allow_incoherent_impl]
@@ -854,8 +854,8 @@ impl f32 {
854854
/// let abs_difference_1 = (y1.atan2(x1) - (-std::f32::consts::FRAC_PI_4)).abs();
855855
/// let abs_difference_2 = (y2.atan2(x2) - (3.0 * std::f32::consts::FRAC_PI_4)).abs();
856856
///
857-
/// assert!(abs_difference_1 <= f32::EPSILON);
858-
/// assert!(abs_difference_2 <= f32::EPSILON);
857+
/// assert!(abs_difference_1 <= 1e-5);
858+
/// assert!(abs_difference_2 <= 1e-5);
859859
/// ```
860860
#[rustc_allow_incoherent_impl]
861861
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -982,7 +982,7 @@ impl f32 {
982982
/// let g = ((e * e) - 1.0) / (2.0 * e);
983983
/// let abs_difference = (f - g).abs();
984984
///
985-
/// assert!(abs_difference <= f32::EPSILON);
985+
/// assert!(abs_difference <= 1e-6);
986986
/// ```
987987
#[rustc_allow_incoherent_impl]
988988
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -1012,7 +1012,7 @@ impl f32 {
10121012
/// let abs_difference = (f - g).abs();
10131013
///
10141014
/// // Same result
1015-
/// assert!(abs_difference <= f32::EPSILON);
1015+
/// assert!(abs_difference <= 1e-6);
10161016
/// ```
10171017
#[rustc_allow_incoherent_impl]
10181018
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -1042,7 +1042,7 @@ impl f32 {
10421042
/// let g = (1.0 - e.powi(-2)) / (1.0 + e.powi(-2));
10431043
/// let abs_difference = (f - g).abs();
10441044
///
1045-
/// assert!(abs_difference <= f32::EPSILON);
1045+
/// assert!(abs_difference <= 1e-6);
10461046
/// ```
10471047
#[rustc_allow_incoherent_impl]
10481048
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -1095,7 +1095,7 @@ impl f32 {
10951095
///
10961096
/// let abs_difference = (f - x).abs();
10971097
///
1098-
/// assert!(abs_difference <= 1e-6);
1098+
/// assert!(abs_difference <= 1e-5);
10991099
/// ```
11001100
#[doc(alias = "arccosh")]
11011101
#[rustc_allow_incoherent_impl]
@@ -1125,7 +1125,7 @@ impl f32 {
11251125
///
11261126
/// let abs_difference = (f - e).abs();
11271127
///
1128-
/// assert!(abs_difference <= 1e-5);
1128+
/// assert!(abs_difference <= 1e-4);
11291129
/// ```
11301130
#[doc(alias = "arctanh")]
11311131
#[rustc_allow_incoherent_impl]
@@ -1153,7 +1153,7 @@ impl f32 {
11531153
///
11541154
/// let abs_difference = (x.gamma() - 24.0).abs();
11551155
///
1156-
/// assert!(abs_difference <= f32::EPSILON);
1156+
/// assert!(abs_difference <= 1e-4);
11571157
/// ```
11581158
#[rustc_allow_incoherent_impl]
11591159
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -1248,7 +1248,7 @@ impl f32 {
12481248
/// let one = x.erf() + x.erfc();
12491249
/// let abs_difference = (one - 1.0).abs();
12501250
///
1251-
/// assert!(abs_difference <= f32::EPSILON);
1251+
/// assert!(abs_difference <= 1e-6);
12521252
/// ```
12531253
#[rustc_allow_incoherent_impl]
12541254
#[must_use = "method returns a new number and does not mutate the original value"]

library/std/src/num/f64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ impl f64 {
11531153
///
11541154
/// let abs_difference = (x.gamma() - 24.0).abs();
11551155
///
1156-
/// assert!(abs_difference <= f64::EPSILON);
1156+
/// assert!(abs_difference <= 1e-13);
11571157
/// ```
11581158
#[rustc_allow_incoherent_impl]
11591159
#[must_use = "method returns a new number and does not mutate the original value"]
@@ -1248,7 +1248,7 @@ impl f64 {
12481248
/// let one = x.erf() + x.erfc();
12491249
/// let abs_difference = (one - 1.0).abs();
12501250
///
1251-
/// assert!(abs_difference <= f64::EPSILON);
1251+
/// assert!(abs_difference <= 1e-13);
12521252
/// ```
12531253
#[rustc_allow_incoherent_impl]
12541254
#[must_use = "method returns a new number and does not mutate the original value"]

0 commit comments

Comments
 (0)