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 7 pull requests #92471

Merged
merged 60 commits into from
Jan 1, 2022
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
27a819e
Rebase fallout.
cjgillot Sep 30, 2021
583170a
Move rustc_middle::middle::cstore to rustc_session.
cjgillot Nov 14, 2020
7033f75
Create more accurate debuginfo for vtables.
michaelwoerister Oct 6, 2021
775b6da
Auto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=w…
bors Oct 11, 2021
6693595
Add missing cast and change some bitcasts to casts to avoid a gimple …
antoyo Oct 11, 2021
863cfb2
Fix FIXME in `Builder::and` and `Builder::or` impls (#101)
fisherdarling Oct 12, 2021
98f0580
Remove alloc::prelude
Amanieu Oct 14, 2021
ce9faca
Make hash_result an Option.
cjgillot Oct 16, 2021
1d064f1
Disable strict aliasing (#104)
antoyo Oct 25, 2021
14b83de
Add LLVM CFI support to the Rust compiler
rcvalle Oct 7, 2021
8094e2e
Properly check `target_features` not to trigger an assertion
JohnTitor Oct 20, 2021
d5a6aaf
Auto merge of #89652 - rcvalle:rust-cfi, r=nagisa
bors Oct 27, 2021
fc8e79f
Sync from rust (#107)
antoyo Oct 30, 2021
08183f9
Remove unused dependency on object (#102)
bjorn3 Oct 31, 2021
ebe6f67
Fix negation operation (#108)
antoyo Oct 31, 2021
a912fed
Remove workaround for the forward progress handling in LLVM
andjo403 Nov 14, 2021
0d61135
Feat: make cg_ssa get_param borrow the builder mutable
RDambrosio016 Nov 24, 2021
dcd4825
fix sparc64 ABI for aggregates with floating point members
psumbera Dec 1, 2021
48fc7d9
Auto merge of #91003 - psumbera:sparc64-abi, r=nagisa
bors Dec 2, 2021
b7cb08d
rustc_codegen_gcc: error on unwinding inline asm
cynecx Nov 12, 2021
4fa64fd
rustc_codegen_gcc: proper check for may_unwind
cynecx Nov 19, 2021
4e68093
Implement inline asm! for AVR platform
couchand Nov 25, 2021
98afc30
Use object crate for .rustc metadata generation
nikic Dec 2, 2021
0d936e1
Remove the reg_thumb register class for asm! on ARM
Amanieu Nov 11, 2021
2e7bc96
Auto merge of #91604 - nikic:section-flags, r=nagisa
bors Dec 8, 2021
b1d329b
Remove redundant [..]s
est31 Dec 3, 2021
10a9b12
Rollup merge of #90796 - Amanieu:remove_reg_thumb, r=joshtriplett
matthiaskrgr Dec 9, 2021
c6009ca
Rollup merge of #91625 - est31:remove_indexes, r=oli-obk
matthiaskrgr Dec 10, 2021
eec5f91
Stabilize asm! and global_asm!
Amanieu Dec 10, 2021
379fb40
Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`
tmiasko Dec 13, 2021
f87a8f8
Rollup merge of #91868 - tmiasko:llvm-time-trace-out, r=oli-obk
matthiaskrgr Dec 15, 2021
bba8b97
Remove unnecessary sigils around `Symbol::as_str()` calls.
nnethercote Dec 15, 2021
ddb015a
Fix discarded in-out constraint in inline asm (#110)
antoyo Dec 16, 2021
2989a25
Feature/global rvalue initialization petter tomner (#111)
antoyo Dec 16, 2021
c5d0023
Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
bors Dec 19, 2021
4f80816
Implement split_at_spare_mut directly
saethlin Dec 19, 2021
2f25a4a
Fix double space in pretty printed TryBlock
dtolnay Dec 29, 2021
bc1a1ff
Fix whitespace in pretty printed PatKind::Range
dtolnay Dec 29, 2021
ebc6ad4
Sync from rust 65d8785f0a85d233e00fc84445f1aab451ec9f4f
bjorn3 Dec 30, 2021
049b6ae
Rustup to rustc 1.59.0-nightly (78fd0f633 2021-12-29)
bjorn3 Dec 30, 2021
31482a9
Import std::arch::asm
bjorn3 Dec 30, 2021
a2c5d29
Add missing feature gate
bjorn3 Dec 30, 2021
d7fb7aa
Disable portable-simd test
bjorn3 Dec 30, 2021
0afd012
Disable long running libcore tests
bjorn3 Dec 30, 2021
92fbc8f
Ignore new failing test_is_sorted test
bjorn3 Dec 30, 2021
1411a98
Remove unnecessary report_symbol_names call (#113)
bjorn3 Dec 30, 2021
b799d6e
Merge commit '1411a98352ba6bee8ba3b0131c9243e5db1e6a2e' into sync_cg_…
bjorn3 Dec 31, 2021
1326bd6
Lock x.py build state
worldeva Aug 24, 2021
e7357e3
Remove unused extern crate rustc_symbol_mangling
bjorn3 Dec 31, 2021
a661671
[rustc_builtin_macros] add indices to format_foreign::printf::Substit…
dwrensha Dec 31, 2021
4a7f276
update tests
dwrensha Dec 31, 2021
777c853
Clarify safety comment
saethlin Dec 31, 2021
0d55bd1
Make tidy check for magic numbers that spell things
joshtriplett Jan 1, 2022
5a5c928
Rollup merge of #88310 - worldeva:bootstrap-locking, r=Mark-Simulacrum
matthiaskrgr Jan 1, 2022
a6e4d68
Rollup merge of #92097 - saethlin:split-without-deref, r=the8472
matthiaskrgr Jan 1, 2022
682b4cb
Rollup merge of #92412 - dtolnay:tryspace, r=Mark-Simulacrum
matthiaskrgr Jan 1, 2022
efe4158
Rollup merge of #92420 - dtolnay:patrange, r=Mark-Simulacrum
matthiaskrgr Jan 1, 2022
a76128b
Rollup merge of #92457 - bjorn3:sync_cg_gcc-2021-12-31, r=antoyo
matthiaskrgr Jan 1, 2022
913bc86
Rollup merge of #92460 - dwrensha:fix-92267, r=petrochenkov
matthiaskrgr Jan 1, 2022
4bd4e27
Rollup merge of #92469 - joshtriplett:test-number-fix, r=Mark-Simulacrum
matthiaskrgr Jan 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
Make tidy check for magic numbers that spell things
Remove existing problematic cases.
joshtriplett committed Jan 1, 2022
commit 0d55bd11009686dba662b0f4e697183691e7b308
8 changes: 4 additions & 4 deletions library/std/src/net/ip.rs
Original file line number Diff line number Diff line change
@@ -1140,8 +1140,8 @@ impl From<Ipv4Addr> for u32 {
/// ```
/// use std::net::Ipv4Addr;
///
/// let addr = Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe);
/// assert_eq!(0xcafebabe, u32::from(addr));
/// let addr = Ipv4Addr::new(0x12, 0x34, 0x56, 0x78);
/// assert_eq!(0x12345678, u32::from(addr));
/// ```
#[inline]
fn from(ip: Ipv4Addr) -> u32 {
@@ -1159,8 +1159,8 @@ impl From<u32> for Ipv4Addr {
/// ```
/// use std::net::Ipv4Addr;
///
/// let addr = Ipv4Addr::from(0xcafebabe);
/// assert_eq!(Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe), addr);
/// let addr = Ipv4Addr::from(0x12345678);
/// assert_eq!(Ipv4Addr::new(0x12, 0x34, 0x56, 0x78), addr);
/// ```
#[inline]
fn from(ip: u32) -> Ipv4Addr {
2 changes: 1 addition & 1 deletion src/test/ui/link-section.rs
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ static mut frobulator: usize = 0xdeadbeef;

pub fn main() {
unsafe {
frobulator = 0xcafebabe;
frobulator = 0x12345678;
println!("{} {} {}", i_live_in_more_text(), magic, frobulator);
}
}
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/unreadable_literal.fixed
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ fn main() {
1_234.123_f32,
1.123_4_f32,
);
let _bad = (0b11_0110_i64, 0xcafe_babe_usize, 123_456_f32, 1.234_567_f32);
let _bad = (0b11_0110_i64, 0x1234_5678_usize, 123_456_f32, 1.234_567_f32);
let _good_sci = 1.1234e1;
let _bad_sci = 1.123_456e1;

2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/unreadable_literal.rs
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ fn main() {
1_234.123_f32,
1.123_4_f32,
);
let _bad = (0b110110_i64, 0xcafebabe_usize, 123456_f32, 1.234567_f32);
let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
let _good_sci = 1.1234e1;
let _bad_sci = 1.123456e1;

10 changes: 5 additions & 5 deletions src/tools/clippy/tests/ui/unreadable_literal.stderr
Original file line number Diff line number Diff line change
@@ -9,27 +9,27 @@ LL | 0x1_234_567,
error: long literal lacking separators
--> $DIR/unreadable_literal.rs:33:17
|
LL | let _bad = (0b110110_i64, 0xcafebabe_usize, 123456_f32, 1.234567_f32);
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
| ^^^^^^^^^^^^ help: consider: `0b11_0110_i64`
|
= note: `-D clippy::unreadable-literal` implied by `-D warnings`

error: long literal lacking separators
--> $DIR/unreadable_literal.rs:33:31
|
LL | let _bad = (0b110110_i64, 0xcafebabe_usize, 123456_f32, 1.234567_f32);
| ^^^^^^^^^^^^^^^^ help: consider: `0xcafe_babe_usize`
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
| ^^^^^^^^^^^^^^^^ help: consider: `0x1234_5678_usize`

error: long literal lacking separators
--> $DIR/unreadable_literal.rs:33:49
|
LL | let _bad = (0b110110_i64, 0xcafebabe_usize, 123456_f32, 1.234567_f32);
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
| ^^^^^^^^^^ help: consider: `123_456_f32`

error: long literal lacking separators
--> $DIR/unreadable_literal.rs:33:61
|
LL | let _bad = (0b110110_i64, 0xcafebabe_usize, 123456_f32, 1.234567_f32);
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
| ^^^^^^^^^^^^ help: consider: `1.234_567_f32`

error: long literal lacking separators
15 changes: 15 additions & 0 deletions src/tools/tidy/src/style.rs
Original file line number Diff line number Diff line change
@@ -56,6 +56,12 @@ const ANNOTATIONS_TO_IGNORE: &[&str] = &[
"// normalize-stderr-test",
];

// Intentionally written in decimal rather than hex
const PROBLEMATIC_CONSTS: &[u32] = &[
184594741, 2880289470, 2881141438, 2965027518, 2976579765, 3203381950, 3405691582, 3405697037,
3735927486, 4027431614, 4276992702,
];

/// Parser states for `line_is_url`.
#[derive(Clone, Copy, PartialEq)]
#[allow(non_camel_case_types)]
@@ -217,6 +223,10 @@ pub fn check(path: &Path, bad: &mut bool) {
fn skip(path: &Path) -> bool {
super::filter_dirs(path) || skip_markdown_path(path)
}
let problematic_consts_strings: Vec<String> = (PROBLEMATIC_CONSTS.iter().map(u32::to_string))
.chain(PROBLEMATIC_CONSTS.iter().map(|v| format!("{:x}", v)))
.chain(PROBLEMATIC_CONSTS.iter().map(|v| format!("{:X}", v)))
.collect();
super::walk(path, &mut skip, &mut |entry, contents| {
let file = entry.path();
let filename = file.file_name().unwrap().to_string_lossy();
@@ -306,6 +316,11 @@ pub fn check(path: &Path, bad: &mut bool) {
if line.contains("//") && line.contains(" XXX") {
err("XXX is deprecated; use FIXME")
}
for s in problematic_consts_strings.iter() {
if line.contains(s) {
err("Don't use magic numbers that spell things (consider 0x12345678)");
}
}
}
let is_test = || file.components().any(|c| c.as_os_str() == "tests");
// for now we just check libcore