bors
790309b102
Auto merge of #115315 - RalfJung:field-capture-packed-alignment, r=oli-obk
...
closure field capturing: don't depend on alignment of packed fields
This fixes the closure field capture part of https://github.com/rust-lang/rust/issues/115305 : field capturing always stops at projections into packed structs, no matter the alignment of the field. This means changing a private field type from `u8` to `u64` can never change how closures capture fields, which is probably what we want.
Here's an example where, before this PR, changing the type of a private field in a repr(Rust) struct can change the output of a program:
```rust
#![allow(dead_code)]
mod m {
// before patch
#[derive(Default)]
pub struct S1(u8);
// after patch
#[derive(Default)]
pub struct S2(u64);
}
struct NoisyDrop;
impl Drop for NoisyDrop {
fn drop(&mut self) {
eprintln!("dropped!");
}
}
#[repr(packed)]
struct MyType {
field: m::S1, // output changes when this becomes S2
other_field: NoisyDrop,
third_field: Vec<()>,
}
fn test(r: MyType) {
let c = || {
let _val = std::ptr::addr_of!(r.field);
let _val = r.third_field;
};
drop(c);
eprintln!("before dropping");
}
fn main() {
test(MyType {
field: Default::default(),
other_field: NoisyDrop,
third_field: Vec::new(),
});
}
```
Of course this is a breaking change for the same reason that doing field capturing in the first place was a breaking change. Packed fields are relatively rare and depending on drop order is relatively rare, so I don't expect this to have much impact, but it's hard to be sure and even a crater run will only tell us so much.
Also see the [nomination comment](https://github.com/rust-lang/rust/pull/115315#issuecomment-1702807825 ).
Cc `@rust-lang/wg-rfc-2229` `@ehuss`
2023-09-16 05:29:23 +00:00
ltdk
8184c9c50d
impl Step for IP addresses
2023-09-16 01:28:13 -04:00
bors
635c4a5e61
Auto merge of #114494 - est31:extend_useless_ptr_null_checks, r=jackh726
...
Make useless_ptr_null_checks smarter about some std functions
This teaches the `useless_ptr_null_checks` lint that some std functions can't ever return null pointers, because they need to point to valid data, get references as input, etc.
This is achieved by introducing an `#[rustc_never_returns_null_ptr]` attribute and adding it to these std functions (gated behind bootstrap `cfg_attr`).
Later on, the attribute could maybe be used to tell LLVM that the returned pointer is never null. I don't expect much impact of that though, as the functions are pretty shallow and usually the input data is already never null.
Follow-up of PR #113657
Fixes #114442
2023-09-16 03:40:20 +00:00
Zalathar
91e0b46f76
coverage: Replace an unnecessary map with a set
...
This hashmap's values were never used.
2023-09-16 12:07:35 +10:00
Zalathar
3b5b1aa2a5
coverage: Simplify internal representation of debug types
2023-09-16 12:07:35 +10:00
Zalathar
d0d1187ebb
coverage: Update log module names in debug docs
2023-09-16 12:07:35 +10:00
Zalathar
d79cd17199
coverage: Arrange imports in rustc_mir_transform::coverage::debug
2023-09-16 12:07:35 +10:00
bors
e81f85fe9e
Auto merge of #115520 - Finomnis:const_transmute_copy, r=dtolnay
...
Stabilize const_transmute_copy
Closes #83165
2023-09-16 01:51:55 +00:00
bors
c48e6ffce5
Auto merge of #115829 - notriddle:notriddle/rustdoc-theme-css-merge, r=GuillaumeGomez
...
rustdoc: merge theme css into rustdoc.css
Based on https://github.com/rust-lang/rust/pull/115812#issuecomment-1717960119
Having them in separate files used to make more sense, before the migration to CSS variables made the theme files as small as they are nowadays. This is already how docs.rs and mdBook do it.
WebPageTest comparison page:
https://www.webpagetest.org/video/compare.php?tests=230913_AiDc3F_B9E,230913_AiDc7G_B9B
Filmstrip comparison:
![image](https://github.com/rust-lang/rust/assets/1593513/7ccad27b-7497-47ee-94c0-1a701b69c0c2 )
Old waterfall:
![image](https://github.com/rust-lang/rust/assets/1593513/7a6e4375-226d-4205-8871-a4d775a70748 )
New waterfall:
![image](https://github.com/rust-lang/rust/assets/1593513/e29112e3-84f7-417d-a250-cd6c10fa50f5 )
2023-09-16 00:02:41 +00:00
Boxy
71cab64079
special case TyAndLayout
debug impl
2023-09-15 22:57:07 +02:00
bors
20999de3a2
Auto merge of #115878 - weihanglo:update-cargo, r=weihanglo
...
Update cargo
11 commits in 2fc85d15a542bfb610aff7682073412cf635352f..d5336f813df39d476e61fc46daabb1446350660a
2023-09-09 01:49:46 +0000 to 2023-09-14 19:55:49 +0000
- fix: emit a warning for `credential-alias` shadowing (rust-lang/cargo#12671 )
- refactor: fix lint errors in preparation of `[lints]` table integration (rust-lang/cargo#12669 )
- Limit cargo add feature print (rust-lang/cargo#12662 )
- Clippy (rust-lang/cargo#12667 )
- Prerelease candidates error message (rust-lang/cargo#12659 )
- Fix typos: `informations` -> `information` (rust-lang/cargo#12666 )
- chore: update globset to 0.4.13 (rust-lang/cargo#12665 )
- refactor: Consolidate clap/shell styles (rust-lang/cargo#12655 )
- libgit2 fixed upstream (rust-lang/cargo#12657 )
- Index summary enum (rust-lang/cargo#12643 )
- feat(help): Add styling to help output (rust-lang/cargo#12578 )
r? ghost
2023-09-15 20:54:56 +00:00
Guillaume Gomez
7c72edf19f
Update documentation for custom_code_classes_in_docs
feature
2023-09-15 21:32:29 +02:00
Guillaume Gomez
f038f180fd
Add custom
tag for markdown codeblocks
2023-09-15 21:32:29 +02:00
Guillaume Gomez
113220b970
Update to new emit_error
API
2023-09-15 21:32:29 +02:00
Guillaume Gomez
87d2aa5fd3
Improve error emitting code
2023-09-15 21:32:29 +02:00
Guillaume Gomez
bbaa930b35
Fix compilation error "the trait bound SubdiagnosticMessage: From<&std::string::String>
is not satisfied"
2023-09-15 21:32:29 +02:00
Guillaume Gomez
6e21e4823d
Fix incorrect codeblock attributes in docs
2023-09-15 21:32:29 +02:00
Guillaume Gomez
5f3002ebeb
Add eBNF and documentation on TagIterator
2023-09-15 21:32:29 +02:00
Guillaume Gomez
7681f63cab
Implement new eBNF for codeblock attributes
2023-09-15 21:32:28 +02:00
Guillaume Gomez
4ce17fa30e
Add support for double quotes in markdown codeblock attributes
2023-09-15 21:32:28 +02:00
Guillaume Gomez
d829fee6b5
Add documentation for custom_code_classes_in_docs
feature
2023-09-15 21:32:28 +02:00
Guillaume Gomez
f5561842e3
Add tests for custom_code_classes_in_docs
feature
2023-09-15 21:32:28 +02:00
Guillaume Gomez
5515fc88dc
Implement custom classes for rustdoc code blocks with custom_code_classes_in_docs
feature
2023-09-15 21:32:27 +02:00
Weihang Lo
4d4ac94c07
Update cargo
2023-09-16 00:38:45 +08:00
Michael Howell
ab41e2b6dc
rustdoc: avoid calling document.write
after the page loads
2023-09-15 07:40:17 -07:00
Michael Howell
7e86fd61e8
rustdoc: merge theme css into rustdoc.css
...
Based on
https://github.com/rust-lang/rust/pull/115812#issuecomment-1717960119
Having them in separate files used to make more sense, before the
migration to CSS variables made the theme files as small as they are
nowadays. This is already how docs.rs and mdBook do it.
2023-09-15 07:40:17 -07:00
bors
33440d7fc6
Auto merge of #115871 - krasimirgg:llvm-18-en, r=durin42
...
llvm-wrapper: adapt for LLVM API changes
No functional changes intended.
Adapts the wrapper for 0a1aa6cda2
.
Found by our experimental rust + llvm @ head CI: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/22301#018a9926-a810-4e56-8ac2-e6f30b78f433/253-551
2023-09-15 14:36:20 +00:00
Krasimir Georgiev
af401b0ca3
llvm-wrapper: adapt for LLVM API changes
...
No functional changes intended.
Adapts the wrapper for 0a1aa6cda2
.
Found by our experimental rust + llvm @ head CI: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/22301#018a9926-a810-4e56-8ac2-e6f30b78f433/253-551
2023-09-15 14:31:43 +00:00
clubby789
8696ee8b09
Migrate 'missing fn lang items' diagnostic
2023-09-15 14:24:58 +00:00
clubby789
cb9f666fdf
Migrate 'invalid callee' diagnostic
2023-09-15 14:24:58 +00:00
clubby789
b40f11c8a9
Migrate 'rust-call incorrect arguments' diagnostic
2023-09-15 14:24:58 +00:00
clubby789
9edeb19f96
Allow internal untranslatable diagnostic
2023-09-15 14:24:58 +00:00
clubby789
6e2adbf6a3
Migrate 'explicit destructor call' diagnostic
2023-09-15 14:24:58 +00:00
Pietro Albini
c230637b92
avoid blessing cargo deps's source code in ui tests
2023-09-15 16:22:52 +02:00
Pietro Albini
d695b95e3b
implement -Z ignore-directory-in-diagnostics-source-blocks
2023-09-15 16:22:50 +02:00
bors
e7f9f48d76
Auto merge of #115853 - obeis:hir-analysis-migrate-diagnostics-6, r=compiler-errors
...
Migrate `rustc_hir_analysis` to session diagnostic [Part 6]
Part 6: Finish `coherence/inherent_impls.rs` file
2023-09-15 11:55:27 +00:00
bors
56e1aaadb3
Auto merge of #115851 - Alexendoo:clippy-doc-hidden-headers, r=flip1995
...
Ignore `#[doc(hidden)]` functions in clippy doc lints
Fixes https://github.com/rust-lang/rust-clippy/issues/11501
The implementation before #115689 had a check for unsugared doc comments that also happened to catch `#[doc(hidden)]`, this adds the check back in more explicitly
852bf4e51b/src/tools/clippy/clippy_lints/src/doc.rs (L526-L529)
r? `@flip1995`
2023-09-15 09:55:31 +00:00
Ralf Jung
3ee65c28e9
cannot have Direct for unsized types
2023-09-15 10:45:37 +02:00
Ralf Jung
29a4b7b971
fix gcc, cranelift build
2023-09-15 10:43:44 +02:00
Ralf Jung
89139d4c46
clarify PassMode::Indirect as well
2023-09-15 10:43:44 +02:00
Ralf Jung
7740476a43
explain PassMode::Cast
2023-09-15 10:43:44 +02:00
Ralf Jung
06a76ab415
make interpreter type Debug impl independent of Ty debug impl
2023-09-15 09:54:06 +02:00
bors
915c8af550
Auto merge of #115850 - compiler-errors:effect-canon, r=fee1-dead
...
Canonicalize effect vars in new solver
No good reason not to fix this, we already have all the machinery to make this work.
r? `@fee1-dead`
Fixes #115792
2023-09-15 06:45:56 +00:00
Michael Goulet
280f058560
Canonicalize effect vars in new solver
2023-09-15 05:11:16 +00:00
bors
9cbc90c0ae
Auto merge of #115861 - clubby789:migrate-remove-semi-diag, r=compiler-errors
...
Make 'remove semi to coerce match' diagnostic translatable
2023-09-15 04:56:26 +00:00
clubby789
b663464ea0
Make 'remove semi to coerce match' diagnostic translatable
2023-09-15 00:45:09 +00:00
bors
ae9465fee3
Auto merge of #115859 - compiler-errors:effect-fallback, r=fee1-dead
...
Fallback effects even if types also fallback
`||` is short circuiting, so if we do ty/int var fallback, we *don't* do effect fallback 😸
r? `@fee1-dead` or `@oli-obk`
Fixes #115791
Fixes #115842
2023-09-15 00:05:28 +00:00
bors
ca2b74f1ae
Auto merge of #115857 - notriddle:notriddle/gui-test-themes, r=GuillaumeGomez
...
rusdoc: add gui test for custom CSS themes
Based on
https://github.com/rust-lang/rust/pull/115829#issuecomment-1720056602
2023-09-14 21:52:34 +00:00
Soveu
eea6149e03
Enable varargs support for AAPCS calling convention
...
This is the default calling convention for ARM - it is used for extern "C",
therefore it supports varargs.
2023-09-14 23:21:39 +02:00
Michael Goulet
5c907a7859
Fallback effects even if types also fall back
2023-09-14 21:08:42 +00:00