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 17 pull requests #129807

Closed
wants to merge 184 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
c1245e1
Add new assist toggle_macro_delimiter
alibektas Aug 1, 2024
662f02f
Make toggle_macro_delimiters work only for macro_calls
alibektas Aug 2, 2024
aa6e8d3
Allow declaring cfg groups in rust-project.json, to help sharing comm…
ChayimFriedman2 Aug 11, 2024
5e058db
docs: Add a doc comment for OpQueue
Wilfred Aug 13, 2024
54ecca0
Auto merge of #17885 - Wilfred:op_queue_docs, r=lnicola
bors Aug 14, 2024
4a14155
Be more resilient to bad language item definitions in binop inference
lnicola Aug 14, 2024
e2f2e73
Auto merge of #17891 - lnicola:binop-bad-lang-items, r=flodiebold
bors Aug 14, 2024
81b68b2
fix: Panic while canonicalizing erroneous projection type
ShoyuVanilla Aug 14, 2024
89cd585
Auto merge of #17882 - ShoyuVanilla:issue-17866, r=lnicola
bors Aug 14, 2024
b0183f8
fix: Panic while displaying associated function with a type annotation
ShoyuVanilla Aug 14, 2024
e20180d
Auto merge of #17893 - ShoyuVanilla:issue-17871, r=flodiebold
bors Aug 15, 2024
6ed283b
rustdoc-json: Add test for `Self` type
aDotInTheVoid Aug 15, 2024
a783e30
internal: Properly check the edition for edition dependent syntax kinds
Veykril Aug 15, 2024
a594a2d
Auto merge of #17896 - Veykril:editioned-syntax-kinds, r=Veykril
bors Aug 15, 2024
bf4d31d
Add scip/lsif flag to exclude vendored libaries
darichey Aug 15, 2024
23c8dcd
Allow flycheck process to exit gracefully
tmandry Aug 15, 2024
642a0f8
Replace once_cell with std's recently stabilized OnceCell/Lock and La…
ChayimFriedman2 Aug 16, 2024
0cbf6a7
Test for word boundary in `FindUsages`
ChayimFriedman2 Aug 16, 2024
b68992a
Auto merge of #17907 - ChayimFriedman2:no-once_cell, r=Veykril
bors Aug 16, 2024
95f5e4b
Auto merge of #17908 - ChayimFriedman2:usages-word-boundaries, r=Veykril
bors Aug 16, 2024
fdd5294
Auto merge of #17903 - tmandry:graceful-exit, r=Veykril
bors Aug 16, 2024
4ca597a
implement basic inferring of lifetimes
dfireBird Jun 29, 2024
2071778
Auto merge of #17595 - dfireBird:infer-lt, r=flodiebold
bors Aug 16, 2024
3d6129d
Properly account for editions in names
ChayimFriedman2 Aug 15, 2024
6908451
Auto merge of #17905 - ChayimFriedman2:edition-dependent-raw-keyword,…
bors Aug 16, 2024
995a014
Auto merge of #17900 - darichey:exclude-vendored-libraries, r=davidba…
bors Aug 16, 2024
6fc487d
Remove rust-analyzer.workspace.discoverProjectRunner
darichey Aug 16, 2024
01245bd
Auto merge of #17909 - darichey:remove-discoverProjectRunner, r=lnicola
bors Aug 16, 2024
d3fa5e9
Pin `rowan` to `0.15.15`
ShoyuVanilla Aug 17, 2024
d2d41b4
Auto merge of #17917 - ShoyuVanilla:pin-rowan, r=lnicola
bors Aug 17, 2024
c4b8c65
fix: Wrong BoundVar index when lowering impl trait parameter of paren…
ShoyuVanilla Aug 17, 2024
eb12861
Auto merge of #17916 - ShoyuVanilla:issue-17711, r=Veykril
bors Aug 17, 2024
d0ce97f
feat: Make rust-analyzer work partially when missing an internet conn…
Veykril Aug 17, 2024
324cf83
Adress new clippy::large_enum_variant diagnostics
Veykril Aug 17, 2024
51e3775
Auto merge of #17915 - Veykril:offline-no-deps, r=Veykril
bors Aug 17, 2024
74db4d3
Include generics when lowering extern type
darichey Aug 18, 2024
2c18533
Auto merge of #17925 - darichey:issue-17767, r=Veykril
bors Aug 19, 2024
1bfb362
chore(config): remove `invocationLocation` in favor of `invocationStr…
Tyrubias Aug 14, 2024
85f6d15
Auto merge of #17888 - Tyrubias:remove-invocation-location, r=Veykril
bors Aug 19, 2024
036affc
fix: keep comments in convert_while_to_loop
roife Aug 19, 2024
05f5c77
Auto merge of #17928 - roife:fix-issue-17869, r=Veykril
bors Aug 19, 2024
b2062ea
Improve documentation for `InvocationStrategy`
Veykril Aug 19, 2024
f17e9a0
Auto merge of #17929 - Veykril:invocation-loc-docs, r=Veykril
bors Aug 19, 2024
bd6ea75
Remove the ability to configure the user config path
Veykril Aug 19, 2024
879fa66
Allow user config to not exist
Veykril Aug 19, 2024
ea12d79
fix: Panic when a TAIT exists in a RPIT
ShoyuVanilla Aug 18, 2024
f9c0c8a
Auto merge of #17924 - ShoyuVanilla:issue-17921, r=Veykril
bors Aug 19, 2024
f25cb80
ServerStatusParams should consider 'prime caches' in quiescent status
Wilfred Aug 13, 2024
df6ce96
Auto merge of #17886 - Wilfred:prime_caches_quiescent, r=Veykril
bors Aug 19, 2024
a7d15a8
fix: Fix panics for semantic highlighting at startup
Veykril Aug 20, 2024
a9e3555
Auto merge of #17932 - Veykril:default-reply-lat-sensitive, r=Veykril
bors Aug 20, 2024
a42c732
Define workspace level configs.
alibektas Aug 16, 2024
8e31598
Next up : generating configs for workspace level configs
alibektas Aug 16, 2024
1b2eaa5
Old configs are back
alibektas Aug 17, 2024
085aac3
Auto merge of #17930 - Veykril:config-user-config, r=alibektas
bors Aug 20, 2024
9cb66c2
Auto merge of #17913 - alibektas:ratoml_improvements, r=alibektas
bors Aug 20, 2024
94f206a
Run flycheck only on crate if target is binary.
alibektas Aug 20, 2024
3f89eeb
internal: Implement `module_path` macro
Veykril Aug 21, 2024
db2e8e1
fix: Wrong `Sized` predicate for `generic_predicates_for_param`
ShoyuVanilla Aug 21, 2024
614fb24
Auto merge of #17939 - ShoyuVanilla:maybe-sized-fix, r=Veykril
bors Aug 22, 2024
f845536
Remove DescendPreference::SameText
Veykril Aug 22, 2024
d893dcc
Drop MacroInputKind
Veykril Aug 22, 2024
aeb9c7b
Implement floating point casts in const eval
HKalbasi Aug 22, 2024
1179cbb
Remove DescendPreference::SameKind
Veykril Aug 22, 2024
8e82e44
Fully remove old macro descension API
Veykril Aug 22, 2024
4d61444
Rename macro descension functions
Veykril Aug 22, 2024
d79999a
Thread file id through descension API for semantic highlighting
Veykril Aug 22, 2024
b0e7ef4
Sort hover results by relevance
Veykril Aug 22, 2024
f9db48f
Consider interleaving hover kinds
Veykril Aug 22, 2024
06228b9
Auto merge of #17942 - HKalbasi:fp-const-eval, r=HKalbasi
bors Aug 22, 2024
71c7cea
Fix sorting order for tokens in hover
Veykril Aug 22, 2024
81a9956
Auto merge of #17898 - Veykril:descend-2.0, r=Veykril
bors Aug 22, 2024
0a27711
Improve proc-macro panic message and workspace loading failure diagno…
Veykril Aug 22, 2024
1b0e158
Auto merge of #17943 - Veykril:diags, r=Veykril
bors Aug 22, 2024
f65d605
When descending into macros in search, first check if there is a need…
ChayimFriedman2 Aug 16, 2024
a57def2
Speed up search for short associated functions, especially very commo…
ChayimFriedman2 Aug 18, 2024
a44152a
Add cov_marks to test #17927
ChayimFriedman2 Aug 22, 2024
0251cfa
Apply changes
alibektas Aug 22, 2024
b88a4f0
Auto merge of #17912 - alibektas:cargo_check_on_binary, r=Veykril
bors Aug 23, 2024
916c559
Remove incorrect FIXME comment
Veykril Aug 23, 2024
39cc5b6
Auto merge of #17927 - ChayimFriedman2:speedup-new-usages, r=Veykril
bors Aug 23, 2024
ac912c7
Auto merge of #17936 - Veykril:module_path, r=Veykril
bors Aug 23, 2024
5f7489a
internal: Don't requery crates_for for flycheck when crates are known
Veykril Aug 23, 2024
e030cf0
Auto merge of #17946 - Veykril:flycheck-crates-for, r=Veykril
bors Aug 23, 2024
3a097e1
Auto merge of #17857 - ChayimFriedman2:rust-project-cfg-group, r=Veykril
bors Aug 23, 2024
eb896a5
fix: Wrong `Self: Sized` predicate for trait assoc items
ShoyuVanilla Aug 23, 2024
3bd42d3
Auto merge of #17948 - ShoyuVanilla:parent-self-sized, r=Veykril
bors Aug 23, 2024
bdbc057
Include buildfile path in watcher list
Wilfred Aug 23, 2024
a074e1a
Auto merge of #17949 - Wilfred:include_build_file_in_watchers, r=lnicola
bors Aug 24, 2024
12faedd
Fix few bugs in closure capture computation, and add tests
ChayimFriedman2 Aug 24, 2024
77ab568
Preserve all spans for closure captures, not just one
ChayimFriedman2 Aug 24, 2024
cf243e5
Add `gen` modifier to functions
ChayimFriedman2 Aug 22, 2024
1e0df17
Handle associated types that are lang items
ChayimFriedman2 Aug 22, 2024
2c6a521
Provide `Future::Output` and `Iterator` lang items
ChayimFriedman2 Aug 22, 2024
737a969
Add helper methods to retrieve `Future::Output` and `Iterator::Item`
ChayimFriedman2 Aug 22, 2024
7339337
Modify `hacks::parse_expr_from_str()` to take an edition too
ChayimFriedman2 Aug 22, 2024
6340522
Provide `impl From<ast::TypeOrConstParam> for ast::GenericParam`
ChayimFriedman2 Aug 22, 2024
becfc5a
Impl PartialEq and Eq for `IndentLevel`
ChayimFriedman2 Aug 22, 2024
42a901a
Don't use TyKind in lint
compiler-errors Aug 24, 2024
af05882
Deny wasm_c_abi lint to nudge the last 25%
workingjubilee Aug 24, 2024
7bd3ca1
Don't enable the search fast path for short associated functions when…
ChayimFriedman2 Aug 25, 2024
cba00a8
Auto merge of #17955 - ChayimFriedman2:fix-fast-search-with-scope, r=…
bors Aug 25, 2024
d9d8d94
fix: Fix metadata retrying eating original errors
Veykril Aug 25, 2024
c223013
Auto merge of #17956 - Veykril:metadata-err, r=Veykril
bors Aug 25, 2024
606401f
fix: Fix trait method completions not acknowledging Deref impls
Veykril Aug 25, 2024
bdee5c9
Auto merge of #17958 - Veykril:deref-chain-method-completions, r=Veykril
bors Aug 25, 2024
2703ea1
fix: add extra_test_bin_args to test explorer test runner
Aug 25, 2024
98e23d3
internal: Don't allocate autoderef steps when not needed
Veykril Aug 25, 2024
31a532a
Auto merge of #17961 - Veykril:autoderef-alloc, r=Veykril
bors Aug 25, 2024
e0b1719
Auto merge of #17960 - duncanawoods:master, r=HKalbasi
bors Aug 25, 2024
326a1c6
Fix Return Type Syntax to include `..` (i.e. `method(..)` and not `me…
ChayimFriedman2 Aug 25, 2024
a3f1196
Auto merge of #17962 - ChayimFriedman2:update-rtn, r=Veykril
bors Aug 26, 2024
239dc5d
Auto merge of #17941 - ChayimFriedman2:pre-closure-to-fn, r=Veykril
bors Aug 26, 2024
9dad25a
Show and render error lifetime args as `'_`
avrong Aug 26, 2024
9d4fdc0
Show lifetime args if there are only error ones
avrong Aug 26, 2024
05e6fb6
Auto merge of #17963 - avrong:avrong/error-lifetimes, r=Veykril
bors Aug 26, 2024
65e9f8b
Fix "Unwrap block" assist with block modifiers
ChayimFriedman2 Aug 26, 2024
c61f85b
Don't make pattern nonterminals match statement nonterminals
compiler-errors Jan 22, 2024
0763a3a
Bump backtrace to rust-lang/backtrace@fc37b22
workingjubilee Aug 27, 2024
65d25fe
Revert "feat: Implement `module_path` macro"
Veykril Aug 27, 2024
f0bfd43
Auto merge of #17972 - rust-lang:revert-17936-module_path, r=Veykril
bors Aug 27, 2024
6593688
Auto merge of #17970 - ChayimFriedman2:unwrap-unsafe-block, r=Veykril
bors Aug 27, 2024
df4580b
Expand proc-macros in workspace root, not package root
Veykril Aug 27, 2024
b592256
Drop Apache license appendices
lnicola Aug 27, 2024
e4c404e
Auto merge of #17973 - Veykril:proc-macro-curr-dir, r=Veykril
bors Aug 27, 2024
2dce250
Auto merge of #17974 - lnicola:rm-apache-appendix, r=lnicola
bors Aug 27, 2024
c9a3b02
Fix tests
Veykril Aug 27, 2024
199c01d
Auto merge of #17757 - alibektas:toggle_macro_delimiters, r=Veykril
bors Aug 27, 2024
34e50f5
Create an assist to convert closure to freestanding fn
ChayimFriedman2 Aug 22, 2024
a1c36c6
linker: Synchronize native library search in rustc and linker
petrochenkov Aug 14, 2024
05bd36d
linker: Better support alternative static library naming on MSVC
petrochenkov Aug 21, 2024
ac8f132
docs: Update docs for the rustc's `-L` option
petrochenkov Aug 27, 2024
6c54ab0
Ban non-array SIMD
scottmcm Aug 22, 2024
076dcaa
Fix the examples in cg_clif
scottmcm Aug 23, 2024
b0ac14d
Update the MIRI tests
scottmcm Aug 23, 2024
51055f7
Fix cwd used for proc macro expansion
lnicola Aug 28, 2024
248a557
Auto merge of #17981 - lnicola:proc-macro-cwd, r=Veykril
bors Aug 28, 2024
ee05de8
Re-enable android tests/benches in alloc
saethlin Aug 27, 2024
83de14c
Enable some ilog2 tests as well
saethlin Aug 27, 2024
1eb4cb4
Separate core search logic with search ui
Folyd Jun 9, 2024
ae6f8a7
allow BufReader::peek to be called on unsized types
Aug 28, 2024
4880eee
Fix name resolution of shadowed builtin macro
ChayimFriedman2 Aug 28, 2024
2a7ec0b
Consider all expressions that autoderef in "Extract variable", not ju…
ChayimFriedman2 Aug 28, 2024
fe5f91e
Don't add reference when it isn't needed for the "Extract variable" a…
ChayimFriedman2 Aug 28, 2024
5aefe78
internal: Avoid newlines in fetch workspace errors
Wilfred Aug 28, 2024
3ff3d39
Also handle deref expressions in "Extract variable"
ChayimFriedman2 Aug 28, 2024
b3fcd8e
Consider field attributes when converting from tuple to named struct …
ChayimFriedman2 Aug 28, 2024
c2c1bd0
Fix incorrect symbol definitions in SCIP output
darichey Aug 28, 2024
9200452
Stop using ty::GenericPredicates for non-predicates_of queries
compiler-errors Aug 29, 2024
3a14e30
Auto merge of #17992 - Wilfred:newlines_in_logs, r=Veykril
bors Aug 29, 2024
14ec120
fix: Fix proc-macro server crashing when parsing a non-lexable string…
Veykril Aug 29, 2024
03d6745
fix: Fix TokenStream::to_string implementation dropping quotation marks
Veykril Aug 29, 2024
266bb1f
Auto merge of #17994 - Veykril:proc-macro-srv-from-str-panic, r=Veykril
bors Aug 29, 2024
2ec71c8
Preparing for merge from rust-lang/rust
lnicola Aug 29, 2024
26888c3
Merge from rust-lang/rust
lnicola Aug 29, 2024
f05888d
Auto merge of #17995 - lnicola:sync-from-rust, r=lnicola
bors Aug 29, 2024
b195ff3
Auto merge of #17940 - ChayimFriedman2:closure-to-fn, r=Veykril
bors Aug 29, 2024
e20a888
Allow running `./x.py test compiler`
Veykril Aug 29, 2024
e0625d5
Auto merge of #17988 - darichey:fix-scip-def, r=Veykril
bors Aug 29, 2024
b6d0fd0
Auto merge of #17987 - ChayimFriedman2:column-macro, r=Veykril
bors Aug 29, 2024
cd377d9
Auto merge of #17991 - ChayimFriedman2:extract-variable-ref, r=Veykril
bors Aug 29, 2024
34e7e79
Auto merge of #17993 - ChayimFriedman2:convert-to-tuple-attrs, r=Veykril
bors Aug 29, 2024
de34a91
interpret/visitor: make memory order iteration slightly more efficient
RalfJung Aug 29, 2024
8c798c8
Simplify some extern providers
compiler-errors Aug 29, 2024
c824c1a
wasi: Fix sleeping for `Duration::MAX`
alexcrichton Aug 29, 2024
518b41c
Try latest backtrace
workingjubilee Aug 29, 2024
fa4f892
Remove `Option<!>` return types.
nnethercote Aug 29, 2024
08c6dce
Rollup merge of #120221 - compiler-errors:statements-are-not-patterns…
matthiaskrgr Aug 31, 2024
6c6f02c
Rollup merge of #126183 - Folyd:search-core, r=GuillaumeGomez,notriddle
matthiaskrgr Aug 31, 2024
e8f19ac
Rollup merge of #129123 - aDotInTheVoid:rustdoc-json-self, r=fmease
matthiaskrgr Aug 31, 2024
0e172db
Rollup merge of #129366 - petrochenkov:libsearch, r=jieyouxu
matthiaskrgr Aug 31, 2024
53c5840
Rollup merge of #129403 - scottmcm:only-array-simd, r=compiler-errors
matthiaskrgr Aug 31, 2024
f0304a8
Rollup merge of #129527 - compiler-errors:lint-nit, r=Nadrieril
matthiaskrgr Aug 31, 2024
16ca800
Rollup merge of #129534 - workingjubilee:ratchet-wasm-c-abi-fcw-to-de…
matthiaskrgr Aug 31, 2024
83d3ba5
Rollup merge of #129640 - saethlin:unignore-android-in-alloc, r=tgross35
matthiaskrgr Aug 31, 2024
338402d
Rollup merge of #129642 - workingjubilee:bump-backtrace-fc37b22, r=wo…
matthiaskrgr Aug 31, 2024
a12c8d0
Rollup merge of #129675 - lolbinarycat:bufreader_peek_unsized, r=work…
matthiaskrgr Aug 31, 2024
a957c31
Rollup merge of #129723 - compiler-errors:extern-providers, r=lcnr
matthiaskrgr Aug 31, 2024
15b29f1
Rollup merge of #129724 - nnethercote:rm-Option-bang, r=fee1-dead
matthiaskrgr Aug 31, 2024
f2ce78a
Rollup merge of #129725 - compiler-errors:predicates-of, r=fmease
matthiaskrgr Aug 31, 2024
ad069af
Rollup merge of #129731 - ferrocene:x-test-compiler, r=onur-ozkan
matthiaskrgr Aug 31, 2024
7b918eb
Rollup merge of #129733 - lnicola:sync-from-ra, r=lnicola
matthiaskrgr Aug 31, 2024
0820d00
Rollup merge of #129751 - RalfJung:interpret-visit-field-order, r=com…
matthiaskrgr Aug 31, 2024
af48e31
Rollup merge of #129754 - alexcrichton:fix-wasi-long-sleep, r=working…
matthiaskrgr Aug 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
57 changes: 36 additions & 21 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ impl Token {
}

