Skip to content

Commit

Permalink
Auto merge of rust-lang#3141 - rust-lang:rustup-2023-10-25, r=RalfJung
Browse files Browse the repository at this point in the history
Automatic Rustup
  • Loading branch information
bors committed Oct 25, 2023
2 parents 9c793e1 + 19c4fa6 commit 51ae1fe
Show file tree
Hide file tree
Showing 215 changed files with 3,155 additions and 1,410 deletions.
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4525,6 +4525,7 @@ dependencies = [
"rustc_middle",
"rustc_span",
"rustc_target",
"scoped-tls",
"stable_mir",
"tracing",
]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_attr/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ attr_invalid_repr_hint_no_paren =
attr_invalid_repr_hint_no_value =
invalid representation hint: `{$name}` does not take a value
attr_invalid_since =
'since' must be a Rust version number, such as "1.31.0"
attr_missing_feature =
missing 'feature'
Expand Down
64 changes: 36 additions & 28 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use rustc_ast::{self as ast, attr};
use rustc_ast::{Attribute, LitKind, MetaItem, MetaItemKind, MetaItemLit, NestedMetaItem, NodeId};
use rustc_ast_pretty::pprust;
use rustc_errors::ErrorGuaranteed;
use rustc_feature::{find_gated_cfg, is_builtin_attr_name, Features, GatedCfg};
use rustc_macros::HashStable_Generic;
use rustc_session::config::ExpectedValues;
Expand Down Expand Up @@ -361,25 +362,32 @@ fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabilit
}
}

if let Some(s) = since
&& s.as_str() == VERSION_PLACEHOLDER
{
since = Some(rust_version_symbol());
}
let feature = match feature {
Some(feature) if rustc_lexer::is_ident(feature.as_str()) => Ok(feature),
Some(_bad_feature) => {
Err(sess.emit_err(session_diagnostics::NonIdentFeature { span: attr.span }))
}
None => Err(sess.emit_err(session_diagnostics::MissingFeature { span: attr.span })),
};

let since = if let Some(since) = since {
if since.as_str() == VERSION_PLACEHOLDER {
Ok(rust_version_symbol())
} else if parse_version(since.as_str(), false).is_some() {
Ok(since)
} else {
Err(sess.emit_err(session_diagnostics::InvalidSince { span: attr.span }))
}
} else {
Err(sess.emit_err(session_diagnostics::MissingSince { span: attr.span }))
};

match (feature, since) {
(Some(feature), Some(since)) => {
(Ok(feature), Ok(since)) => {
let level = StabilityLevel::Stable { since, allowed_through_unstable_modules: false };
Some((feature, level))
}
(None, _) => {
sess.emit_err(session_diagnostics::MissingFeature { span: attr.span });
None
}
_ => {
sess.emit_err(session_diagnostics::MissingSince { span: attr.span });
None
}
(Err(ErrorGuaranteed { .. }), _) | (_, Err(ErrorGuaranteed { .. })) => None,
}
}

Expand Down Expand Up @@ -451,12 +459,19 @@ fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabil
}
}

