forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Testing out updating fork to rust base #1
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…igation Given code like `v[&field].boo();` where `field: String` and `.boo(&mut self)`, typeck will have decided that `v` is accessed using `Index`, but when `boo` adds a new `mut` obligation, `convert_place_op_to_mutable` is called. When this happens, for *some reason* the arguments' dereference adjustments are completely ignored causing an error saying that `IndexMut` is not satisfied: ``` error[E0596]: cannot borrow data in an index of `Indexable` as mutable --> src/main.rs:30:5 | 30 | v[&field].boo(); | ^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Indexable` ``` This is not true, but by changing `try_overloaded_place_op` to retry when given `Needs::MutPlace` without passing the argument types, the example successfully compiles. I believe there might be more appropriate ways to deal with this.
This stabilizes process_set_argv0 targeting 1.45.0. It has been useful in practice and seems useful as-is. The equivalent feature could be implemented for Windows, but as far as I know nobody has. That can be done separately. Tracking issue: #66510
WSL1 does not support `fcntl`-based lock and will always report success, therefore creating a race condition when multiple rustc processes are modifying shared data such as `search-index.js`. WSL1 does however support `flock`. `flock` is supported by all unix-like platforms. The only caveat is that Linux 2.6.11 or earlier does not support `flock` on NFS mounts, but as the minimum supported Linux version is 2.6.18, it is not an issue. Fixes #72157
…g an error. This way the hir is "valid" and we can remove one more call to `opt_node_id_to_hir_id` but an error is still emitted. This is another partial fix for #71104
NRVO optimizes away the locals whose alignment is tested. I don't think this affects the purpose of the test.
I introduced this mistake in 175976e and I can't quite remember what the reasoning was back then. I think I modeled it on `apply_constructor`, not realizing there was an important difference in the order in which fields were stored.
Using a more error-oriented approache to `Option`.
Replace obligation construction with deref_steps() 1. Use `probe()` to avoid unwanted binding committing during `deref_steps()`. 2. Fixes #59819 again by using `deref_steps()`, make the code cleaner. And if we want to suggest multiple dereferences (like: `consider dereferencing the borrow: "****a"`) in the future, this change will make it easier to achieve.
add warning sign to UB examples Just to make it less likely that people miss the fact that these are examples for how to *not* do it.
Impl Ord for proc_macro::LineColumn ```rust impl Ord for LineColumn {...} impl PartialOrd for LineColumn {...} ``` for https://doc.rust-lang.org/nightly/proc_macro/struct.LineColumn.html. The ordering is the natural one you would get by writing one line after another, where we compare line first, then compare columns within the same line.
Add some regression tests Closes #69415 Closes #72455 r? @matthewjasper
Correct small typo: 'not' -> 'note'
Rollup of 5 pull requests Successful merges: - #72292 (Replace obligation construction with deref_steps()) - #72431 (add warning sign to UB examples) - #72446 (Impl Ord for proc_macro::LineColumn) - #72492 (Add some regression tests) - #72496 (Correct small typo: 'not' -> 'note') Failed merges: r? @ghost
@arora-aman @ChrisPardy @Azhng @jenniferwills @roxelo Doth me thy honor of approving this PR. |
ChrisPardy
approved these changes
May 24, 2020
sexxi-bot
pushed a commit
that referenced
this pull request
May 31, 2020
…ing opaque return type Go from ``` error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> file8.rs:22:5 | 22 | / move || { 23 | | *dest = g.get(); 24 | | } | |_____^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 18:1... --> file8.rs:18:1 | 18 | / fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a 19 | | where 20 | | G: Get<T> 21 | | { ... | 24 | | } 25 | | } | |_^ note: ...so that the types are compatible --> file8.rs:22:5 | 22 | / move || { //~ ERROR cannot infer an appropriate lifetime 23 | | *dest = g.get(); 24 | | } | |_____^ = note: expected `&mut T` found `&mut T` note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 18:8... --> file8.rs:18:8 | 18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ^^ note: ...so that return value is valid for the call --> file8.rs:18:45 | 18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ^^^^^^^^^^^^^^^^^^^^^^^ ``` to ``` error[E0621]: explicit lifetime required in the type of `dest` --> file8.rs:18:45 | 18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ------ ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required | | | help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T` ```
sexxi-bot
pushed a commit
that referenced
this pull request
Sep 13, 2020
* Fix `const-display.rs` XPATH queries * Add `issue_76501.rs` test file * Rename issue_76501.rs to issue-76501.rs
arora-aman
pushed a commit
that referenced
this pull request
Oct 28, 2020
Fixes rust-lang#836 Benchmark #1: simple-raytracer/raytracer_cg_clif Time (mean ± σ): 9.250 s ± 0.056 s [User: 9.213 s, System: 0.015 s] Range (min … max): 9.151 s … 9.348 s 20 runs Benchmark #2: simple-raytracer/raytracer_cg_clif_cold_separated Time (mean ± σ): 9.179 s ± 0.101 s [User: 9.141 s, System: 0.016 s] Range (min … max): 9.070 s … 9.473 s 20 runs Summary 'simple-raytracer/raytracer_cg_clif_cold_separated' ran 1.01 ± 0.01 times faster than 'simple-raytracer/raytracer_cg_clif'
arora-aman
pushed a commit
that referenced
this pull request
Oct 28, 2020
`stride == 1` case can be computed more efficiently through `-p (mod a)`. That, then translates to a nice and short sequence of LLVM instructions: %address = ptrtoint i8* %p to i64 %negptr = sub i64 0, %address %offset = and i64 %negptr, %a_minus_one And produces pretty much ideal code-gen when this function is used in isolation. Typical use of this function will, however, involve use of the result to offset a pointer, i.e. %aligned = getelementptr inbounds i8, i8* %p, i64 %offset This still looks very good, but LLVM does not really translate that to what would be considered ideal machine code (on any target). For example that's the codegen we obtain for an unknown alignment: ; x86_64 dec rsi mov rax, rdi neg rax and rax, rsi add rax, rdi In particular negating a pointer is not something that’s going to be optimised for in the design of CISC architectures like x86_64. They are much better at offsetting pointers. And so we’d love to utilize this ability and produce code that's more like this: ; x86_64 lea rax, [rsi + rdi - 1] neg rsi and rax, rsi To achieve this we need to give LLVM an opportunity to apply its various peep-hole optimisations that it does during DAG selection. In particular, the `and` instruction appears to be a major inhibitor here. We cannot, sadly, get rid of this load-bearing operation, but we can reorder operations such that LLVM has more to work with around this instruction. One such ordering is proposed in rust-lang#75579 and results in LLVM IR that looks broadly like this: ; using add enables `lea` and similar CISCisms %offset_ptr = add i64 %address, %a_minus_one %mask = sub i64 0, %a %masked = and i64 %offset_ptr, %mask ; can be folded with `gepi` that may follow %offset = sub i64 %masked, %address …and generates the intended x86_64 machine code. One might also wonder how the increased amount of code would impact a RISC target. Turns out not much: ; aarch64 previous ; aarch64 new sub x8, x1, #1 add x8, x1, x0 neg x9, x0 sub x8, x8, #1 and x8, x9, x8 neg x9, x1 add x0, x0, x8 and x0, x8, x9 (and similarly for ppc, sparc, mips, riscv, etc) The only target that seems to do worse is… wasm32. Onto actual measurements – the best way to evaluate snippets like these is to use llvm-mca. Much like Aarch64 assembly would allow to suspect, there isn’t any performance difference to be found. Both snippets execute in same number of cycles for the CPUs I tried. On x86_64, we get throughput improvement of >50%, however!
arora-aman
pushed a commit
that referenced
this pull request
Oct 28, 2020
Benchmark #1: ./raytracer_cg_clif_pre Time (mean ± σ): 8.251 s ± 0.021 s [User: 8.245 s, System: 0.005 s] Range (min … max): 8.225 s … 8.292 s 10 runs Benchmark #2: ./raytracer_cg_clif_post Time (mean ± σ): 8.206 s ± 0.043 s [User: 8.199 s, System: 0.007 s] Range (min … max): 8.168 s … 8.279 s 10 runs
arora-aman
pushed a commit
that referenced
this pull request
Oct 28, 2020
…-Simulacrum Optimise align_offset for stride=1 further `stride == 1` case can be computed more efficiently through `-p (mod a)`. That, then translates to a nice and short sequence of LLVM instructions: %address = ptrtoint i8* %p to i64 %negptr = sub i64 0, %address %offset = and i64 %negptr, %a_minus_one And produces pretty much ideal code-gen when this function is used in isolation. Typical use of this function will, however, involve use of the result to offset a pointer, i.e. %aligned = getelementptr inbounds i8, i8* %p, i64 %offset This still looks very good, but LLVM does not really translate that to what would be considered ideal machine code (on any target). For example that's the codegen we obtain for an unknown alignment: ; x86_64 dec rsi mov rax, rdi neg rax and rax, rsi add rax, rdi In particular negating a pointer is not something that’s going to be optimised for in the design of CISC architectures like x86_64. They are much better at offsetting pointers. And so we’d love to utilize this ability and produce code that's more like this: ; x86_64 lea rax, [rsi + rdi - 1] neg rsi and rax, rsi To achieve this we need to give LLVM an opportunity to apply its various peep-hole optimisations that it does during DAG selection. In particular, the `and` instruction appears to be a major inhibitor here. We cannot, sadly, get rid of this load-bearing operation, but we can reorder operations such that LLVM has more to work with around this instruction. One such ordering is proposed in rust-lang#75579 and results in LLVM IR that looks broadly like this: ; using add enables `lea` and similar CISCisms %offset_ptr = add i64 %address, %a_minus_one %mask = sub i64 0, %a %masked = and i64 %offset_ptr, %mask ; can be folded with `gepi` that may follow %offset = sub i64 %masked, %address …and generates the intended x86_64 machine code. One might also wonder how the increased amount of code would impact a RISC target. Turns out not much: ; aarch64 previous ; aarch64 new sub x8, x1, #1 add x8, x1, x0 neg x9, x0 sub x8, x8, #1 and x8, x9, x8 neg x9, x1 add x0, x0, x8 and x0, x8, x9 (and similarly for ppc, sparc, mips, riscv, etc) The only target that seems to do worse is… wasm32. Onto actual measurements – the best way to evaluate snipets like these is to use llvm-mca. Much like Aarch64 assembly would allow to suspect, there isn’t any performance difference to be found. Both snippets execute in same number of cycles for the CPUs I tried. On x86_64, we get throughput improvement of >50%! Fixes rust-lang#75579
sexxi-bot
pushed a commit
that referenced
this pull request
Nov 12, 2020
Before: ``` 2:rustc INFO rustc_interface::passes Pre-codegen 2:rustcTy interner total ty lt ct all 2:rustc Adt : 1078 81.3%, 0.0% 0.0% 0.0% 0.0% 2:rustc Array : 1 0.1%, 0.0% 0.0% 0.0% 0.0% 2:rustc Slice : 1 0.1%, 0.0% 0.0% 0.0% 0.0% 2:rustc RawPtr : 2 0.2%, 0.0% 0.0% 0.0% 0.0% 2:rustc Ref : 4 0.3%, 0.1% 0.1% 0.0% 0.0% 2:rustc FnDef : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc FnPtr : 76 5.7%, 0.0% 0.0% 0.0% 0.0% 2:rustc Placeholder : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Generator : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc GeneratorWitness : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Dynamic : 3 0.2%, 0.0% 0.0% 0.0% 0.0% 2:rustc Closure : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Tuple : 13 1.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Bound : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Param : 146 11.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Infer : 2 0.2%, 0.1% 0.0% 0.0% 0.0% 2:rustc Projection : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Opaque : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Foreign : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc total 1326 0.2% 0.1% 0.0% 0.0% 2:rustcInternalSubsts interner: rust-lang#437 2:rustcRegion interner: rust-lang#355 2:rustcStability interner: #1 2:rustcConst Stability interner: #0 2:rustcAllocation interner: #0 2:rustcLayout interner: #0 ``` After: ``` INFO rustc_interface::passes Post-codegen Ty interner total ty lt ct all Adt : 1078 81.3%, 0.0% 0.0% 0.0% 0.0% Array : 1 0.1%, 0.0% 0.0% 0.0% 0.0% Slice : 1 0.1%, 0.0% 0.0% 0.0% 0.0% RawPtr : 2 0.2%, 0.0% 0.0% 0.0% 0.0% Ref : 4 0.3%, 0.1% 0.1% 0.0% 0.0% FnDef : 0 0.0%, 0.0% 0.0% 0.0% 0.0% FnPtr : 76 5.7%, 0.0% 0.0% 0.0% 0.0% Placeholder : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Generator : 0 0.0%, 0.0% 0.0% 0.0% 0.0% GeneratorWitness : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Dynamic : 3 0.2%, 0.0% 0.0% 0.0% 0.0% Closure : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Tuple : 13 1.0%, 0.0% 0.0% 0.0% 0.0% Bound : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Param : 146 11.0%, 0.0% 0.0% 0.0% 0.0% Infer : 2 0.2%, 0.1% 0.0% 0.0% 0.0% Projection : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Opaque : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Foreign : 0 0.0%, 0.0% 0.0% 0.0% 0.0% total 1326 0.2% 0.1% 0.0% 0.0% InternalSubsts interner: rust-lang#437 Region interner: rust-lang#355 Stability interner: #1 Const Stability interner: #0 Allocation interner: #0 Layout interner: #0 ```
sexxi-bot
pushed a commit
that referenced
this pull request
Nov 12, 2020
Don't print thread ids and names in `tracing` logs Before: ``` 2:rustc INFO rustc_interface::passes Pre-codegen 2:rustcTy interner total ty lt ct all 2:rustc Adt : 1078 81.3%, 0.0% 0.0% 0.0% 0.0% 2:rustc Array : 1 0.1%, 0.0% 0.0% 0.0% 0.0% 2:rustc Slice : 1 0.1%, 0.0% 0.0% 0.0% 0.0% 2:rustc RawPtr : 2 0.2%, 0.0% 0.0% 0.0% 0.0% 2:rustc Ref : 4 0.3%, 0.1% 0.1% 0.0% 0.0% 2:rustc FnDef : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc FnPtr : 76 5.7%, 0.0% 0.0% 0.0% 0.0% 2:rustc Placeholder : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Generator : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc GeneratorWitness : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Dynamic : 3 0.2%, 0.0% 0.0% 0.0% 0.0% 2:rustc Closure : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Tuple : 13 1.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Bound : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Param : 146 11.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Infer : 2 0.2%, 0.1% 0.0% 0.0% 0.0% 2:rustc Projection : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Opaque : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc Foreign : 0 0.0%, 0.0% 0.0% 0.0% 0.0% 2:rustc total 1326 0.2% 0.1% 0.0% 0.0% 2:rustcInternalSubsts interner: rust-lang#437 2:rustcRegion interner: rust-lang#355 2:rustcStability interner: #1 2:rustcConst Stability interner: #0 2:rustcAllocation interner: #0 2:rustcLayout interner: #0 ``` After: ``` INFO rustc_interface::passes Post-codegen Ty interner total ty lt ct all Adt : 1078 81.3%, 0.0% 0.0% 0.0% 0.0% Array : 1 0.1%, 0.0% 0.0% 0.0% 0.0% Slice : 1 0.1%, 0.0% 0.0% 0.0% 0.0% RawPtr : 2 0.2%, 0.0% 0.0% 0.0% 0.0% Ref : 4 0.3%, 0.1% 0.1% 0.0% 0.0% FnDef : 0 0.0%, 0.0% 0.0% 0.0% 0.0% FnPtr : 76 5.7%, 0.0% 0.0% 0.0% 0.0% Placeholder : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Generator : 0 0.0%, 0.0% 0.0% 0.0% 0.0% GeneratorWitness : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Dynamic : 3 0.2%, 0.0% 0.0% 0.0% 0.0% Closure : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Tuple : 13 1.0%, 0.0% 0.0% 0.0% 0.0% Bound : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Param : 146 11.0%, 0.0% 0.0% 0.0% 0.0% Infer : 2 0.2%, 0.1% 0.0% 0.0% 0.0% Projection : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Opaque : 0 0.0%, 0.0% 0.0% 0.0% 0.0% Foreign : 0 0.0%, 0.0% 0.0% 0.0% 0.0% total 1326 0.2% 0.1% 0.0% 0.0% InternalSubsts interner: rust-lang#437 Region interner: rust-lang#355 Stability interner: #1 Const Stability interner: #0 Allocation interner: #0 Layout interner: #0 ``` Closes rust-lang#78931 r? ``@oli-obk``
roxelo
pushed a commit
that referenced
this pull request
Nov 30, 2020
``` Benchmark #1: ./raytracer_cg_clif_pre Time (mean ± σ): 9.553 s ± 0.129 s [User: 9.543 s, System: 0.008 s] Range (min … max): 9.438 s … 9.837 s 10 runs Benchmark #2: ./raytracer_cg_clif_post Time (mean ± σ): 9.463 s ± 0.055 s [User: 9.452 s, System: 0.008 s] Range (min … max): 9.387 s … 9.518 s 10 runs Summary './raytracer_cg_clif_post' ran 1.01 ± 0.01 times faster than './raytracer_cg_clif_pre' ```
roxelo
pushed a commit
that referenced
this pull request
Nov 30, 2020
Don't run `resolve_vars_if_possible` in `normalize_erasing_regions` Neither `@eddyb` nor I could figure out what this was for. I changed it to `assert_eq!(normalized_value, infcx.resolve_vars_if_possible(&normalized_value));` and it passed the UI test suite. <details><summary> Outdated, I figured out the issue - `needs_infer()` needs to come _after_ erasing the lifetimes </summary> Strangely, if I change it to `assert!(!normalized_value.needs_infer())` it panics almost immediately: ``` query stack during panic: #0 [normalize_generic_arg_after_erasing_regions] normalizing `<str::IsWhitespace as str::pattern::Pattern>::Searcher` #1 [needs_drop_raw] computing whether `str::iter::Split<str::IsWhitespace>` needs drop #2 [mir_built] building MIR for `str::<impl str>::split_whitespace` #3 [unsafety_check_result] unsafety-checking `str::<impl str>::split_whitespace` #4 [mir_const] processing MIR for `str::<impl str>::split_whitespace` #5 [mir_promoted] processing `str::<impl str>::split_whitespace` #6 [mir_borrowck] borrow-checking `str::<impl str>::split_whitespace` #7 [analysis] running analysis passes on this crate end of query stack ``` I'm not entirely sure what's going on - maybe the two disagree? </details> For context, this came up while reviewing rust-lang#77467 (cc `@lcnr).` Possibly this needs a crater run? r? `@nikomatsakis` cc `@matthewjasper`
sexxi-bot
pushed a commit
that referenced
this pull request
Feb 13, 2021
HWAddressSanitizer support # Motivation Compared to regular ASan, HWASan has a [smaller overhead](https://source.android.com/devices/tech/debug/hwasan). The difference in practice is that HWASan'ed code is more usable, e.g. Android device compiled with HWASan can be used as a daily driver. # Example ``` fn main() { let xs = vec![0, 1, 2, 3]; let _y = unsafe { *xs.as_ptr().offset(4) }; } ``` ``` ==223==ERROR: HWAddressSanitizer: tag-mismatch on address 0xefdeffff0050 at pc 0xaaaad00b3468 READ of size 4 at 0xefdeffff0050 tags: e5/00 (ptr/mem) in thread T0 #0 0xaaaad00b3464 (/root/main+0x53464) #1 0xaaaad00b39b4 (/root/main+0x539b4) #2 0xaaaad00b3dd0 (/root/main+0x53dd0) #3 0xaaaad00b61dc (/root/main+0x561dc) #4 0xaaaad00c0574 (/root/main+0x60574) #5 0xaaaad00b6290 (/root/main+0x56290) #6 0xaaaad00b6170 (/root/main+0x56170) #7 0xaaaad00b3578 (/root/main+0x53578) #8 0xffff81345e70 (/lib64/libc.so.6+0x20e70) #9 0xaaaad0096310 (/root/main+0x36310) [0xefdeffff0040,0xefdeffff0060) is a small allocated heap chunk; size: 32 offset: 16 0xefdeffff0050 is located 0 bytes to the right of 16-byte region [0xefdeffff0040,0xefdeffff0050) allocated here: #0 0xaaaad009bcdc (/root/main+0x3bcdc) #1 0xaaaad00b1eb0 (/root/main+0x51eb0) #2 0xaaaad00b20d4 (/root/main+0x520d4) #3 0xaaaad00b2800 (/root/main+0x52800) #4 0xaaaad00b1cf4 (/root/main+0x51cf4) #5 0xaaaad00b33d4 (/root/main+0x533d4) #6 0xaaaad00b39b4 (/root/main+0x539b4) #7 0xaaaad00b61dc (/root/main+0x561dc) #8 0xaaaad00b3578 (/root/main+0x53578) #9 0xaaaad0096310 (/root/main+0x36310) Thread: T0 0xeffe00002000 stack: [0xffffc0590000,0xffffc0d90000) sz: 8388608 tls: [0xffff81521020,0xffff815217d0) Memory tags around the buggy address (one tag corresponds to 16 bytes): 0xfefcefffef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefcefffef90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefcefffefa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefcefffefb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefcefffefc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefcefffefd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefcefffefe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefcefffeff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0xfefceffff000: a2 a2 05 00 e5 [00] 00 00 00 00 00 00 00 00 00 00 0xfefceffff010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefceffff020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefceffff030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefceffff040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefceffff050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefceffff060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefceffff070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0xfefceffff080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Tags for short granules around the buggy address (one tag corresponds to 16 bytes): 0xfefcefffeff0: .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. =>0xfefceffff000: .. .. c5 .. .. [..] .. .. .. .. .. .. .. .. .. .. 0xfefceffff010: .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. See https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html#short-granules for a description of short granule tags Registers where the failure occurred (pc 0xaaaad00b3468): x0 e500efdeffff0050 x1 0000000000000004 x2 0000ffffc0d8f5a0 x3 0200efff00000000 x4 0000ffffc0d8f4c0 x5 000000000000004f x6 00000ffffc0d8f36 x7 0000efff00000000 x8 e500efdeffff0050 x9 0200efff00000000 x10 0000000000000000 x11 0200efff00000000 x12 0200effe000006b0 x13 0200effe000006b0 x14 0000000000000008 x15 00000000c00000cf x16 0000aaaad00a0afc x17 0000000000000003 x18 0000000000000001 x19 0000ffffc0d8f718 x20 ba00ffffc0d8f7a0 x21 0000aaaad00962e0 x22 0000000000000000 x23 0000000000000000 x24 0000000000000000 x25 0000000000000000 x26 0000000000000000 x27 0000000000000000 x28 0000000000000000 x29 0000ffffc0d8f650 x30 0000aaaad00b3468 ``` # Comments/Caveats * HWASan is only supported on arm64. * I'm not sure if I should add a feature gate or piggyback on the existing one for sanitizers. * HWASan requires `-C target-feature=+tagged-globals`. That flag should probably be set transparently to the user. Not sure how to go about that. # TODO * Need more tests. * Update documentation. * Fix symbolization. * Integrate with CI
sexxi-bot
pushed a commit
that referenced
this pull request
Mar 8, 2021
bypass auto_da_alloc for metadata files This saves about 0.7% when rerunning the UI test suite. I.e. when the metadata files exist and will be overwritten. No improvements expected for a clean build. So it might show up in incr-patched perf results. ``` regular rename: Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui Time (mean ± σ): 47.305 s ± 0.170 s [User: 1631.540 s, System: 412.648 s] Range (min … max): 47.125 s … 47.856 s 20 runs non-durable rename: Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui Time (mean ± σ): 46.930 s ± 0.064 s [User: 1634.344 s, System: 396.038 s] Range (min … max): 46.759 s … 47.043 s 20 runs ``` There are more places that trigger auto_da_alloc behavior by overwriting existing files with O_TRUNC, but those are much harder to locate because `O_TRUNC` is set on `open()` but the writeback is triggered on `close()`. The latter is the part which shows up in profiles.
sexxi-bot
pushed a commit
that referenced
this pull request
May 11, 2021
…nt, r=Mark-Simulacrum Show nicer error when an 'unstable fingerprints' error occurs An example of the error produced by this PR: ``` error: internal compiler error: encountered incremental compilation error with evaluate_obligation(9f2ad55260c30262-c36667639674ad83) | = help: This is a known issue with the compiler. Run `cargo clean -p syn` or `cargo clean` to allow your project to compile = note: Please follow the instructions below to create a bug report with the provided information thread 'rustc' panicked at 'Found unstable fingerprints for evaluate_obligation(9f2ad55260c30262-c36667639674ad83): Ok(EvaluatedToOk)', /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:595:9 stack backtrace: 0: rust_begin_unwind at /home/aaron/repos/rust/library/std/src/panicking.rs:493:5 1: std::panicking::begin_panic_fmt at /home/aaron/repos/rust/library/std/src/panicking.rs:435:5 2: rustc_query_system::query::plumbing::incremental_verify_ich at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:595:9 3: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:557:9 4: rustc_query_system::query::plumbing::try_execute_query::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:473:21 5: core::option::Option<T>::map at /home/aaron/repos/rust/library/core/src/option.rs:487:29 6: rustc_query_system::query::plumbing::try_execute_query::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:471:13 7: stacker::maybe_grow at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9 8: rustc_data_structures::stack::ensure_sufficient_stack at /home/aaron/repos/rust/compiler/rustc_data_structures/src/stack.rs:16:5 9: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:169:17 10: rustc_middle::ty::context::tls::enter_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50 11: rustc_middle::ty::context::tls::set_tlv at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9 12: rustc_middle::ty::context::tls::enter_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9 13: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:168:13 14: rustc_middle::ty::context::tls::with_related_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1780:13 15: rustc_middle::ty::context::tls::with_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40 16: rustc_middle::ty::context::tls::with_context_opt at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22 17: rustc_middle::ty::context::tls::with_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9 18: rustc_middle::ty::context::tls::with_related_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1777:9 19: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:157:9 20: rustc_query_system::query::plumbing::try_execute_query at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:469:22 21: rustc_query_system::query::plumbing::get_query_impl at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:674:5 22: rustc_query_system::query::plumbing::get_query at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:785:9 23: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::evaluate_obligation at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:603:17 24: rustc_middle::ty::query::TyCtxtAt::evaluate_obligation at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/query/mod.rs:204:17 25: rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::evaluate_obligation at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/query/mod.rs:185:17 26: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:72:9 27: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:82:15 28: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_modulo_regions at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:58:9 29: rustc_trait_selection::traits::type_known_to_meet_bound_modulo_regions at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/mod.rs:146:18 30: rustc_ty_utils::common_traits::is_item_raw::{{closure}} at /home/aaron/repos/rust/compiler/rustc_ty_utils/src/common_traits.rs:33:9 31: rustc_infer::infer::InferCtxtBuilder::enter at /home/aaron/repos/rust/compiler/rustc_infer/src/infer/mod.rs:582:9 32: rustc_ty_utils::common_traits::is_item_raw at /home/aaron/repos/rust/compiler/rustc_ty_utils/src/common_traits.rs:32:5 33: rustc_query_system::query::config::QueryVtable<CTX,K,V>::compute at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/config.rs:44:9 34: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:544:67 35: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:46 36: rustc_middle::ty::context::tls::enter_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50 37: rustc_middle::ty::context::tls::set_tlv at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9 38: rustc_middle::ty::context::tls::enter_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9 39: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:13 40: rustc_middle::ty::context::tls::with_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40 41: rustc_middle::ty::context::tls::with_context_opt at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22 42: rustc_middle::ty::context::tls::with_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9 43: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:74:9 44: rustc_query_system::dep_graph::graph::DepGraph<K>::with_ignore at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:167:9 45: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:544:22 46: rustc_query_system::query::plumbing::try_execute_query::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:473:21 47: core::option::Option<T>::map at /home/aaron/repos/rust/library/core/src/option.rs:487:29 48: rustc_query_system::query::plumbing::try_execute_query::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:471:13 49: stacker::maybe_grow at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9 50: rustc_data_structures::stack::ensure_sufficient_stack at /home/aaron/repos/rust/compiler/rustc_data_structures/src/stack.rs:16:5 51: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:169:17 52: rustc_middle::ty::context::tls::enter_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50 53: rustc_middle::ty::context::tls::set_tlv at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9 54: rustc_middle::ty::context::tls::enter_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9 55: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:168:13 56: rustc_middle::ty::context::tls::with_related_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1780:13 57: rustc_middle::ty::context::tls::with_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40 58: rustc_middle::ty::context::tls::with_context_opt at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22 59: rustc_middle::ty::context::tls::with_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9 60: rustc_middle::ty::context::tls::with_related_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1777:9 61: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:157:9 62: rustc_query_system::query::plumbing::try_execute_query at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:469:22 63: rustc_query_system::query::plumbing::get_query_impl at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:674:5 64: rustc_query_system::query::plumbing::get_query at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:785:9 65: rustc_middle::ty::query::TyCtxtAt::is_unpin_raw at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/query/mod.rs:204:17 66: rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::is_unpin at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/util.rs:727:38 67: rustc_middle::ty::layout::<impl rustc_target::abi::TyAndLayoutMethods<C> for &rustc_middle::ty::TyS>::pointee_info_at at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2341:32 68: rustc_target::abi::TyAndLayout<Ty>::pointee_info_at at /home/aaron/repos/rust/compiler/rustc_target/src/abi/mod.rs:1164:9 69: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2781:36 70: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2840:17 71: rustc_target::abi::call::ArgAbi<Ty>::new at /home/aaron/repos/rust/compiler/rustc_target/src/abi/call/mod.rs:457:53 72: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2838:27 73: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2870:32 74: core::iter::adapters::map::map_fold::{{closure}} at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:82:28 75: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold::enumerate::{{closure}} at /home/aaron/repos/rust/library/core/src/iter/adapters/enumerate.rs:104:27 76: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut at /home/aaron/repos/rust/library/core/src/ops/function.rs:269:13 77: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut at /home/aaron/repos/rust/library/core/src/ops/function.rs:269:13 78: core::iter::adapters::map::map_fold::{{closure}} at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:82:21 79: core::iter::traits::iterator::Iterator::fold at /home/aaron/repos/rust/library/core/src/iter/traits/iterator.rs:2146:21 80: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:122:9 81: <core::iter::adapters::cloned::Cloned<I> as core::iter::traits::iterator::Iterator>::fold at /home/aaron/repos/rust/library/core/src/iter/adapters/cloned.rs:58:9 82: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold at /home/aaron/repos/rust/library/core/src/iter/adapters/chain.rs:119:19 83: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold at /home/aaron/repos/rust/library/core/src/iter/adapters/chain.rs:119:19 84: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold at /home/aaron/repos/rust/library/core/src/iter/adapters/enumerate.rs:110:9 85: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:122:9 86: core::iter::traits::iterator::Iterator::for_each at /home/aaron/repos/rust/library/core/src/iter/traits/iterator.rs:776:9 87: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend at /home/aaron/repos/rust/library/alloc/src/vec/spec_extend.rs:40:17 88: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter at /home/aaron/repos/rust/library/alloc/src/vec/spec_from_iter_nested.rs:56:9 89: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter at /home/aaron/repos/rust/library/alloc/src/vec/spec_from_iter.rs:36:9 90: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter at /home/aaron/repos/rust/library/alloc/src/vec/mod.rs:2448:9 91: core::iter::traits::iterator::Iterator::collect at /home/aaron/repos/rust/library/core/src/iter/traits/iterator.rs:1788:9 92: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2864:19 93: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::of_instance at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2670:9 94: rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods for rustc_codegen_llvm::context::CodegenCx>::predefine_fn at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/mono_item.rs:57:22 95: <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::predefine at /home/aaron/repos/rust/compiler/rustc_codegen_ssa/src/mono_item.rs:76:17 96: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/base.rs:122:17 97: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::{{closure}} at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:235:62 98: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:46 99: rustc_middle::ty::context::tls::enter_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50 100: rustc_middle::ty::context::tls::set_tlv at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9 101: rustc_middle::ty::context::tls::enter_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9 102: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:13 103: rustc_middle::ty::context::tls::with_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40 104: rustc_middle::ty::context::tls::with_context_opt at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22 105: rustc_middle::ty::context::tls::with_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9 106: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:74:9 107: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:235:26 108: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:205:9 109: rustc_codegen_llvm::base::compile_codegen_unit at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/base.rs:103:9 110: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/lib.rs:109:9 111: rustc_codegen_ssa::base::codegen_crate at /home/aaron/repos/rust/compiler/rustc_codegen_ssa/src/base.rs:655:38 112: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/lib.rs:270:18 113: rustc_interface::passes::start_codegen::{{closure}} at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:1021:9 114: rustc_data_structures::profiling::VerboseTimingGuard::run at /home/aaron/repos/rust/compiler/rustc_data_structures/src/profiling.rs:573:9 115: rustc_session::utils::<impl rustc_session::session::Session>::time at /home/aaron/repos/rust/compiler/rustc_session/src/utils.rs:16:9 116: rustc_interface::passes::start_codegen at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:1020:19 117: rustc_interface::queries::Queries::ongoing_codegen::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:296:20 118: rustc_interface::passes::QueryContext::enter::{{closure}} at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:755:42 119: rustc_middle::ty::context::tls::enter_context::{{closure}} at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50 120: rustc_middle::ty::context::tls::set_tlv at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9 121: rustc_middle::ty::context::tls::enter_context at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9 122: rustc_interface::passes::QueryContext::enter at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:755:9 123: rustc_interface::queries::Queries::ongoing_codegen::{{closure}} at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:287:13 124: rustc_interface::queries::Query<T>::compute at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:40:28 125: rustc_interface::queries::Queries::ongoing_codegen at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:285:9 126: rustc_driver::run_compiler::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_driver/src/lib.rs:442:13 127: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:428:19 128: rustc_driver::run_compiler::{{closure}} at /home/aaron/repos/rust/compiler/rustc_driver/src/lib.rs:337:22 129: rustc_interface::interface::create_compiler_and_run::{{closure}} at /home/aaron/repos/rust/compiler/rustc_interface/src/interface.rs:208:13 130: rustc_span::with_source_map at /home/aaron/repos/rust/compiler/rustc_span/src/lib.rs:788:5 131: rustc_interface::interface::create_compiler_and_run at /home/aaron/repos/rust/compiler/rustc_interface/src/interface.rs:202:5 132: rustc_interface::interface::run_compiler::{{closure}} at /home/aaron/repos/rust/compiler/rustc_interface/src/interface.rs:224:12 133: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}} at /home/aaron/repos/rust/compiler/rustc_interface/src/util.rs:155:13 134: scoped_tls::ScopedKey<T>::set at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9 135: rustc_span::with_session_globals at /home/aaron/repos/rust/compiler/rustc_span/src/lib.rs:105:5 136: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}} at /home/aaron/repos/rust/compiler/rustc_interface/src/util.rs:153:9 137: rustc_interface::util::scoped_thread::{{closure}} at /home/aaron/repos/rust/compiler/rustc_interface/src/util.rs:128:24 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: internal compiler error: unexpected panic note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: rustc 1.54.0-dev running on x86_64-unknown-linux-gnu note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C incremental --crate-type lib note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [evaluate_obligation] evaluating trait selection obligation `quote::Tokens: std::marker::Unpin` #1 [is_unpin_raw] computing whether `quote::Tokens` is `Unpin` end of query stack error: aborting due to previous error error: could not compile `syn` To learn more, run the command again with --verbose. ``` I've left in the panic and ICE following the pretty error, so that we still have all of the debug information available in a bug report. This message can be reproduced by cloning the repository `https://github.com/Aaron1011/syn-crash`, and running the following shell script (with a `rustup override` set in the directory): ``` set -xe cargo clean -p syn cargo clean --release -p syn git checkout minimize cargo build --release -j 1 git checkout minimize-change cargo build --release -j 1 ``` r? ``@Mark-Simulacrum``
sexxi-bot
pushed a commit
that referenced
this pull request
May 15, 2021
str::is_char_boundary - slight optimization Current `str::is_char_boundary` implementation emits slightly more instructions, because it includes an additional branch for `index == s.len()` ```rust pub fn is_char_boundary(s: &str, index: usize) -> bool { if index == 0 || index == s.len() { return true; } match s.as_bytes().get(index) { None => false, Some(&b) => (b as i8) >= -0x40, } } ``` Just changing the place of `index == s.len()` merges it with `index < s.len()` from `s.as_bytes().get(index)` ```rust pub fn is_char_boundary2(s: &str, index: usize) -> bool { if index == 0 { return true; } match s.as_bytes().get(index) { // For some reason, LLVM likes this comparison here more None => index == s.len(), // This is bit magic equivalent to: b < 128 || b >= 192 Some(&b) => (b as i8) >= -0x40, } } ``` This one has better codegen on every platform, except powerpc <details><summary>x86 codegen</summary> <p> ```nasm example::is_char_boundary: mov al, 1 test rdx, rdx je .LBB0_5 cmp rsi, rdx je .LBB0_5 cmp rsi, rdx jbe .LBB0_3 cmp byte ptr [rdi + rdx], -65 setg al .LBB0_5: ret .LBB0_3: xor eax, eax ret example::is_char_boundary2: test rdx, rdx je .LBB1_1 cmp rsi, rdx jbe .LBB1_4 cmp byte ptr [rdi + rdx], -65 setg al ret .LBB1_1: ; technically this branch is the same as LBB1_4 mov al, 1 ret .LBB1_4: sete al ret ``` </p> </details> <details><summary>aarch64 codegen</summary> <p> ```as example::is_char_boundary: mov x8, x0 mov w0, #1 cbz x2, .LBB0_4 cmp x1, x2 b.eq .LBB0_4 b.ls .LBB0_5 ldrsb w8, [x8, x2] cmn w8, rust-lang#65 cset w0, gt .LBB0_4: ret .LBB0_5: mov w0, wzr ret example::is_char_boundary2: cbz x2, .LBB1_3 cmp x1, x2 b.ls .LBB1_4 ldrsb w8, [x0, x2] cmn w8, rust-lang#65 cset w0, gt ret .LBB1_3: mov w0, #1 ret .LBB1_4: cset w0, eq ret ``` </p> </details> <details><summary>riscv64gc codegen</summary> <p> example::is_char_boundary: seqz a3, a2 xor a4, a1, a2 seqz a4, a4 or a4, a4, a3 addi a3, zero, 1 bnez a4, .LBB0_3 bgeu a2, a1, .LBB0_4 add a0, a0, a2 lb a0, 0(a0) addi a1, zero, -65 slt a3, a1, a0 .LBB0_3: mv a0, a3 ret .LBB0_4: mv a0, zero ret example::is_char_boundary2: beqz a2, .LBB1_3 bgeu a2, a1, .LBB1_4 add a0, a0, a2 lb a0, 0(a0) addi a1, zero, -65 slt a0, a1, a0 ret .LBB1_3: addi a0, zero, 1 ret .LBB1_4: xor a0, a1, a2 seqz a0, a0 ret </p> </details> [Link to godbolt](https://godbolt.org/z/K8avEz8Gr) `@rustbot` label: A-codegen
arora-aman
pushed a commit
that referenced
this pull request
Aug 25, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.