/// Returns `true` if the token can appear at the start of an expression.
///
/// **NB**: Take care when modifying this function, since it will change
/// the stable set of tokens that are allowed to match an expr nonterminal.
pub fn can_begin_expr(&self) -> bool {
match self.uninterpolate().kind {
Ident(name, is_raw) =>
Expand All @@ -504,34 +507,46 @@ impl Token {
PathSep | // global path
Lifetime(..) | // labeled loop
Pound => true, // expression attributes
Interpolated(ref nt) => matches!(&**nt, NtLiteral(..) |
NtExpr(..) |
NtBlock(..) |
NtPath(..)),
Interpolated(ref nt) =>
matches!(&**nt,
NtBlock(..) |
NtExpr(..) |
NtLiteral(..) |
NtPath(..)
),
_ => false,
}
}

/// Returns `true` if the token can appear at the start of a pattern.
///
/// Shamelessly borrowed from `can_begin_expr`, only used for diagnostics right now.
pub fn can_begin_pattern(&self) -> bool {
match self.uninterpolate().kind {
Ident(name, is_raw) =>
ident_can_begin_expr(name, self.span, is_raw), // value name or keyword
| OpenDelim(Delimiter::Bracket | Delimiter::Parenthesis) // tuple or array
| Literal(..) // literal
| BinOp(Minus) // unary minus
| BinOp(And) // reference
| AndAnd // double reference
// DotDotDot is no longer supported
| DotDot | DotDotDot | DotDotEq // ranges
| Lt | BinOp(Shl) // associated path
| PathSep => true, // global path
Interpolated(ref nt) => matches!(&**nt, NtLiteral(..) |
NtPat(..) |
NtBlock(..) |
NtPath(..)),
pub fn can_begin_pattern(&self, pat_kind: NtPatKind) -> bool {
match &self.uninterpolate().kind {
// box, ref, mut, and other identifiers (can stricten)
Ident(..) | NtIdent(..) |
OpenDelim(Delimiter::Parenthesis) | // tuple pattern
OpenDelim(Delimiter::Bracket) | // slice pattern
BinOp(And) | // reference
BinOp(Minus) | // negative literal
AndAnd | // double reference
Literal(_) | // literal
DotDot | // range pattern (future compat)
DotDotDot | // range pattern (future compat)
PathSep | // path
Lt | // path (UFCS constant)
BinOp(Shl) => true, // path (double UFCS)
// leading vert `|` or-pattern
BinOp(Or) => matches!(pat_kind, PatWithOr),
Interpolated(nt) =>
matches!(&**nt,
| NtExpr(..)
| NtLiteral(..)
| NtMeta(..)
| NtPat(..)
| NtPath(..)
| NtTy(..)
),
_ => false,
}
}
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

#[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)]
struct f32x4(pub f32, pub f32, pub f32, pub f32);
struct f32x4(pub [f32; 4]);

use std::intrinsics::simd::*;

fn main() {
let x = f32x4(1.0, 2.0, 3.0, 4.0);
let y = f32x4(2.0, 1.0, 4.0, 3.0);
let x = f32x4([1.0, 2.0, 3.0, 4.0]);
let y = f32x4([2.0, 1.0, 4.0, 3.0]);

#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
let nan = f32::NAN;
Expand All @@ -24,13 +24,13 @@ fn main() {
#[cfg(any(target_arch = "mips", target_arch = "mips64"))]
let nan = f32::from_bits(f32::NAN.to_bits() - 1);

let n = f32x4(nan, nan, nan, nan);
let n = f32x4([nan, nan, nan, nan]);

unsafe {
let min0 = simd_fmin(x, y);
let min1 = simd_fmin(y, x);
assert_eq!(min0, min1);
let e = f32x4(1.0, 1.0, 3.0, 3.0);
let e = f32x4([1.0, 1.0, 3.0, 3.0]);
assert_eq!(min0, e);
let minn = simd_fmin(x, n);
assert_eq!(minn, x);
Expand All @@ -40,7 +40,7 @@ fn main() {
let max0 = simd_fmax(x, y);
let max1 = simd_fmax(y, x);
assert_eq!(max0, max1);
let e = f32x4(2.0, 2.0, 4.0, 4.0);
let e = f32x4([2.0, 2.0, 4.0, 4.0]);
assert_eq!(max0, e);
let maxn = simd_fmax(x, n);
assert_eq!(maxn, x);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_cranelift/example/std_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn main() {
enum Never {}
}

foo(I64X2(0, 0));
foo(I64X2([0, 0]));

transmute_fat_pointer();

Expand Down Expand Up @@ -204,7 +204,7 @@ fn rust_call_abi() {
}

#[repr(simd)]
struct I64X2(i64, i64);
struct I64X2([i64; 2]);

#[allow(improper_ctypes_definitions)]
extern "C" fn foo(_a: I64X2) {}
Expand Down
61 changes: 15 additions & 46 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::BTreeSet;
use std::ffi::OsString;
use std::fs::{read, File, OpenOptions};
use std::io::{BufWriter, Write};
use std::ops::Deref;
use std::ops::{ControlFlow, Deref};
use std::path::{Path, PathBuf};
use std::process::{ExitStatus, Output, Stdio};
use std::{env, fmt, fs, io, mem, str};
Expand All @@ -18,8 +18,8 @@ use rustc_data_structures::temp_dir::MaybeTempDir;
use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, FatalError};
use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc_metadata::find_native_static_library;
use rustc_metadata::fs::{copy_to_stdout, emit_wrapper_file, METADATA_FILENAME};
use rustc_metadata::{find_native_static_library, walk_native_lib_search_dirs};
use rustc_middle::bug;
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
use rustc_middle::middle::dependency_format::Linkage;
Expand Down Expand Up @@ -2110,50 +2110,19 @@ fn add_library_search_dirs(
return;
}

// Library search paths explicitly supplied by user (`-L` on the command line).
for search_path in sess.target_filesearch(PathKind::Native).cli_search_paths() {
cmd.include_path(&fix_windows_verbatim_for_gcc(&search_path.dir));
}
for search_path in sess.target_filesearch(PathKind::Framework).cli_search_paths() {
// Contrary to the `-L` docs only framework-specific paths are considered here.
if search_path.kind != PathKind::All {
cmd.framework_path(&search_path.dir);
}
}

// The toolchain ships some native library components and self-contained linking was enabled.
// Add the self-contained library directory to search paths.
if self_contained_components.intersects(
LinkSelfContainedComponents::LIBC
| LinkSelfContainedComponents::UNWIND
| LinkSelfContainedComponents::MINGW,
) {
let lib_path = sess.target_tlib_path.dir.join("self-contained");
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
}

// Toolchains for some targets may ship `libunwind.a`, but place it into the main sysroot
// library directory instead of the self-contained directories.
// Sanitizer libraries have the same issue and are also linked by name on Apple targets.
// The targets here should be in sync with `copy_third_party_objects` in bootstrap.
// FIXME: implement `-Clink-self-contained=+/-unwind,+/-sanitizers`, move the shipped libunwind
// and sanitizers to self-contained directory, and stop adding this search path.
if sess.target.vendor == "fortanix"
|| sess.target.os == "linux"
|| sess.target.os == "fuchsia"
|| sess.target.is_like_osx && !sess.opts.unstable_opts.sanitizer.is_empty()
{
cmd.include_path(&fix_windows_verbatim_for_gcc(&sess.target_tlib_path.dir));
}

// Mac Catalyst uses the macOS SDK, but to link to iOS-specific frameworks
// we must have the support library stubs in the library search path (#121430).
if let Some(sdk_root) = apple_sdk_root
&& sess.target.llvm_target.contains("macabi")
{
cmd.include_path(&sdk_root.join("System/iOSSupport/usr/lib"));
cmd.framework_path(&sdk_root.join("System/iOSSupport/System/Library/Frameworks"));
}
walk_native_lib_search_dirs(
sess,
self_contained_components,
apple_sdk_root,
|dir, is_framework| {
if is_framework {
cmd.framework_path(dir);
} else {
cmd.include_path(&fix_windows_verbatim_for_gcc(dir));
}
ControlFlow::<()>::Continue(())
},
);
}

/// Add options making relocation sections in the produced ELF files read-only
Expand Down
14 changes: 10 additions & 4 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{env, iter, mem, str};

use cc::windows_registry;
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc_metadata::find_native_static_library;
use rustc_metadata::{find_native_static_library, try_find_native_static_library};
use rustc_middle::bug;
use rustc_middle::middle::dependency_format::Linkage;
use rustc_middle::middle::exported_symbols;
Expand Down Expand Up @@ -891,9 +891,15 @@ impl<'a> Linker for MsvcLinker<'a> {
}

fn link_staticlib_by_name(&mut self, name: &str, verbatim: bool, whole_archive: bool) {
let prefix = if whole_archive { "/WHOLEARCHIVE:" } else { "" };
let suffix = if verbatim { "" } else { ".lib" };
self.link_arg(format!("{prefix}{name}{suffix}"));
// On MSVC-like targets rustc supports static libraries using alternative naming
// scheme (`libfoo.a`) unsupported by linker, search for such libraries manually.
if let Some(path) = try_find_native_static_library(self.sess, name, verbatim) {
self.link_staticlib_by_path(&path, whole_archive);
} else {
let prefix = if whole_archive { "/WHOLEARCHIVE:" } else { "" };
let suffix = if verbatim { "" } else { ".lib" };
self.link_arg(format!("{prefix}{name}{suffix}"));
}
}

fn link_staticlib_by_path(&mut self, path: &Path, whole_archive: bool) {
Expand Down
19 changes: 10 additions & 9 deletions compiler/rustc_const_eval/src/interpret/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ pub trait ValueVisitor<'tcx, M: Machine<'tcx>>: Sized {
}

/// This function provides the chance to reorder the order in which fields are visited for
/// `FieldsShape::Aggregate`: The order of fields will be
/// `(0..num_fields).map(aggregate_field_order)`.
/// `FieldsShape::Aggregate`.
///
/// The default means we iterate in source declaration order; alternative this can do an inverse
/// lookup in `memory_index` to use memory field order instead.
/// The default means we iterate in source declaration order; alternatively this can do some
/// work with `memory_index` to iterate in memory order.
#[inline(always)]
fn aggregate_field_order(_memory_index: &IndexVec<FieldIdx, u32>, idx: usize) -> usize {
idx
fn aggregate_field_iter(
memory_index: &IndexVec<FieldIdx, u32>,
) -> impl Iterator<Item = FieldIdx> + 'static {
memory_index.indices()
}

// Recursive actions, ready to be overloaded.
Expand Down Expand Up @@ -172,9 +173,9 @@ pub trait ValueVisitor<'tcx, M: Machine<'tcx>>: Sized {
&FieldsShape::Union(fields) => {
self.visit_union(v, fields)?;
}
FieldsShape::Arbitrary { offsets, memory_index } => {
for idx in 0..offsets.len() {
let idx = Self::aggregate_field_order(memory_index, idx);
FieldsShape::Arbitrary { memory_index, .. } => {
for idx in Self::aggregate_field_iter(memory_index) {
let idx = idx.as_usize();
let field = self.ecx().project_field(v, idx)?;
self.visit_field(v, idx, &field)?;
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0074.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This will cause an error:
#![feature(repr_simd)]

#[repr(simd)]
struct Bad<T>(T, T, T, T);
struct Bad<T>([T; 4]);
```

This will not:
Expand All @@ -20,5 +20,5 @@ This will not:
#![feature(repr_simd)]

#[repr(simd)]
struct Good(u32, u32, u32, u32);
struct Good([u32; 4]);
```
18 changes: 12 additions & 6 deletions compiler/rustc_error_codes/src/error_codes/E0075.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
A `#[simd]` attribute was applied to an empty tuple struct.
A `#[simd]` attribute was applied to an empty or multi-field struct.

Erroneous code example:
Erroneous code examples:

```compile_fail,E0075
#![feature(repr_simd)]
Expand All @@ -9,15 +9,21 @@ Erroneous code example:
struct Bad; // error!
```

The `#[simd]` attribute can only be applied to non empty tuple structs, because
it doesn't make sense to try to use SIMD operations when there are no values to
operate on.
```compile_fail,E0075
#![feature(repr_simd)]

#[repr(simd)]
struct Bad([u32; 1], [u32; 1]); // error!
```

The `#[simd]` attribute can only be applied to a single-field struct, because
the one field must be the array of values in the vector.

Fixed example:

```
#![feature(repr_simd)]

#[repr(simd)]
struct Good(u32); // ok!
struct Good([u32; 2]); // ok!
```
10 changes: 5 additions & 5 deletions compiler/rustc_error_codes/src/error_codes/E0076.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
All types in a tuple struct aren't the same when using the `#[simd]`
The type of the field in a tuple struct isn't an array when using the `#[simd]`
attribute.

Erroneous code example:
Expand All @@ -7,18 +7,18 @@ Erroneous code example:
#![feature(repr_simd)]
#[repr(simd)]
struct Bad(u16, u32, u32 u32); // error!
struct Bad(u16); // error!
```

When using the `#[simd]` attribute to automatically use SIMD operations in tuple
struct, the types in the struct must all be of the same type, or the compiler
will trigger this error.
structs, if you want a single-lane vector then the field must be a 1-element
array, or the compiler will trigger this error.

Fixed example:

```
#![feature(repr_simd)]
#[repr(simd)]
struct Good(u32, u32, u32, u32); // ok!
struct Good([u16; 1]); // ok!
```
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0077.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Erroneous code example:
#![feature(repr_simd)]

#[repr(simd)]
struct Bad(String); // error!
struct Bad([String; 2]); // error!
```

When using the `#[simd]` attribute on a tuple struct, the elements in the tuple
Expand All @@ -19,5 +19,5 @@ Fixed example:
#![feature(repr_simd)]

#[repr(simd)]
struct Good(u32, u32, u32, u32); // ok!
struct Good([u32; 4]); // ok!
```
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0511.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ The generic type has to be a SIMD type. Example:

#[repr(simd)]
#[derive(Copy, Clone)]
struct i32x2(i32, i32);
struct i32x2([i32; 2]);

extern "rust-intrinsic" {
fn simd_add<T>(a: T, b: T) -> T;
}

unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
unsafe { simd_add(i32x2([0, 0]), i32x2([1, 2])); } // ok!
```
Loading
Loading