match (feature, reason, issue) {
(Some(feature), reason, Some(_)) => {
if !rustc_lexer::is_ident(feature.as_str()) {
sess.emit_err(session_diagnostics::NonIdentFeature { span: attr.span });
return None;
}
let feature = match feature {
Some(feature) if rustc_lexer::is_ident(feature.as_str()) => Ok(feature),
Some(_bad_feature) => {
Err(sess.emit_err(session_diagnostics::NonIdentFeature { span: attr.span }))
}
None => Err(sess.emit_err(session_diagnostics::MissingFeature { span: attr.span })),
};

let issue =
issue.ok_or_else(|| sess.emit_err(session_diagnostics::MissingIssue { span: attr.span }));

match (feature, issue) {
(Ok(feature), Ok(_)) => {
let level = StabilityLevel::Unstable {
reason: UnstableReason::from_opt_reason(reason),
issue: issue_num,
Expand All @@ -465,14 +480,7 @@ fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabil
};
Some((feature, level))
}
(None, _, _) => {
sess.emit_err(session_diagnostics::MissingFeature { span: attr.span });
return None;
}
_ => {
sess.emit_err(session_diagnostics::MissingIssue { span: attr.span });
return None;
}
(Err(ErrorGuaranteed { .. }), _) | (_, Err(ErrorGuaranteed { .. })) => None,
}
}

Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_attr/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@ pub(crate) struct ExpectsFeatures {
pub name: String,
}

#[derive(Diagnostic)]
#[diag(attr_invalid_since)]
pub(crate) struct InvalidSince {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(attr_soft_no_args)]
pub(crate) struct SoftNoArgs {
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_borrowck/src/renumber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ impl<'a, 'tcx> MutVisitor<'tcx> for RegionRenumberer<'a, 'tcx> {

#[instrument(skip(self), level = "debug")]
fn visit_ty(&mut self, ty: &mut Ty<'tcx>, ty_context: TyContext) {
if matches!(ty_context, TyContext::ReturnTy(_)) {
// We will renumber the return ty when called again with `TyContext::LocalDecl`
return;
}
*ty = self.renumber_regions(*ty, || RegionCtxt::TyContext(ty_context));

debug!(?ty);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
]
},
{
"sysroot_src": "./download/sysroot/sysroot_src/library",
"sysroot_src": "./build/stdlib/library",
"crates": [
{
"root_module": "./example/std_example.rs",
Expand Down
52 changes: 26 additions & 26 deletions compiler/rustc_codegen_cranelift/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "cranelift-bforest"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5e1df0da8488dd03b34afc134ba84b754d61862cc465932a9e5d07952f661e"
checksum = "c1512c3bb6b13018e7109fc3ac964bc87b329eaf3a77825d337558d0c7f6f1be"
dependencies = [
"cranelift-entity",
]

[[package]]
name = "cranelift-codegen"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a17ca4e699a0aaf49a0c88f6311a864f321048aa63f6b787cab20eb5f93f10"
checksum = "16cb8fb9220a6ea7a226705a273ab905309ee546267bdf34948d57932d7f0396"
dependencies = [
"bumpalo",
"cranelift-bforest",
Expand All @@ -75,39 +75,39 @@ dependencies = [

[[package]]
name = "cranelift-codegen-meta"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "022f2793cdade1d37a1f755ac42938a3f832f533eac6cafc8b26b209544c3c06"
checksum = "ab3a8d3b0d4745b183da5ea0792b13d79f5c23d6e69ac04761728e2532b56649"
dependencies = [
"cranelift-codegen-shared",
]

[[package]]
name = "cranelift-codegen-shared"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4d72dbb83c2ad788dec4ad0843070973cb48c35a3ca19b1e7437ac40834fd9c"
checksum = "524141c8e68f2abc2043de4c2b31f6d9dd42432738c246431d0572a1422a4a84"

[[package]]
name = "cranelift-control"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae07cf26dcc90d546826d747ac63b6c40c916f34b03e92a6ae0422c28d771b8a"
checksum = "97513b57c961c713789a03886a57b43e14ebcd204cbaa8ae50ca6c70a8e716b3"
dependencies = [
"arbitrary",
]

[[package]]
name = "cranelift-entity"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2fe6b7e49820893691aea497f36257e9d6f52061d8c4758d61d802d5f101a3d"
checksum = "e3f23d3cf3afa7e45f239702612c76d87964f652a55e28d13ed6d7e20f3479dd"

[[package]]
name = "cranelift-frontend"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44f497576ca3674581581601b6a55ccc1b43447217648c880e5bce70db3cf659"
checksum = "554cd4947ec9209b58bf9ae5bf83581b5ddf9128bd967208e334b504a57db54e"
dependencies = [
"cranelift-codegen",
"log",
Expand All @@ -117,15 +117,15 @@ dependencies = [

[[package]]
name = "cranelift-isle"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b96aa02eac00fffee13b0cd37d17874ccdb3d5458983041accd825ef78ce6454"
checksum = "6c1892a439696b6413cb54083806f5fd9fc431768b8de74864b3d9e8b93b124f"

[[package]]
name = "cranelift-jit"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1d6e0e308c873eefc185745a6b21daec2a10f7554c9fb67e334c2d7d756d979"
checksum = "32209252fb38acaf1662ccd0397907bbe0e92bdb13b6ddbfd2f74e437f83e685"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -143,9 +143,9 @@ dependencies = [

[[package]]
name = "cranelift-module"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1aa8ebb06eced4e478c3f94f1d65d4e7c93493f4640057912b27a3e34b84841"
checksum = "bf42656f5f6df7bfafc4dd7b63a1888b0627c07b43b2cb9aa54e13843fed39eb"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -154,9 +154,9 @@ dependencies = [

[[package]]
name = "cranelift-native"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2870170ca44054b202c737626607b87be6e35655084bd94a6ff807a5812ba7df"
checksum = "e0c2d3badd4b9690865f5bb68a71fa94de592fa2df3f3d11a5a062c60c0a107a"
dependencies = [
"cranelift-codegen",
"libc",
Expand All @@ -165,9 +165,9 @@ dependencies = [

[[package]]
name = "cranelift-object"
version = "0.101.0"
version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20647761742d17dabac8205da958910ede78599550e06418a16711a3ee2fc897"
checksum = "88eca54bbecea3170035168357306e9c779d4a63d8bf036c9e16bd21fdaa69b5"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand Down Expand Up @@ -374,9 +374,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"

[[package]]
name = "wasmtime-jit-icache-coherence"
version = "14.0.0"
version = "14.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3a5dda53ad6993f9b0a2d65fb49e0348a7232a27a8794064122870d6ee19eb2"
checksum = "9aaf2fa8fd2d6b65abae9b92edfe69254cc5d6b166e342364036c3e347de8da9"
dependencies = [
"cfg-if",
"libc",
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ crate-type = ["dylib"]

[dependencies]
# These have to be in sync with each other
cranelift-codegen = { version = "0.101", features = ["unwind", "all-arch"] }
cranelift-frontend = { version = "0.101" }
cranelift-module = { version = "0.101" }
cranelift-native = { version = "0.101" }
cranelift-jit = { version = "0.101", optional = true }
cranelift-object = { version = "0.101" }
cranelift-codegen = { version = "0.101.1", features = ["unwind", "all-arch"] }
cranelift-frontend = { version = "0.101.1" }
cranelift-module = { version = "0.101.1" }
cranelift-native = { version = "0.101.1" }
cranelift-jit = { version = "0.101.1", optional = true }
cranelift-object = { version = "0.101.1" }
target-lexicon = "0.12.0"
gimli = { version = "0.28", default-features = false, features = ["write"]}
object = { version = "0.32", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_cranelift/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If not please open an issue.
## Building and testing

```bash
$ git clone https://github.com/bjorn3/rustc_codegen_cranelift
$ git clone https://github.com/rust-lang/rustc_codegen_cranelift
$ cd rustc_codegen_cranelift
$ ./y.sh prepare
$ ./y.sh build
Expand All @@ -29,7 +29,7 @@ Extract the `dist` directory in the archive anywhere you want.
If you want to use `cargo clif build` instead of having to specify the full path to the `cargo-clif` executable, you can add the `bin` subdirectory of the extracted `dist` directory to your `PATH`.
(tutorial [for Windows](https://stackoverflow.com/a/44272417), and [for Linux/MacOS](https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path/26059#26059)).

[releases]: https://github.com/bjorn3/rustc_codegen_cranelift/releases/tag/dev
[releases]: https://github.com/rust-lang/rustc_codegen_cranelift/releases/tag/dev

## Usage

Expand Down Expand Up @@ -78,7 +78,7 @@ configuration options.

* Inline assembly ([no cranelift support](https://github.com/bytecodealliance/wasmtime/issues/1041))
* On UNIX there is support for invoking an external assembler for `global_asm!` and `asm!`.
* SIMD ([tracked here](https://github.com/bjorn3/rustc_codegen_cranelift/issues/171), `std::simd` fully works, `std::arch` is partially supported)
* SIMD ([tracked here](https://github.com/rust-lang/rustc_codegen_cranelift/issues/171), `std::simd` fully works, `std::arch` is partially supported)
* Unwinding on panics ([no cranelift support](https://github.com/bytecodealliance/wasmtime/issues/1677), `-Cpanic=abort` is enabled by default)

## License
Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,17 @@ fn main() {

let f = V([0.0, 1.0]);
let _a = f.0[0];

stack_val_align();
}

#[inline(never)]
fn stack_val_align() {
#[repr(align(8192))]
struct Foo(u8);

let a = Foo(0);
assert_eq!(&a as *const Foo as usize % 8192, 0);
}

#[cfg(all(
Expand Down

This file was deleted.

Loading

0 comments on commit 51ae1fe

Please sign in to comment.