Skip to content

Commit 071f14b

Browse files
committed
Auto merge of rust-lang#110871 - cuviper:beta-next, r=cuviper
[beta] backport This PR backports: - Encode def span for ConstParam rust-lang#110425 - Update to LLVM 16.0.2 rust-lang#110535 - Encode lifetime param spans too rust-lang#110469 - make sysroot finding compatible with multiarch systems rust-lang#110281 - Update awscli rust-lang#110952 - Temporarily disable the jobserver-error test rust-lang#110361 Also bumps us to the latest released stable, 1.69.0. r? `@cuviper`
2 parents 1b7dd22 + 4e2f52c commit 071f14b

File tree

9 files changed

+366
-426
lines changed

9 files changed

+366
-426
lines changed

compiler/rustc_metadata/src/rmeta/encoder.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,8 @@ fn should_encode_span(def_kind: DefKind) -> bool {
823823
| DefKind::TraitAlias
824824
| DefKind::AssocTy
825825
| DefKind::TyParam
826+
| DefKind::ConstParam
827+
| DefKind::LifetimeParam
826828
| DefKind::Fn
827829
| DefKind::Const
828830
| DefKind::Static(_)
@@ -837,12 +839,10 @@ fn should_encode_span(def_kind: DefKind) -> bool {
837839
| DefKind::Impl { .. }
838840
| DefKind::Closure
839841
| DefKind::Generator => true,
840-
DefKind::ConstParam
841-
| DefKind::ExternCrate
842+
DefKind::ExternCrate
842843
| DefKind::Use
843844
| DefKind::ForeignMod
844845
| DefKind::ImplTraitPlaceholder
845-
| DefKind::LifetimeParam
846846
| DefKind::GlobalAsm => false,
847847
}
848848
}

compiler/rustc_session/src/filesearch.rs

+18-17
Original file line numberDiff line numberDiff line change
@@ -227,28 +227,29 @@ pub fn get_or_default_sysroot() -> Result<PathBuf, String> {
227227
))?;
228228

229229
// if `dir` points target's dir, move up to the sysroot
230-
if dir.ends_with(crate::config::host_triple()) {
230+
let mut sysroot_dir = if dir.ends_with(crate::config::host_triple()) {
231231
dir.parent() // chop off `$target`
232232
.and_then(|p| p.parent()) // chop off `rustlib`
233-
.and_then(|p| {
234-
// chop off `lib` (this could be also $arch dir if the host sysroot uses a
235-
// multi-arch layout like Debian or Ubuntu)
236-
match p.parent() {
237-
Some(p) => match p.file_name() {
238-
Some(f) if f == "lib" => p.parent(), // first chop went for $arch, so chop again for `lib`
239-
_ => Some(p),
240-
},
241-
None => None,
242-
}
243-
})
233+
.and_then(|p| p.parent()) // chop off `lib`
244234
.map(|s| s.to_owned())
245-
.ok_or(format!(
246-
"Could not move 3 levels upper using `parent()` on {}",
247-
dir.display()
248-
))
235+
.ok_or_else(|| {
236+
format!("Could not move 3 levels upper using `parent()` on {}", dir.display())
237+
})?
249238
} else {
250-
Ok(dir.to_owned())
239+
dir.to_owned()
240+
};
241+
242+
// On multiarch linux systems, there will be multiarch directory named
243+
// with the architecture(e.g `x86_64-linux-gnu`) under the `lib` directory.
244+
// Which cause us to mistakenly end up in the lib directory instead of the sysroot directory.
245+
if sysroot_dir.ends_with("lib") {
246+
sysroot_dir =
247+
sysroot_dir.parent().map(|real_sysroot| real_sysroot.to_owned()).ok_or_else(
248+
|| format!("Could not move to parent path of {}", sysroot_dir.display()),
249+
)?
251250
}
251+
252+
Ok(sysroot_dir)
252253
}
253254

254255
// Use env::args().next() to get the path of the executable without

src/ci/scripts/install-awscli.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
#
1111
# Before compressing please make sure all the wheels end with `-none-any.whl`.
1212
# If that's not the case you'll need to remove the non-cross-platform ones and
13-
# replace them with the .tar.gz downloaded from https://pypi.org. Also make
14-
# sure it's possible to call this script with both Python 2 and Python 3.
13+
# replace them with the .tar.gz downloaded from https://pypi.org.
1514

1615
set -euo pipefail
1716
IFS=$'\n\t'
1817

1918
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
2019

21-
MIRROR="${MIRRORS_BASE}/2019-07-27-awscli.tar"
20+
MIRROR="${MIRRORS_BASE}/2023-04-28-awscli.tar"
2221
DEPS_DIR="/tmp/awscli-deps"
2322

2423
pip="pip"
@@ -29,6 +28,8 @@ if isLinux; then
2928

3029
sudo apt-get install -y python3-setuptools python3-wheel
3130
ciCommandAddPath "${HOME}/.local/bin"
31+
elif isMacOS; then
32+
pip="pip3"
3233
fi
3334

3435
mkdir -p "${DEPS_DIR}"

src/stage0.json

+291-402
Large diffs are not rendered by default.

tests/run-make/jobserver-error/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
include ../tools.mk
22

33
# only-linux
4+
# ignore-test: This test randomly fails, see https://github.com/rust-lang/rust/issues/110321
45

56
# Test compiler behavior in case: `jobserver-auth` points to correct pipe which is not jobserver.
67

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub fn const_arg<const N: usize, T>() {}
2+
3+
pub fn lt_arg<'a: 'a>() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// aux-build: foreign-generic-mismatch.rs
2+
3+
extern crate foreign_generic_mismatch;
4+
5+
fn main() {
6+
foreign_generic_mismatch::const_arg::<()>();
7+
//~^ ERROR function takes 2 generic arguments but 1 generic argument was supplied
8+
foreign_generic_mismatch::lt_arg::<'static, 'static>();
9+
//~^ ERROR function takes 1 lifetime argument but 2 lifetime arguments were supplied
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied
2+
--> $DIR/foreign-generic-mismatch.rs:6:31
3+
|
4+
LL | foreign_generic_mismatch::const_arg::<()>();
5+
| ^^^^^^^^^ -- supplied 1 generic argument
6+
| |
7+
| expected 2 generic arguments
8+
|
9+
note: function defined here, with 2 generic parameters: `N`, `T`
10+
--> $DIR/auxiliary/foreign-generic-mismatch.rs:1:8
11+
|
12+
LL | pub fn const_arg<const N: usize, T>() {}
13+
| ^^^^^^^^^ -------------- -
14+
help: add missing generic argument
15+
|
16+
LL | foreign_generic_mismatch::const_arg::<(), T>();
17+
| +++
18+
19+
error[E0107]: function takes 1 lifetime argument but 2 lifetime arguments were supplied
20+
--> $DIR/foreign-generic-mismatch.rs:8:31
21+
|
22+
LL | foreign_generic_mismatch::lt_arg::<'static, 'static>();
23+
| ^^^^^^ ------- help: remove this lifetime argument
24+
| |
25+
| expected 1 lifetime argument
26+
|
27+
note: function defined here, with 1 lifetime parameter: `'a`
28+
--> $DIR/auxiliary/foreign-generic-mismatch.rs:3:8
29+
|
30+
LL | pub fn lt_arg<'a: 'a>() {}
31+
| ^^^^^^ --
32+
33+
error: aborting due to 2 previous errors
34+
35+
For more information about this error, try `rustc --explain E0107`.

0 commit comments

Comments
 (0)